diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..bf3241a2d9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: http://EditorConfig.org + +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.{js,d.ts,json,html,md,sh}] +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index e81efdc79b..0000000000 --- a/.eslintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/fbjs-scripts/eslint/.eslintrc", - "rules": { - // These are functional errors that could either be fixed or be locally disabled in specific - // files - "no-bitwise": 0, - "constructor-super": 0, - "no-this-before-super": 0, - "no-self-compare": 0, - "operator-assignment": 0, - "consistent-return": 0, - - // These are stylistic errors that could be easily fixed - "semi": 0, - "comma-dangle": 0, - "space-before-function-paren": 0, - "curly": 0, - } -} diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000000..17a489a8c3 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# upgrade to prettier 3 +0355483c301dba5e215e2c3d113125a274444e38 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000000..936cae52b0 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,105 @@ +# Have a question? + +Please ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/immutable.js) instead of opening a Github Issue. There are more people on Stack Overflow who +can answer questions, and good answers can be searchable and canonical. + +# Issues + +We use GitHub issues to track bugs. Please ensure your bug description is clear +and has sufficient instructions to be able to reproduce the issue. + +The absolute best way to report a bug is to submit a pull request including a +new failing test which describes the bug. When the bug is fixed, your pull +request can then be merged! + +The next best way to report a bug is to provide a reduced test case on jsFiddle +or jsBin or produce exact code inline in the issue which will reproduce the bug. + +# Code of Conduct + +Immutable.js is maintained within the [Contributor Covenant's Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/). + +# Pull Requests + +All active development of Immutable JS happens on GitHub. We actively welcome +your [pull requests](https://help.github.com/articles/creating-a-pull-request). + +1. Fork the repo and create your branch from `master`. +2. Install all dependencies. (`npm install`) +3. If you've added code, add tests. +4. If you've changed APIs, update the documentation. +5. Build generated JS, run tests and ensure your code passes lint. (`npm run test`) +6. If you haven't already, complete the Contributor License Agreement ("CLA"). + +## Documentation + +Documentation for Immutable.js (hosted at http://immutable-js.github.io/immutable-js) +is developed in `pages/`. Run `npm start` to get a local copy in your browser +while making edits. + +## Coding Style + +- 2 spaces for indentation (no tabs) +- 80 character line length strongly preferred. +- Prefer `'` over `"` +- ES6 Harmony when possible. +- Use semicolons; +- Trailing commas, +- Avd abbr wrds. + +# Functionality Testing + +Run the following command to build the library and test functionality: + +```bash +npm run test +``` + +## Performance Regression Testing + +Performance tests run against master and your feature branch. +Make sure to commit your changes in your local feature branch before proceeding. + +These commands assume you have a remote named `upstream` amd that you do not already have a local `master` branch: + +```bash +git fetch upstream +git checkout -b master upstream/master +``` + +These commands build `dist` and commit `dist/immutable.js` to `master` so that the regression tests can run. +```bash +npm run test +git add dist/immutable.js -f +git commit -m 'perf test prerequisite.' +``` + +Switch back to your feature branch, and run the following command to run regression tests: + +```bash +npm run test +npm run perf +``` + +Sample output: + +```bash +> immutable@4.0.0-rc.9 perf ~/github.com/immutable-js/immutable-js +> node ./resources/bench.js + +List > builds from array of 2 + Old: 678,974 683,071 687,218 ops/sec + New: 669,012 673,553 678,157 ops/sec + compare: 1 -1 + diff: -1.4% + rme: 0.64% +``` + +## TypeScript version support + +TypeScript version does support the same version as [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped) versions. Immutable "may" work with older versions, but no support will be provided. + +## License + +By contributing to Immutable.js, you agree that your contributions will be +licensed under its MIT license. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000000..4cf7679033 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [jdeniau, Methuselah96] diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md similarity index 79% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE.md index dbcdc2e0da..3387aa797e 100644 --- a/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,8 +6,9 @@ --- Have a general question? --- -First check out the Docs: https://facebook.github.io/immutable-js/docs/ -Search existing issues: https://github.com/facebook/immutable-js/search?type=Issues&q=question +First check out the Docs: https://immutable-js.github.io/immutable-js/docs/ +And check out the Wiki: https://github.com/immutable-js/immutable-js/wiki/ +Search existing issues: https://github.com/immutable-js/immutable-js/search?type=Issues&q=question Ask on Stack Overflow!: https://stackoverflow.com/questions/tagged/immutable.js?sort=votes * Stack Overflow gets more attention @@ -25,10 +26,11 @@ libraries over continuous additions. Here are some tips to get your feature adde --- Found a bug? --- -Search existing issues first: https://github.com/facebook/immutable-js/search?type=Issues&q=bug +Search existing issues first: https://github.com/immutable-js/immutable-js/search?type=Issues&q=bug Please ensure you're using the latest version, and provide some information below. --> + ### What happened + +- Add "sideEffects: false" to package.json ([#1661](https://github.com/immutable-js/immutable-js/pull/1661)) + +- Use ES standard for iterator method reuse ([#1867](https://github.com/immutable-js/immutable-js/pull/1867)) + +- Generalize `fromJS()` and `Seq()` to support Sets ([#1865](https://github.com/immutable-js/immutable-js/pull/1865)) + +- Top level predicate functions ([#1600](https://github.com/immutable-js/immutable-js/pull/1600)) + + > New functions are exported from the `immutable` module: + > `isSeq()`, `isList()`, `isMap()`, `isOrderedMap()`, `isStack()`, `isSet()`, `isOrderedSet()`, and `isRecord()`. + +- Improve performance of toJS ([#1581](https://github.com/immutable-js/immutable-js/pull/1581)) + + > Cursory test is >10% faster than both v3.8.2 and v4.0.0-rc.7, + > and corrects the regression since v4.0.0-rc.9. + +- Added optional `notSetValue` in `first()` and `last()` ([#1556](https://github.com/immutable-js/immutable-js/pull/1556)) + +- Make `isArrayLike` check more precise to avoid false positives ([#1520](https://github.com/immutable-js/immutable-js/pull/1520)) + +- `map()` for List, Map, and Set returns itself for no-ops ([#1455](https://github.com/immutable-js/immutable-js/pull/1455)) (5726bd1) + +- Hash functions as objects, allowing functions as values in collections ([#1485](https://github.com/immutable-js/immutable-js/pull/1485)) + +- Functional API for `get()`, `set()`, and more which support both Immutable.js collections and plain Objects and Arrays ([#1369](https://github.com/immutable-js/immutable-js/pull/1369)) + +- Relicensed as MIT ([#1320](https://github.com/immutable-js/immutable-js/pull/1320)) + +- Support for Transducers! ([ee9c68f1](https://github.com/immutable-js/immutable-js/commit/ee9c68f1d43da426498ee009ecea37aa2ef77cb8)) + +- Add new method, `zipAll()` ([#1195](https://github.com/immutable-js/immutable-js/pull/1195)) + +- Bundle and distribute an "es module" so Webpack and Rollup can use tree-shaking for smaller builds ([#1204](https://github.com/immutable-js/immutable-js/pull/1204)) + +- Warn instead of throw when `getIn()` has a bad path ([668f2236](https://github.com/immutable-js/immutable-js/commit/668f2236642c97bd4e7d8dfbf62311f497a6ac18)) + +- A new predicate function `isValueObject()` helps to detect objects which implement `equals()` and `hashCode()`, + and type definitions now define the interface `ValueObject` which you can implement in your own code to create objects which + behave as values and can be keys in Maps or entries in Sets. + +- Using `fromJS()` with a "reviver" function now provides access to the key path to each translated value. ([#1118](https://github.com/immutable-js/immutable-js/pull/1118)) + +### Fixed + +- Fix issue with IE11 and missing Symbol.iterator ([#1850](https://github.com/immutable-js/immutable-js/pull/1850)) + +- Fix ordered set with map ([#1663](https://github.com/immutable-js/immutable-js/pull/1663)) + +- Do not modify iter during List.map and Map.map ([#1649](https://github.com/immutable-js/immutable-js/pull/1649)) + +- Fix ordered map delete all ([#1777](https://github.com/immutable-js/immutable-js/pull/1777)) + +- Hash symbols as objects ([#1753](https://github.com/immutable-js/immutable-js/pull/1753)) + +- Fix returning a Record in merge() when Record is empty ([#1785](https://github.com/immutable-js/immutable-js/pull/1785)) + +- Fix for RC~12: Records from different factories aren't equal ([#1734](https://github.com/immutable-js/immutable-js/issues/1734)) + +- "too much recursion" error when creating a Record type from an instance of another Record ([#1690](https://github.com/immutable-js/immutable-js/pull/1690)) + +- Fix glob for npm format script on Windows ([#18](https://github.com/immutable-js-oss/immutable-js/pull/18)) + +- Remove deprecated cursor API ([#13](https://github.com/immutable-js-oss/immutable-js/issues/13)) + +- Add missing es exports ([#1740](https://github.com/immutable-js/immutable-js/pull/1740)) + +- Support nulls in genTypeDefData.js ([#185](https://github.com/immutable-js/immutable-js/pull/185)) + +- Support isPlainObj in IE11 and other esoteric parameters [f3a6d5ce](https://github.com/immutable-js/immutable-js/pull/1833/commits/f3a6d5ce75bb9d60b87074240838f5429e896b60) + +- `Set.map` produces valid underlying map ([#1606](https://github.com/immutable-js/immutable-js/pull/1606)) + +- Support isPlainObj with `constructor` key ([#1627](https://github.com/immutable-js/immutable-js/pull/1627)) + +- `groupBy` no longer returns a mutable Map instance ([#1602](https://github.com/immutable-js/immutable-js/pull/1602)) + +- Fix issue where refs can recursively collide, corrupting `.size` ([#1598](https://github.com/immutable-js/immutable-js/pull/1598)) + +- Throw error in `mergeWith()` method if missing the required `merger` function ([#1543](https://github.com/immutable-js/immutable-js/pull/1543)) + +- Update `isPlainObj()` to workaround Safari bug and allow cross-realm values ([#1557](https://github.com/immutable-js/immutable-js/pull/1557)) + +- Fix missing "& T" to some methods in RecordInstance ([#1464](https://github.com/immutable-js/immutable-js/pull/1464)) + +- Make notSetValue optional for typed Records ([#1461](https://github.com/immutable-js/immutable-js/pull/1461)) (a1029bb) + +- Export type of RecordInstance ([#1434](https://github.com/immutable-js/immutable-js/pull/1434)) + +- Fix Record `size` check in merge() ([#1521](https://github.com/immutable-js/immutable-js/pull/1521)) + +- Fix Map#concat being not defined ([#1402](https://github.com/immutable-js/immutable-js/pull/1402)) + + + + + +- `getIn()` no longer throws when encountering a missing path ([#1361](https://github.com/immutable-js/immutable-js/pull/1361)) + + + +- Do not throw when printing value that cannot be coerced to primitive ([#1334](https://github.com/immutable-js/immutable-js/pull/1334)) + + + + + +- Do not throw from hasIn ([#1319](https://github.com/immutable-js/immutable-js/pull/1319)) + +- Long hash codes no longer cause an infinite loop ([#1175](https://github.com/immutable-js/immutable-js/pull/1175)) + +- `slice()` which should return an empty set could return a full set or vice versa (#1245, #1287) + +- Ensure empty slices do not throw when iterated ([#1220](https://github.com/immutable-js/immutable-js/pull/1220)) + +- Error during equals check on Record with undefined or null ([#1208](https://github.com/immutable-js/immutable-js/pull/1208)) + +- Fix size of count() after filtering or flattening ([#1171](https://github.com/immutable-js/immutable-js/pull/1171)) + +## [3.8.2] - 2017-10-05 + +Released in 2017, still the most commonly used release. + +[unreleased]: https://github.com/immutable-js/immutable-js/compare/v4.0.0-rc.15...HEAD +[4.0.0]: https://github.com/immutable-js/immutable-js/compare/v3.8.2...v4.0.0-rc.15 +[3.8.2]: https://github.com/immutable-js/immutable-js/compare/3.7.6...v3.8.2 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 8d547d10f7..0000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,61 +0,0 @@ -# Have a question? - -Please ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/immutable.js) instead of opening a Github Issue. There are more people on Stack Overflow who -can answer questions, and good answers can be searchable and canonical. - -# Issues - -We use GitHub issues to track bugs. Please ensure your bug description is clear -and has sufficient instructions to be able to reproduce the issue. - -The absolute best way to report a bug is to submit a pull request including a -new failing test which describes the bug. When the bug is fixed, your pull -request can then be merged! - -The next best way to report a bug is to provide a reduced test case on jsFiddle -or jsBin or produce exact code inline in the issue which will reproduce the bug. - -Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe -disclosure of security bugs. In those cases, please go through the process -outlined on that page and do not file a public issue. - -# Pull Requests - -All active development of Immutable JS happens on GitHub. We actively welcome -your [pull requests](https://help.github.com/articles/creating-a-pull-request). - - 1. Fork the repo and create your branch from `master`. - 2. Install all dependencies. (`npm install`) - 3. If you've added code, add tests. - 4. If you've changed APIs, update the documentation. - 5. Build generated JS, run tests and ensure your code passes lint. (`npm run build && npm run test`) - 6. Be sure to commit the generated JS in `/dist`. - 7. If you haven't already, complete the Contributor License Agreement ("CLA"). - -## Documentation - -Documentation for Immutable.js (hosted at http://facebook.github.io/immutable-js) -is developed in `pages/`. Run `npm start` to get a local copy in your browser -while making edits. - -## Contributor License Agreement ("CLA") - -In order to accept your pull request, we need you to submit a CLA. You only need -to do this once to work on any of Facebook's open source projects. - -Complete your CLA here: - -## Coding Style - -* 2 spaces for indentation (no tabs) -* 80 character line length strongly preferred. -* Prefer `'` over `"` -* ES6 Harmony when possible. -* Use semicolons; -* Trailing commas, -* Avd abbr wrds. - -## License - -By contributing to Immutable.js, you agree that your contributions will be -licensed under its BSD license. diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index fdb0c0f115..0000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,211 +0,0 @@ -var exec = require('child_process').exec; -var fs = require('fs'); -var rollup = require('rollup'); -var uglify = require('uglify-js'); - -var declassify = require('./resources/declassify'); -var stripCopyright = require('./resources/stripCopyright'); - -/** - * - * grunt lint Lint all source javascript - * grunt clean Clean dist folder - * grunt build Build dist javascript - * grunt default Lint, Build then Test - * - */ -module.exports = function(grunt) { - grunt.initConfig({ - jshint: { - options: { - asi: true, - curly: false, - eqeqeq: true, - esnext: true, - expr: true, - forin: true, - freeze: false, - immed: true, - indent: 2, - iterator: true, - loopfunc: true, - noarg: true, - node: true, - noempty: true, - nonstandard: true, - trailing: true, - undef: true, - unused: 'vars', - }, - all: ['src/**/*.js'] - }, - clean: { - build: ['dist/*'] - }, - bundle: { - build: { - files: [{ - src: 'src/Immutable.js', - dest: 'dist/immutable' - }] - } - }, - copy: { - build: { - files: [{ - src: 'type-definitions/Immutable.d.ts', - dest: 'dist/immutable.d.ts' - },{ - src: 'type-definitions/immutable.js.flow', - dest: 'dist/immutable.js.flow' - }] - } - }, - }); - - grunt.registerMultiTask('bundle', function () { - var done = this.async(); - - this.files.map(function (file) { - rollup.rollup({ - entry: file.src[0], - plugins: [ - { - transform: function(source) { - return declassify(stripCopyright(source)); - } - } - ] - }).then(function (bundle) { - var copyright = fs.readFileSync('resources/COPYRIGHT'); - - var bundled = bundle.generate({ - format: 'umd', - banner: copyright, - moduleName: 'Immutable' - }).code; - - var es6 = require('es6-transpiler'); - - var transformResult = require("es6-transpiler").run({ - src: bundled, - disallowUnknownReferences: false, - environments: ["node", "browser"], - globals: { - define: false, - Symbol: false, - }, - }); - - if (transformResult.errors && transformResult.errors.length > 0) { - throw new Error(transformResult.errors[0]); - } - - var transformed = transformResult.src; - - fs.writeFileSync(file.dest + '.js', transformed); - - var minifyResult = uglify.minify(transformed, { - fromString: true, - mangle: { - toplevel: true - }, - compress: { - comparisons: true, - pure_getters: true, - unsafe: true - }, - output: { - max_line_len: 2048, - }, - reserved: ['module', 'define', 'Immutable'] - }); - - var minified = minifyResult.code; - - fs.writeFileSync(file.dest + '.min.js', copyright + minified); - }).then(function(){ done(); }, function(error) { - grunt.log.error(error.stack); - done(false); - }); - }); - }); - - grunt.registerTask('typedefs', function () { - var fileContents = fs.readFileSync('type-definitions/Immutable.d.ts', 'utf8'); - var nonAmbientSource = fileContents - .replace( - /declare\s+module\s+Immutable\s*\{/, - '') - .replace( - /\}[\s\n\r]*declare\s+module\s*.immutable.[\s\n\r]*{[\s\n\r]*export\s*=\s*Immutable[\s\n\r]*\}/m, - ''); - fs.writeFileSync('dist/immutable-nonambient.d.ts', nonAmbientSource); - }); - - function execp(cmd) { - return new Promise((resolve, reject) => - exec(cmd, (error, out) => error ? reject(error) : resolve(out)) - ); - } - - grunt.registerTask('stats', function () { - Promise.all([ - execp('cat dist/immutable.js | wc -c'), - execp('git show master:dist/immutable.js | wc -c'), - execp('cat dist/immutable.min.js | wc -c'), - execp('git show master:dist/immutable.min.js | wc -c'), - execp('cat dist/immutable.min.js | gzip -c | wc -c'), - execp('git show master:dist/immutable.min.js | gzip -c | wc -c'), - ]).then(results => { - results = results.map(result => parseInt(result)); - - var rawNew = results[0]; - var rawOld = results[1]; - var minNew = results[2]; - var minOld = results[3]; - var zipNew = results[4]; - var zipOld = results[5]; - - function space(n, s) { - return Array(Math.max(0, 10 + n - (s||'').length)).join(' ') + (s||''); - } - - function bytes(b) { - return b.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + ' bytes'; - } - - function diff(n, o) { - var d = n - o; - return d === 0 ? '' : d < 0 ? (' ' + bytes(d)).green : (' +' + bytes(d)).red; - } - - function pct(s, b) { - var p = Math.floor(10000 * (1 - (s / b))) / 100; - return (' ' + p + '%').grey; - } - - console.log(' Raw: ' + - space(14, bytes(rawNew).cyan) + ' ' + space(15, diff(rawNew, rawOld)) - ); - console.log(' Min: ' + - space(14, bytes(minNew).cyan) + pct(minNew, rawNew) + space(15, diff(minNew, minOld)) - ); - console.log(' Zip: ' + - space(14, bytes(zipNew).cyan) + pct(zipNew, rawNew) + space(15, diff(zipNew, zipOld)) - ); - - }).then(this.async()).catch( - error => setTimeout(() => { throw error; }, 0) - ); - }); - - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-release'); - - grunt.registerTask('lint', 'Lint all source javascript', ['jshint']); - grunt.registerTask('build', 'Build distributed javascript', ['clean', 'bundle', 'copy', 'typedefs']); - grunt.registerTask('default', 'Lint, build.', ['lint', 'build', 'stats']); -} diff --git a/LICENSE b/LICENSE index c6a207cd5e..1e3c4f39c0 100644 --- a/LICENSE +++ b/LICENSE @@ -1,30 +1,21 @@ -BSD License +MIT License -For Immutable JS software +Copyright (c) 2014-present, Lee Byron and other contributors. -Copyright (c) 2014-2015, Facebook, Inc. All rights reserved. +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: -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name Facebook nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/PATENTS b/PATENTS deleted file mode 100644 index b145145264..0000000000 --- a/PATENTS +++ /dev/null @@ -1,11 +0,0 @@ -Additional Grant of Patent Rights Version 2 - -"Software" means the Immutable JS software distributed by Facebook, Inc. - -Facebook, Inc. (“Facebook”) hereby grants to each recipient of the Software (“you”) a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (subject to the termination provision below) license under any Necessary Claims, to make, have made, use, sell, offer to sell, import, and otherwise transfer the Software. For avoidance of doubt, no license is granted under Facebook’s rights in any patent claims that are infringed by (i) modifications to the Software made by you or any third party or (ii) the Software in combination with any software or other technology. - -The license granted hereunder will terminate, automatically and without notice, if you (or any of your subsidiaries, corporate affiliates or agents) initiate directly or indirectly, or take a direct financial interest in, any Patent Assertion: (i) against Facebook or any of its subsidiaries or corporate affiliates, (ii) against any party if such Patent Assertion arises in whole or in part from any software, technology, product or service of Facebook or any of its subsidiaries or corporate affiliates, or (iii) against any party relating to the Software. Notwithstanding the foregoing, if Facebook or any of its subsidiaries or corporate affiliates files a lawsuit alleging patent infringement against you in the first instance, and you respond by filing a patent infringement counterclaim in that lawsuit against that party that is unrelated to the Software, the license granted hereunder will not terminate under section (i) of this paragraph due to such counterclaim. - -A “Necessary Claim” is a claim of a patent owned by Facebook that is necessarily infringed by the Software standing alone. - -A “Patent Assertion” is any lawsuit or other action alleging direct, indirect, or contributory infringement or inducement to infringe any patent, including a cross-claim or counterclaim. diff --git a/README.md b/README.md index e907fa3d1f..e823a42136 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,27 @@ -Immutable collections for JavaScript -==================================== +# Immutable collections for JavaScript -[![Build Status](https://travis-ci.org/facebook/immutable-js.svg?branch=master)](https://travis-ci.org/facebook/immutable-js) +[![Build Status](https://github.com/immutable-js/immutable-js/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/immutable-js/immutable-js/actions/workflows/ci.yml?query=branch%3Amain) [Chat on slack](https://immutable-js.slack.com) + +[Read the docs](https://immutable-js.com/docs/) and eat your vegetables. + +Docs are automatically generated from [README.md][] and [immutable.d.ts][]. +Please contribute! Also, don't miss the [wiki][] which contains articles on +additional specific topics. Can't find something? Open an [issue][]. + +**Table of contents:** + +- [Introduction](#introduction) +- [Getting started](#getting-started) +- [The case for Immutability](#the-case-for-immutability) +- [JavaScript-first API](#javascript-first-api) +- [Nested Structures](#nested-structures) +- [Equality treats Collections as Values](#equality-treats-collections-as-values) +- [Batching Mutations](#batching-mutations) +- [Lazy Seq](#lazy-seq) +- [Additional Tools and Resources](#additional-tools-and-resources) +- [Contributing](#contributing) + +## Introduction [Immutable][] data cannot be changed once created, leading to much simpler application development, no defensive copying, and enabling advanced memoization @@ -16,93 +36,127 @@ These data structures are highly efficient on modern JavaScript VMs by using structural sharing via [hash maps tries][] and [vector tries][] as popularized by Clojure and Scala, minimizing the need to copy or cache data. -`Immutable` also provides a lazy `Seq`, allowing efficient +Immutable.js also provides a lazy `Seq`, allowing efficient chaining of collection methods like `map` and `filter` without creating intermediate representations. Create some `Seq` with `Range` and `Repeat`. Want to hear more? Watch the presentation about Immutable.js: - +[![Immutable Data and React](website/public/Immutable-Data-and-React-YouTube.png)](https://youtu.be/I7IdS-PbEgI) -[Persistent]: http://en.wikipedia.org/wiki/Persistent_data_structure -[Immutable]: http://en.wikipedia.org/wiki/Immutable_object -[hash maps tries]: http://en.wikipedia.org/wiki/Hash_array_mapped_trie -[vector tries]: http://hypirion.com/musings/understanding-persistent-vector-pt-1 +[README.md]: https://github.com/immutable-js/immutable-js/blob/main/README.md +[immutable.d.ts]: https://github.com/immutable-js/immutable-js/blob/main/type-definitions/immutable.d.ts +[wiki]: https://github.com/immutable-js/immutable-js/wiki +[issue]: https://github.com/immutable-js/immutable-js/issues +[Persistent]: https://en.wikipedia.org/wiki/Persistent_data_structure +[Immutable]: https://en.wikipedia.org/wiki/Immutable_object +[hash maps tries]: https://en.wikipedia.org/wiki/Hash_array_mapped_trie +[vector tries]: https://hypirion.com/musings/understanding-persistent-vector-pt-1 - -Getting started ---------------- +## Getting started Install `immutable` using npm. ```shell +# using npm npm install immutable + +# using Yarn +yarn add immutable + +# using pnpm +pnpm add immutable + +# using Bun +bun add immutable ``` Then require it into any module. -```javascript -var Immutable = require('immutable'); -var map1 = Immutable.Map({a:1, b:2, c:3}); -var map2 = map1.set('b', 50); -map1.get('b'); // 2 -map2.get('b'); // 50 +```js +const { Map } = require('immutable'); +const map1 = Map({ a: 1, b: 2, c: 3 }); +const map2 = map1.set('b', 50); +map1.get('b') + ' vs. ' + map2.get('b'); // 2 vs. 50 ``` ### Browser -To use `immutable` from a browser, download [dist/immutable.min.js](https://github.com/facebook/immutable-js/blob/master/dist/immutable.min.js) -or use a CDN such as [CDNJS](https://cdnjs.com/libraries/immutable) -or [jsDelivr](http://www.jsdelivr.com/#!immutable.js). +Immutable.js has no dependencies, which makes it predictable to include in a Browser. -Then, add it as a script tag to your page: +It's highly recommended to use a module bundler like [webpack](https://webpack.js.org/), +[rollup](https://rollupjs.org/), or +[browserify](https://browserify.org/). The `immutable` npm module works +without any additional consideration. All examples throughout the documentation +will assume use of this kind of tool. + +Alternatively, Immutable.js may be directly included as a script tag. Download +or link to a CDN such as [CDNJS](https://cdnjs.com/libraries/immutable) +or [jsDelivr](https://www.jsdelivr.com/package/npm/immutable). + +Use a script tag to directly add `Immutable` to the global scope: ```html ``` -Or use an AMD loader (such as [RequireJS](http://requirejs.org/)): +Or use an AMD-style loader (such as [RequireJS](https://requirejs.org/)): -```javascript +```js require(['./immutable.min.js'], function (Immutable) { - var map1 = Immutable.Map({a:1, b:2, c:3}); - var map2 = map1.set('b', 50); - map1.get('b'); // 2 - map2.get('b'); // 50 + var map1 = Immutable.Map({ a: 1, b: 2, c: 3 }); + var map2 = map1.set('b', 50); + map1.get('b'); // 2 + map2.get('b'); // 50 }); ``` -If you're using [browserify](http://browserify.org/), the `immutable` npm module -also works from the browser. - -### TypeScript +### Flow & TypeScript Use these Immutable collections and sequences as you would use native -collections in your [TypeScript](http://typescriptlang.org) programs while still taking +collections in your [Flowtype](https://flowtype.org/) or [TypeScript](https://typescriptlang.org) programs while still taking advantage of type generics, error detection, and auto-complete in your IDE. -Just add a reference with a relative path to the type declarations at the top -of your file. +Installing `immutable` via npm brings with it type definitions for Flow (v0.55.0 or higher) +and TypeScript (v4.5 or higher), so you shouldn't need to do anything at all! -```javascript +#### Using TypeScript with Immutable.js v4+ + +Immutable.js type definitions embrace ES2015. While Immutable.js itself supports +legacy browsers and environments, its type definitions require TypeScript's 2015 +lib. Include either `"target": "es2015"` or `"lib": "es2015"` in your +`tsconfig.json`, or provide `--target es2015` or `--lib es2015` to the +`tsc` command. + +```js +const { Map } = require('immutable'); +const map1 = Map({ a: 1, b: 2, c: 3 }); +const map2 = map1.set('b', 50); +map1.get('b') + ' vs. ' + map2.get('b'); // 2 vs. 50 +``` + +#### Using TypeScript with Immutable.js v3 and earlier: + +Previous versions of Immutable.js include a reference file which you can include +via relative path to the type definitions at the top of your file. + +```js /// -import Immutable = require('immutable'); -var map1: Immutable.Map; -map1 = Immutable.Map({a:1, b:2, c:3}); +import { Map } from 'immutable'; +var map1: Map; +map1 = Map({ a: 1, b: 2, c: 3 }); var map2 = map1.set('b', 50); map1.get('b'); // 2 map2.get('b'); // 50 ``` - -The case for Immutability -------------------------- +## The case for Immutability Much of what makes application development difficult is tracking mutation and maintaining state. Developing with immutable data encourages you to think @@ -121,23 +175,23 @@ and especially well with an application designed using the ideas of [Flux][]. When data is passed from above rather than being subscribed to, and you're only interested in doing work when something has changed, you can use equality. -Immutable collections should be treated as *values* rather than *objects*. While +Immutable collections should be treated as _values_ rather than _objects_. While objects represent some thing which could change over time, a value represents the state of that thing at a particular instance of time. This principle is most important to understanding the appropriate use of immutable data. In order to treat Immutable.js collections as values, it's important to use the -`Immutable.is()` function or `.equals()` method to determine value equality -instead of the `===` operator which determines object reference identity. - -```javascript -var map1 = Immutable.Map({a:1, b:2, c:3}); -var map2 = map1.set('b', 2); -assert(map1.equals(map2) === true); -var map3 = map1.set('b', 50); -assert(map1.equals(map3) === false); +`Immutable.is()` function or `.equals()` method to determine _value equality_ +instead of the `===` operator which determines object _reference identity_. + +```js +const { Map } = require('immutable'); +const map1 = Map({ a: 1, b: 2, c: 3 }); +const map2 = Map({ a: 1, b: 2, c: 3 }); +map1.equals(map2); // true +map1 === map2; // false ``` -Note: As a performance optimization `Immutable` attempts to return the existing +Note: As a performance optimization Immutable.js attempts to return the existing collection when an operation would result in an identical collection, allowing for using `===` reference equality to determine if something definitely has not changed. This can be extremely useful when used within a memoization function @@ -145,48 +199,55 @@ which would prefer to re-run the function if a deeper equality check could potentially be more costly. The `===` equality check is also used internally by `Immutable.is` and `.equals()` as a performance optimization. +```js +const { Map } = require('immutable'); +const map1 = Map({ a: 1, b: 2, c: 3 }); +const map2 = map1.set('b', 2); // Set to same value +map1 === map2; // true +``` + If an object is immutable, it can be "copied" simply by making another reference to it instead of copying the entire object. Because a reference is much smaller than the object itself, this results in memory savings and a potential boost in execution speed for programs which rely on copies (such as an undo-stack). -```javascript -var map1 = Immutable.Map({a:1, b:2, c:3}); -var clone = map1; +```js +const { Map } = require('immutable'); +const map = Map({ a: 1, b: 2, c: 3 }); +const mapCopy = map; // Look, "copies" are free! ``` -[React]: http://facebook.github.io/react/ -[Flux]: http://facebook.github.io/flux/docs/overview.html - +[React]: https://reactjs.org/ +[Flux]: https://facebook.github.io/flux/docs/in-depth-overview/ -JavaScript-first API --------------------- +## JavaScript-first API -While `immutable` is inspired by Clojure, Scala, Haskell and other functional +While Immutable.js is inspired by Clojure, Scala, Haskell and other functional programming environments, it's designed to bring these powerful concepts to JavaScript, and therefore has an Object-Oriented API that closely mirrors that -of [ES6][] [Array][], [Map][], and [Set][]. +of [ES2015][] [Array][], [Map][], and [Set][]. -[ES6]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla -[Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array -[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map -[Set]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set +[es2015]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla +[array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array +[map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map +[set]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set The difference for the immutable collections is that methods which would mutate -the collection, like `push`, `set`, `unshift` or `splice` instead return a new -immutable collection. Methods which return new arrays like `slice` or `concat` +the collection, like `push`, `set`, `unshift` or `splice`, instead return a new +immutable collection. Methods which return new arrays, like `slice` or `concat`, instead return new immutable collections. -```javascript -var list1 = Immutable.List.of(1, 2); -var list2 = list1.push(3, 4, 5); -var list3 = list2.unshift(0); -var list4 = list1.concat(list2, list3); -assert(list1.size === 2); -assert(list2.size === 5); -assert(list3.size === 6); -assert(list4.size === 13); -assert(list4.get(0) === 1); +```js +const { List } = require('immutable'); +const list1 = List([1, 2]); +const list2 = list1.push(3, 4, 5); +const list3 = list2.unshift(0); +const list4 = list1.concat(list2, list3); +assert.equal(list1.size, 2); +assert.equal(list2.size, 5); +assert.equal(list3.size, 6); +assert.equal(list4.size, 13); +assert.equal(list4.get(0), 1); ``` Almost all of the methods on [Array][] will be found in similar form on @@ -194,35 +255,45 @@ Almost all of the methods on [Array][] will be found in similar form on found on `Immutable.Set`, including collection operations like `forEach()` and `map()`. -```javascript -var alpha = Immutable.Map({a:1, b:2, c:3, d:4}); +```js +const { Map } = require('immutable'); +const alpha = Map({ a: 1, b: 2, c: 3, d: 4 }); alpha.map((v, k) => k.toUpperCase()).join(); // 'A,B,C,D' ``` -### Accepts raw JavaScript objects. +### Convert from raw JavaScript objects and arrays. -Designed to inter-operate with your existing JavaScript, `immutable` -accepts plain JavaScript Arrays and Objects anywhere a method expects an -`Iterable` with no performance penalty. +Designed to inter-operate with your existing JavaScript, Immutable.js +accepts plain JavaScript Arrays and Objects anywhere a method expects a +`Collection`. -```javascript -var map1 = Immutable.Map({a:1, b:2, c:3, d:4}); -var map2 = Immutable.Map({c:10, a:20, t:30}); -var obj = {d:100, o:200, g:300}; -var map3 = map1.merge(map2, obj); +```js +const { Map, List } = require('immutable'); +const map1 = Map({ a: 1, b: 2, c: 3, d: 4 }); +const map2 = Map({ c: 10, a: 20, t: 30 }); +const obj = { d: 100, o: 200, g: 300 }; +const map3 = map1.merge(map2, obj); // Map { a: 20, b: 2, c: 10, d: 100, t: 30, o: 200, g: 300 } +const list1 = List([1, 2, 3]); +const list2 = List([4, 5, 6]); +const array = [7, 8, 9]; +const list3 = list1.concat(list2, array); +// List [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] ``` -This is possible because `immutable` can treat any JavaScript Array or Object -as an Iterable. You can take advantage of this in order to get sophisticated +This is possible because Immutable.js can treat any JavaScript Array or Object +as a Collection. You can take advantage of this in order to get sophisticated collection methods on JavaScript Objects, which otherwise have a very sparse native API. Because Seq evaluates lazily and does not cache intermediate results, these operations can be extremely efficient. -```javascript -var myObject = {a:1,b:2,c:3}; -Immutable.Seq(myObject).map(x => x * x).toObject(); +```js +const { Seq } = require('immutable'); +const myObject = { a: 1, b: 2, c: 3 }; +Seq(myObject) + .map((x) => x * x) + .toObject(); // { a: 1, b: 4, c: 9 } ``` @@ -231,68 +302,82 @@ JavaScript Object properties are always strings, even if written in a quote-less shorthand, while Immutable Maps accept keys of any type. ```js -var obj = { 1: "one" }; -Object.keys(obj); // [ "1" ] -obj["1"]; // "one" -obj[1]; // "one" - -var map = Immutable.fromJS(obj); -map.get("1"); // "one" -map.get(1); // undefined +const { fromJS } = require('immutable'); + +const obj = { 1: 'one' }; +console.log(Object.keys(obj)); // [ "1" ] +console.log(obj['1'], obj[1]); // "one", "one" + +const map = fromJS(obj); +console.log(map.get('1'), map.get(1)); // "one", undefined ``` Property access for JavaScript Objects first converts the key to a string, but since Immutable Map keys can be of any type the argument to `get()` is not altered. - ### Converts back to raw JavaScript objects. -All `immutable` Iterables can be converted to plain JavaScript Arrays and +All Immutable.js Collections can be converted to plain JavaScript Arrays and Objects shallowly with `toArray()` and `toObject()` or deeply with `toJS()`. -All Immutable Iterables also implement `toJSON()` allowing them to be passed to -`JSON.stringify` directly. - -```javascript -var deep = Immutable.Map({ a: 1, b: 2, c: Immutable.List.of(3, 4, 5) }); -deep.toObject() // { a: 1, b: 2, c: List [ 3, 4, 5 ] } -deep.toArray() // [ 1, 2, List [ 3, 4, 5 ] ] -deep.toJS() // { a: 1, b: 2, c: [ 3, 4, 5 ] } -JSON.stringify(deep) // '{"a":1,"b":2,"c":[3,4,5]}' +All Immutable Collections also implement `toJSON()` allowing them to be passed +to `JSON.stringify` directly. They also respect the custom `toJSON()` methods of +nested objects. + +```js +const { Map, List } = require('immutable'); +const deep = Map({ a: 1, b: 2, c: List([3, 4, 5]) }); +console.log(deep.toObject()); // { a: 1, b: 2, c: List [ 3, 4, 5 ] } +console.log(deep.toArray()); // [ 1, 2, List [ 3, 4, 5 ] ] +console.log(deep.toJS()); // { a: 1, b: 2, c: [ 3, 4, 5 ] } +JSON.stringify(deep); // '{"a":1,"b":2,"c":[3,4,5]}' ``` -### Embraces ES6 +### Embraces ES2015 -`Immutable` takes advantage of features added to JavaScript in [ES6][], -the latest standard version of ECMAScript (JavaScript), including [Iterators][], -[Arrow Functions][], [Classes][], and [Modules][]. It's also inspired by the -[Map][] and [Set][] collections added to ES6. The library is "transpiled" to ES3 -in order to support all modern browsers. +Immutable.js supports all JavaScript environments, including legacy +browsers (even IE11). However it also takes advantage of features added to +JavaScript in [ES2015][], the latest standard version of JavaScript, including +[Iterators][], [Arrow Functions][], [Classes][], and [Modules][]. It's inspired +by the native [Map][] and [Set][] collections added to ES2015. -All examples are presented in ES6. To run in all browsers, they need to be -translated to ES3. +All examples in the Documentation are presented in ES2015. To run in all +browsers, they need to be translated to ES5. ```js -// ES6 -foo.map(x => x * x); -// ES3 -foo.map(function (x) { return x * x; }); +// ES2015 +const mapped = foo.map((x) => x * x); +// ES5 +var mapped = foo.map(function (x) { + return x * x; +}); +``` + +All Immutable.js collections are [Iterable][iterators], which allows them to be +used anywhere an Iterable is expected, such as when spreading into an Array. + +```js +const { List } = require('immutable'); +const aList = List([1, 2, 3]); +const anArray = [0, ...aList, 4, 5]; // [ 0, 1, 2, 3, 4, 5 ] ``` +Note: A Collection is always iterated in the same order, however that order may +not always be well defined, as is the case for the `Map` and `Set`. + [Iterators]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/The_Iterator_protocol [Arrow Functions]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions -[Classes]: http://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes -[Modules]: http://www.2ality.com/2014/09/es6-modules-final.html +[Classes]: https://wiki.ecmascript.org/doku.php?id=strawman:maximally_minimal_classes +[Modules]: https://www.2ality.com/2014/09/es6-modules-final.html +## Nested Structures -Nested Structures ------------------ - -The collections in `immutable` are intended to be nested, allowing for deep +The collections in Immutable.js are intended to be nested, allowing for deep trees of data, similar to JSON. -```javascript -var nested = Immutable.fromJS({a:{b:{c:[3,4,5]}}}); +```js +const { fromJS } = require('immutable'); +const nested = fromJS({ a: { b: { c: [3, 4, 5] } } }); // Map { a: Map { b: Map { c: List [ 3, 4, 5 ] } } } ``` @@ -300,92 +385,114 @@ A few power-tools allow for reading and operating on nested data. The most useful are `mergeDeep`, `getIn`, `setIn`, and `updateIn`, found on `List`, `Map` and `OrderedMap`. -```javascript -var nested2 = nested.mergeDeep({a:{b:{d:6}}}); +```js +const { fromJS } = require('immutable'); +const nested = fromJS({ a: { b: { c: [3, 4, 5] } } }); + +const nested2 = nested.mergeDeep({ a: { b: { d: 6 } } }); // Map { a: Map { b: Map { c: List [ 3, 4, 5 ], d: 6 } } } -nested2.getIn(['a', 'b', 'd']); // 6 +console.log(nested2.getIn(['a', 'b', 'd'])); // 6 -var nested3 = nested2.updateIn(['a', 'b', 'd'], value => value + 1); +const nested3 = nested2.updateIn(['a', 'b', 'd'], (value) => value + 1); +console.log(nested3); // Map { a: Map { b: Map { c: List [ 3, 4, 5 ], d: 7 } } } -var nested4 = nested3.updateIn(['a', 'b', 'c'], list => list.push(6)); +const nested4 = nested3.updateIn(['a', 'b', 'c'], (list) => list.push(6)); // Map { a: Map { b: Map { c: List [ 3, 4, 5, 6 ], d: 7 } } } ``` +## Equality treats Collections as Values -Lazy Seq --------- - -`Seq` describes a lazy operation, allowing them to efficiently chain -use of all the Iterable methods (such as `map` and `filter`). - -**Seq is immutable** — Once a Seq is created, it cannot be -changed, appended to, rearranged or otherwise modified. Instead, any mutative -method called on a Seq will return a new Seq. - -**Seq is lazy** — Seq does as little work as necessary to respond to any -method call. - -For example, the following does not perform any work, because the resulting -Seq is never used: - - var oddSquares = Immutable.Seq.of(1,2,3,4,5,6,7,8) - .filter(x => x % 2).map(x => x * x); +Immutable.js collections are treated as pure data _values_. Two immutable +collections are considered _value equal_ (via `.equals()` or `is()`) if they +represent the same collection of values. This differs from JavaScript's typical +_reference equal_ (via `===` or `==`) for Objects and Arrays which only +determines if two variables represent references to the same object instance. -Once the Seq is used, it performs only the work necessary. In this -example, no intermediate arrays are ever created, filter is called three times, -and map is only called once: +Consider the example below where two identical `Map` instances are not +_reference equal_ but are _value equal_. - console.log(oddSquares.get(1)); // 9 - -Any collection can be converted to a lazy Seq with `.toSeq()`. +```js +// First consider: +const obj1 = { a: 1, b: 2, c: 3 }; +const obj2 = { a: 1, b: 2, c: 3 }; +obj1 !== obj2; // two different instances are always not equal with === + +const { Map, is } = require('immutable'); +const map1 = Map({ a: 1, b: 2, c: 3 }); +const map2 = Map({ a: 1, b: 2, c: 3 }); +map1 !== map2; // two different instances are not reference-equal +map1.equals(map2); // but are value-equal if they have the same values +is(map1, map2); // alternatively can use the is() function +``` - var seq = Immutable.Map({a:1, b:1, c:1}).toSeq(); +Value equality allows Immutable.js collections to be used as keys in Maps or +values in Sets, and retrieved with different but equivalent collections: -Seq allows for the efficient chaining of sequence operations, especially when -converting to a different concrete type (such as to a JS object): +```js +const { Map, Set } = require('immutable'); +const map1 = Map({ a: 1, b: 2, c: 3 }); +const map2 = Map({ a: 1, b: 2, c: 3 }); +const set = Set().add(map1); +set.has(map2); // true because these are value-equal +``` - seq.flip().map(key => key.toUpperCase()).flip().toObject(); - // { A: 1, B: 1, C: 1 } +Note: `is()` uses the same measure of equality as [Object.is][] for scalar +strings and numbers, but uses value equality for Immutable collections, +determining if both are immutable and all keys and values are equal +using the same measure of equality. -As well as expressing logic that would otherwise seem memory-limited: +[object.is]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - Immutable.Range(1, Infinity) - .skip(1000) - .map(n => -n) - .filter(n => n % 2 === 0) - .take(2) - .reduce((r, n) => r * n, 1); - // 1006008 +#### Performance tradeoffs -Note: An iterable is always iterated in the same order, however that order may -not always be well defined, as is the case for the `Map`. +While value equality is useful in many circumstances, it has different +performance characteristics than reference equality. Understanding these +tradeoffs may help you decide which to use in each case, especially when used +to memoize some operation. +When comparing two collections, value equality may require considering every +item in each collection, on an `O(N)` time complexity. For large collections of +values, this could become a costly operation. Though if the two are not equal +and hardly similar, the inequality is determined very quickly. In contrast, when +comparing two collections with reference equality, only the initial references +to memory need to be compared which is not based on the size of the collections, +which has an `O(1)` time complexity. Checking reference equality is always very +fast, however just because two collections are not reference-equal does not rule +out the possibility that they may be value-equal. -Equality treats Collections as Data ------------------------------------ +#### Return self on no-op optimization -`Immutable` provides equality which treats immutable data structures as pure -data, performing a deep equality check if necessary. +When possible, Immutable.js avoids creating new objects for updates where no +change in _value_ occurred, to allow for efficient _reference equality_ checking +to quickly determine if no change occurred. -```javascript -var map1 = Immutable.Map({a:1, b:1, c:1}); -var map2 = Immutable.Map({a:1, b:1, c:1}); -assert(map1 !== map2); // two different instances -assert(Immutable.is(map1, map2)); // have equivalent values -assert(map1.equals(map2)); // alternatively use the equals method +```js +const { Map } = require('immutable'); +const originalMap = Map({ a: 1, b: 2, c: 3 }); +const updatedMap = originalMap.set('b', 2); +updatedMap === originalMap; // No-op .set() returned the original reference. ``` -`Immutable.is()` uses the same measure of equality as [Object.is][] -including if both are immutable and all keys and values are equal -using the same measure of equality. - -[Object.is]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is +However updates which do result in a change will return a new reference. Each +of these operations occur independently, so two similar updates will not return +the same reference: +```js +const { Map } = require('immutable'); +const originalMap = Map({ a: 1, b: 2, c: 3 }); +const updatedMap = originalMap.set('b', 1000); +// New instance, leaving the original immutable. +updatedMap !== originalMap; +const anotherUpdatedMap = originalMap.set('b', 1000); +// Despite both the results of the same operation, each created a new reference. +anotherUpdatedMap !== updatedMap; +// However the two are value equal. +anotherUpdatedMap.equals(updatedMap); +``` -Batching Mutations ------------------- +## Batching Mutations > If a tree falls in the woods, does it make a sound? > @@ -396,77 +503,229 @@ Batching Mutations Applying a mutation to create a new immutable object results in some overhead, which can add up to a minor performance penalty. If you need to apply a series -of mutations locally before returning, `Immutable` gives you the ability to +of mutations locally before returning, Immutable.js gives you the ability to create a temporary mutable (transient) copy of a collection and apply a batch of mutations in a performant manner by using `withMutations`. In fact, this is -exactly how `Immutable` applies complex mutations itself. +exactly how Immutable.js applies complex mutations itself. As an example, building `list2` results in the creation of 1, not 3, new immutable Lists. -```javascript -var list1 = Immutable.List.of(1,2,3); -var list2 = list1.withMutations(function (list) { +```js +const { List } = require('immutable'); +const list1 = List([1, 2, 3]); +const list2 = list1.withMutations(function (list) { list.push(4).push(5).push(6); }); -assert(list1.size === 3); -assert(list2.size === 6); +assert.equal(list1.size, 3); +assert.equal(list2.size, 6); ``` -Note: `immutable` also provides `asMutable` and `asImmutable`, but only +Note: Immutable.js also provides `asMutable` and `asImmutable`, but only encourages their use when `withMutations` will not suffice. Use caution to not return a mutable copy, which could result in undesired behavior. -*Important!*: Only a select few methods can be used in `withMutations` including +_Important!_: Only a select few methods can be used in `withMutations` including `set`, `push` and `pop`. These methods can be applied directly against a persistent data-structure where other methods like `map`, `filter`, `sort`, and `splice` will always return new immutable data-structures and never mutate a mutable collection. +## Lazy Seq + +`Seq` describes a lazy operation, allowing them to efficiently chain +use of all the higher-order collection methods (such as `map` and `filter`) +by not creating intermediate collections. + +**Seq is immutable** — Once a Seq is created, it cannot be +changed, appended to, rearranged or otherwise modified. Instead, any mutative +method called on a `Seq` will return a new `Seq`. + +**Seq is lazy** — `Seq` does as little work as necessary to respond to any +method call. Values are often created during iteration, including implicit +iteration when reducing or converting to a concrete data structure such as +a `List` or JavaScript `Array`. + +For example, the following performs no work, because the resulting +`Seq`'s values are never iterated: + +```js +const { Seq } = require('immutable'); +const oddSquares = Seq([1, 2, 3, 4, 5, 6, 7, 8]) + .filter((x) => x % 2 !== 0) + .map((x) => x * x); +``` + +Once the `Seq` is used, it performs only the work necessary. In this +example, no intermediate arrays are ever created, filter is called three +times, and map is only called once: + +```js +oddSquares.get(1); // 9 +``` + +Any collection can be converted to a lazy Seq with `Seq()`. + +```js +const { Map, Seq } = require('immutable'); +const map = Map({ a: 1, b: 2, c: 3 }); +const lazySeq = Seq(map); +``` + +`Seq` allows for the efficient chaining of operations, allowing for the +expression of logic that can otherwise be very tedious: + +```js +lazySeq + .flip() + .map((key) => key.toUpperCase()) + .flip(); +// Seq { A: 1, B: 2, C: 3 } +``` + +As well as expressing logic that would otherwise seem memory or time +limited, for example `Range` is a special kind of Lazy sequence. + +```js +const { Range } = require('immutable'); +Range(1, Infinity) + .skip(1000) + .map((n) => -n) + .filter((n) => n % 2 === 0) + .take(2) + .reduce((r, n) => r * n, 1); +// 1006008 +``` + +## Comparison of filter(), groupBy(), and partition() -Documentation -------------- +The `filter()`, `groupBy()`, and `partition()` methods are similar in that they +all divide a collection into parts based on applying a function to each element. +All three call the predicate or grouping function once for each item in the +input collection. All three return zero or more collections of the same type as +their input. The returned collections are always distinct from the input +(according to `===`), even if the contents are identical. -[Read the docs](http://facebook.github.io/immutable-js/docs/) and eat your vegetables. +Of these methods, `filter()` is the only one that is lazy and the only one which +discards items from the input collection. It is the simplest to use, and the +fact that it returns exactly one collection makes it easy to combine with other +methods to form a pipeline of operations. -Docs are automatically generated from [Immutable.d.ts](https://github.com/facebook/immutable-js/blob/master/type-definitions/Immutable.d.ts). -Please contribute! +The `partition()` method is similar to an eager version of `filter()`, but it +returns two collections; the first contains the items that would have been +discarded by `filter()`, and the second contains the items that would have been +kept. It always returns an array of exactly two collections, which can make it +easier to use than `groupBy()`. Compared to making two separate calls to +`filter()`, `partition()` makes half as many calls it the predicate passed to +it. -Also, don't miss the [Wiki](https://github.com/facebook/immutable-js/wiki) which -contains articles on specific topics. Can't find something? Open an [issue](https://github.com/facebook/immutable-js/issues). +The `groupBy()` method is a more generalized version of `partition()` that can +group by an arbitrary function rather than just a predicate. It returns a map +with zero or more entries, where the keys are the values returned by the +grouping function, and the values are nonempty collections of the corresponding +arguments. Although `groupBy()` is more powerful than `partition()`, it can be +harder to use because it is not always possible predict in advance how many +entries the returned map will have and what their keys will be. +| Summary | `filter` | `partition` | `groupBy` | +| :---------------------------- | :------- | :---------- | :------------- | +| ease of use | easiest | moderate | hardest | +| generality | least | moderate | most | +| laziness | lazy | eager | eager | +| # of returned sub-collections | 1 | 2 | 0 or more | +| sub-collections may be empty | yes | yes | no | +| can discard items | yes | no | no | +| wrapping container | none | array | Map/OrderedMap | -Testing -------- +## Additional Tools and Resources -If you are using the [Chai Assertion Library](http://chaijs.com/), [Chai Immutable](https://github.com/astorije/chai-immutable) provides a set of assertions to use against `Immutable` collections. +- [Atom-store](https://github.com/jameshopkins/atom-store/) + - A Clojure-inspired atom implementation in Javascript with configurability + for external persistance. -Contribution ------------- +- [Chai Immutable](https://github.com/astorije/chai-immutable) -Use [Github issues](https://github.com/facebook/immutable-js/issues) for requests. + - If you are using the [Chai Assertion Library](https://chaijs.com/), this + provides a set of assertions to use against Immutable.js collections. -We actively welcome pull requests, learn how to [contribute](./CONTRIBUTING.md). +- [Fantasy-land](https://github.com/fantasyland/fantasy-land) + - Specification for interoperability of common algebraic structures in JavaScript. -Changelog ---------- +- [Immutagen](https://github.com/pelotom/immutagen) -Changes are tracked as [Github releases](https://github.com/facebook/immutable-js/releases). + - A library for simulating immutable generators in JavaScript. +- [Immutable-cursor](https://github.com/redbadger/immutable-cursor) -Thanks ------- + - Immutable cursors incorporating the Immutable.js interface over + Clojure-inspired atom. + +- [Immutable-ext](https://github.com/DrBoolean/immutable-ext) + + - Fantasyland extensions for immutablejs + +- [Immutable-js-tools](https://github.com/madeinfree/immutable-js-tools) + + - Util tools for immutable.js + +- [Immutable-Redux](https://github.com/gajus/redux-immutable) + + - redux-immutable is used to create an equivalent function of Redux + combineReducers that works with Immutable.js state. + +- [Immutable-Treeutils](https://github.com/lukasbuenger/immutable-treeutils) + + - Functional tree traversal helpers for ImmutableJS data structures. + +- [Irecord](https://github.com/ericelliott/irecord) + + - An immutable store that exposes an RxJS observable. Great for React. + +- [Mudash](https://github.com/brianneisler/mudash) + + - Lodash wrapper providing Immutable.JS support. + +- [React-Immutable-PropTypes](https://github.com/HurricaneJames/react-immutable-proptypes) + + - PropType validators that work with Immutable.js. + +- [Redux-Immutablejs](https://github.com/indexiatech/redux-immutablejs) + + - Redux Immutable facilities. + +- [Rxstate](https://github.com/yamalight/rxstate) + + - Simple opinionated state management library based on RxJS and Immutable.js. + +- [Transit-Immutable-js](https://github.com/glenjamin/transit-immutable-js) + - Transit serialisation for Immutable.js. + - See also: [Transit-js](https://github.com/cognitect/transit-js) + +Have an additional tool designed to work with Immutable.js? +Submit a PR to add it to this list in alphabetical order. + +## Contributing + +Use [Github issues](https://github.com/immutable-js/immutable-js/issues) for requests. + +We actively welcome pull requests, learn how to [contribute](https://github.com/immutable-js/immutable-js/blob/main/.github/CONTRIBUTING.md). + +Immutable.js is maintained within the [Contributor Covenant's Code of Conduct](https://www.contributor-covenant.org/version/2/0/code_of_conduct/). + +### Changelog + +Changes are tracked as [Github releases](https://github.com/immutable-js/immutable-js/releases). + +### License + +Immutable.js is [MIT-licensed](./LICENSE). + +### Thanks [Phil Bagwell](https://www.youtube.com/watch?v=K2NYwP90bNs), for his inspiration and research in persistent data structures. [Hugh Jackson](https://github.com/hughfdjackson/), for providing the npm package name. If you're looking for his unsupported package, see [this repository](https://github.com/hughfdjackson/immutable). - - -License -------- - -`Immutable` is [BSD-licensed](https://github.com/facebook/immutable-js/blob/master/LICENSE). We also provide an additional [patent grant](https://github.com/facebook/immutable-js/blob/master/PATENTS). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000000..a1fdc82e73 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +You can send an email to julien@deniau.me to report a security vulnerability. +Please be as specific as possible on how to reproduce and understand the issue. This way, we can fix the issue as fast as possible. + +I will try to reply to you in the following days (it might be sometime longer depending on my personal life). diff --git a/__tests__/ArraySeq.ts b/__tests__/ArraySeq.ts index f9f5cc8f5a..1068acb93e 100644 --- a/__tests__/ArraySeq.ts +++ b/__tests__/ArraySeq.ts @@ -1,46 +1,51 @@ -/// - -import { Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Seq } from 'immutable'; describe('ArraySequence', () => { - it('every is true when predicate is true for all entries', () => { expect(Seq([]).every(() => false)).toBe(true); - expect(Seq([1,2,3]).every(v => v > 0)).toBe(true); - expect(Seq([1,2,3]).every(v => v < 3)).toBe(false); + expect(Seq([1, 2, 3]).every((v) => v > 0)).toBe(true); + expect(Seq([1, 2, 3]).every((v) => v < 3)).toBe(false); }); it('some is true when predicate is true for any entry', () => { expect(Seq([]).some(() => true)).toBe(false); - expect(Seq([1,2,3]).some(v => v > 0)).toBe(true); - expect(Seq([1,2,3]).some(v => v < 3)).toBe(true); - expect(Seq([1,2,3]).some(v => v > 1)).toBe(true); - expect(Seq([1,2,3]).some(v => v < 0)).toBe(false); + expect(Seq([1, 2, 3]).some((v) => v > 0)).toBe(true); + expect(Seq([1, 2, 3]).some((v) => v < 3)).toBe(true); + expect(Seq([1, 2, 3]).some((v) => v > 1)).toBe(true); + expect(Seq([1, 2, 3]).some((v) => v < 0)).toBe(false); }); it('maps', () => { - var i = Seq([1,2,3]); - var m = i.map(x => x + x).toArray(); - expect(m).toEqual([2,4,6]); + const i = Seq([1, 2, 3]); + const m = i.map((x) => x + x).toArray(); + expect(m).toEqual([2, 4, 6]); }); it('reduces', () => { - var i = Seq([1,2,3]); - var r = i.reduce((r, x) => r + x); + const i = Seq([1, 2, 3]); + const r = i.reduce((acc, x) => acc + x); expect(r).toEqual(6); }); it('efficiently chains iteration methods', () => { - var i = Seq('abcdefghijklmnopqrstuvwxyz'.split('')); + const i = Seq('abcdefghijklmnopqrstuvwxyz'.split('')); function studly(letter, index) { return index % 2 === 0 ? letter : letter.toUpperCase(); } - var result = i.reverse().take(10).reverse().take(5).map(studly).toArray().join(''); + const result = i + .reverse() + .take(10) + .reverse() + .take(5) + .map(studly) + .toArray() + .join(''); expect(result).toBe('qRsTu'); }); it('counts from the end of the sequence on negative index', () => { - var i = Seq.of(1, 2, 3, 4, 5, 6, 7); + const i = Seq([1, 2, 3, 4, 5, 6, 7]); expect(i.get(-1)).toBe(7); expect(i.get(-5)).toBe(3); expect(i.get(-9)).toBe(undefined); @@ -48,26 +53,26 @@ describe('ArraySequence', () => { }); it('handles trailing holes', () => { - var a = [1,2,3]; + const a = [1, 2, 3]; a.length = 10; - var seq = Seq(a); + const seq = Seq(a); expect(seq.size).toBe(10); expect(seq.toArray().length).toBe(10); - expect(seq.map(x => x*x).size).toBe(10); - expect(seq.map(x => x*x).toArray().length).toBe(10); + expect(seq.map((x) => x * x).size).toBe(10); + expect(seq.map((x) => x * x).toArray().length).toBe(10); expect(seq.skip(2).toArray().length).toBe(8); expect(seq.take(2).toArray().length).toBe(2); expect(seq.take(5).toArray().length).toBe(5); - expect(seq.filter(x => x%2==1).toArray().length).toBe(2); + expect(seq.filter((x) => x % 2 === 1).toArray().length).toBe(2); expect(seq.toKeyedSeq().flip().size).toBe(10); expect(seq.toKeyedSeq().flip().flip().size).toBe(10); expect(seq.toKeyedSeq().flip().flip().toArray().length).toBe(10); }); it('can be iterated', () => { - var a = [1,2,3]; - var seq = Seq(a); - var entries = seq.entries(); + const a = [1, 2, 3]; + const seq = Seq(a); + const entries = seq.entries(); expect(entries.next()).toEqual({ value: [0, 1], done: false }); expect(entries.next()).toEqual({ value: [1, 2], done: false }); expect(entries.next()).toEqual({ value: [2, 3], done: false }); @@ -75,10 +80,10 @@ describe('ArraySequence', () => { }); it('cannot be mutated after calling toArray', () => { - var seq = Seq(['A', 'B', 'C']); + const seq = Seq(['A', 'B', 'C']); - var firstReverse = Seq(seq.toArray().reverse()); - var secondReverse = Seq(seq.toArray().reverse()); + const firstReverse = Seq(seq.toArray().reverse()); + const secondReverse = Seq(seq.toArray().reverse()); expect(firstReverse.get(0)).toEqual('C'); expect(secondReverse.get(0)).toEqual('C'); diff --git a/__tests__/Comparator.ts b/__tests__/Comparator.ts new file mode 100644 index 0000000000..39ab3679fb --- /dev/null +++ b/__tests__/Comparator.ts @@ -0,0 +1,67 @@ +import { describe, expect, it } from '@jest/globals'; +import { List, OrderedSet, Seq, type Comparator, PairSorting } from 'immutable'; + +const sourceNumbers: readonly number[] = [3, 4, 5, 6, 7, 9, 10, 12, 90, 92, 95]; + +const expectedSortedNumbers: readonly number[] = [ + 7, 95, 90, 92, 3, 5, 9, 4, 6, 10, 12, +]; + +const testComparator: Comparator = (left, right) => { + //The number 7 always goes first... + if (left === 7) { + return PairSorting.LeftThenRight; + } else if (right === 7) { + return PairSorting.RightThenLeft; + } + + //...followed by numbers >= 90, then by all the others. + if (left >= 90 && right < 90) { + return PairSorting.LeftThenRight; + } else if (left < 90 && right >= 90) { + return PairSorting.RightThenLeft; + } + + //Within each group, even numbers go first... + if (left % 2 && !(right % 2)) { + return PairSorting.LeftThenRight; + } else if (!(left % 2) && right % 2) { + return PairSorting.RightThenLeft; + } + + //...and, finally, sort the numbers of each subgroup in ascending order. + return left - right; +}; + +describe.each([ + ['List', List], + ['OrderedSet', OrderedSet], + ['Seq.Indexed', Seq.Indexed], +])('Comparator applied to %s', (_collectionName, testCollectionConstructor) => { + const sourceCollection = testCollectionConstructor(sourceNumbers); + + const expectedSortedCollection = testCollectionConstructor( + expectedSortedNumbers + ); + + describe('when sorting', () => { + it('should support the enum as well as numeric return values', () => { + const actualCollection = sourceCollection.sort(testComparator); + expect(actualCollection).toEqual(expectedSortedCollection); + }); + }); + + describe('when retrieving the max value', () => { + it('should support the enum as well as numeric return values', () => { + const actualMax = sourceCollection.max(testComparator); + expect(actualMax).toBe(12); + }); + }); + + describe('when retrieving the min value', () => { + it('should support the enum as well as numeric return values', () => { + const actualMin = sourceCollection.min(testComparator); + expect(actualMin).toBe(7); + }); + }); +}); diff --git a/__tests__/Conversion.ts b/__tests__/Conversion.ts index 1989966180..5a008e7e55 100644 --- a/__tests__/Conversion.ts +++ b/__tests__/Conversion.ts @@ -1,152 +1,174 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Map, OrderedMap, List, Record, is, fromJS } from '../'; - -declare function expect(val: any): ExpectWithIs; - -interface ExpectWithIs extends Expect { - is(expected: any): void; - not: ExpectWithIs; -} - -jasmine.addMatchers({ - is: function() { - return { - compare: function(actual, expected) { - var passed = is(actual, expected); - return { - pass: passed, - message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected - }; - } - }; - } -}); - -// Symbols -declare function Symbol(name: string): Object; +import { describe, expect, it } from '@jest/globals'; +import { fromJS, is, List, Map, OrderedMap, Record } from 'immutable'; +import fc, { type JsonValue } from 'fast-check'; describe('Conversion', () => { // Note: order of keys based on Map's hashing order - var js = { + const js = { deepList: [ { - position: "first" + position: 'first', }, { - position: "second" + position: 'second', }, { - position: "third" + position: 'third', }, ], deepMap: { - a: "A", - b: "B" + a: 'A', + b: 'B', }, emptyMap: Object.create(null), - point: {x: 10, y: 20}, - string: "Hello", - list: [1, 2, 3] + point: { x: 10, y: 20 }, + string: 'Hello', + list: [1, 2, 3], }; - var Point = Record({x:0, y:0}, 'Point'); + const Point = Record({ x: 0, y: 0 }, 'Point'); - var immutableData = Map({ + const immutableData = Map({ deepList: List.of( Map({ - position: "first" + position: 'first', }), Map({ - position: "second" + position: 'second', }), Map({ - position: "third" + position: 'third', }) ), deepMap: Map({ - a: "A", - b: "B" + a: 'A', + b: 'B', }), emptyMap: Map(), - point: Map({x: 10, y: 20}), - string: "Hello", - list: List.of(1, 2, 3) + point: Map({ x: 10, y: 20 }), + string: 'Hello', + list: List.of(1, 2, 3), }); - var immutableOrderedData = OrderedMap({ + const immutableOrderedData = OrderedMap({ deepList: List.of( OrderedMap({ - position: "first" + position: 'first', }), OrderedMap({ - position: "second" + position: 'second', }), OrderedMap({ - position: "third" + position: 'third', }) ), deepMap: OrderedMap({ - a: "A", - b: "B" + a: 'A', + b: 'B', }), emptyMap: OrderedMap(), - point: new Point({x: 10, y: 20}), - string: "Hello", - list: List.of(1, 2, 3) + point: new Point({ x: 10, y: 20 }), + string: 'Hello', + list: List.of(1, 2, 3), }); - var immutableOrderedDataString = 'OrderedMap { ' + - '"deepList": List [ '+ - 'OrderedMap { '+ - '"position": "first"'+ - ' }, ' + - 'OrderedMap { '+ - '"position": "second"'+ - ' }, '+ - 'OrderedMap { '+ - '"position": "third"'+ - ' }' + - ' ], '+ - '"deepMap": OrderedMap { '+ - '"a": "A", '+ - '"b": "B"'+ - ' }, '+ + const immutableOrderedDataString = + 'OrderedMap { ' + + '"deepList": List [ ' + + 'OrderedMap { ' + + '"position": "first"' + + ' }, ' + + 'OrderedMap { ' + + '"position": "second"' + + ' }, ' + + 'OrderedMap { ' + + '"position": "third"' + + ' }' + + ' ], ' + + '"deepMap": OrderedMap { ' + + '"a": "A", ' + + '"b": "B"' + + ' }, ' + '"emptyMap": OrderedMap {}, ' + - '"point": Point { "x": 10, "y": 20 }, '+ - '"string": "Hello", '+ - '"list": List [ 1, 2, 3 ]'+ - ' }'; + '"point": Point { x: 10, y: 20 }, ' + + '"string": "Hello", ' + + '"list": List [ 1, 2, 3 ]' + + ' }'; - var nonStringKeyMap = OrderedMap().set(1, true).set(false, "foo"); - var nonStringKeyMapString = 'OrderedMap { 1: true, false: "foo" }'; + const nonStringKeyMap = OrderedMap().set(1, true).set(false, 'foo'); + const nonStringKeyMapString = 'OrderedMap { 1: true, false: "foo" }'; it('Converts deep JS to deep immutable sequences', () => { - expect(fromJS(js)).is(immutableData); + expect(fromJS(js)).toEqual(immutableData); + }); + + it('Throws when provided circular reference', () => { + type OType = { a: { b: { c: OType | null } } }; + + const o: OType = { a: { b: { c: null } } }; + o.a.b.c = o; + expect(() => fromJS(o)).toThrow( + 'Cannot convert circular structure to Immutable' + ); }); it('Converts deep JSON with custom conversion', () => { - var seq = fromJS(js, function (key, sequence) { + const seq = fromJS(js, function (key, sequence) { if (key === 'point') { + // @ts-expect-error -- to convert to real typing return new Point(sequence); } - return Array.isArray(this[key]) ? sequence.toList() : sequence.toOrderedMap(); + return Array.isArray(this[key]) + ? sequence.toList() + : sequence.toOrderedMap(); + }); + expect(seq).toEqual(immutableOrderedData); + expect(seq.toString()).toEqual(immutableOrderedDataString); + }); + + it('Converts deep JSON with custom conversion including keypath if requested', () => { + const paths: Array | undefined> = []; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const seq1 = fromJS(js, function (key, sequence, keypath) { + expect(arguments.length).toBe(3); + paths.push(keypath); + return Array.isArray(this[key]) + ? sequence.toList() + : sequence.toOrderedMap(); + }); + expect(paths).toEqual([ + [], + ['deepList'], + ['deepList', 0], + ['deepList', 1], + ['deepList', 2], + ['deepMap'], + ['emptyMap'], + ['point'], + ['list'], + ]); + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const seq2 = fromJS(js, function (key, sequence) { + // eslint-disable-next-line prefer-rest-params + expect(arguments[2]).toBe(undefined); }); - expect(seq).is(immutableOrderedData); - expect(seq.toString()).is(immutableOrderedDataString); }); - it('Prints keys as JSON values', () => { - expect(nonStringKeyMap.toString()).is(nonStringKeyMapString); + it('Prints keys as JS values', () => { + expect(nonStringKeyMap.toString()).toEqual(nonStringKeyMapString); }); - it('Converts deep sequences to JSON', () => { - var json = immutableData.toJS(); - expect(json).not.is(js); // raw JS is not immutable. - expect(json).toEqual(js); // but should be deep equal. + it('Converts deep sequences to JS', () => { + const js2 = immutableData.toJS(); + expect(is(js2, js)).toBe(false); // raw JS is not immutable. + expect(js2).toEqual(js); // but should be deep equal. + }); + + it('Converts shallowly to JS', () => { + const js2 = immutableData.toJSON(); + expect(js2).not.toEqual(js); + expect(js2.deepList).toBe(immutableData.get('deepList')); }); it('JSON.stringify() works equivalently on immutable sequences', () => { @@ -154,40 +176,43 @@ describe('Conversion', () => { }); it('JSON.stringify() respects toJSON methods on values', () => { - var Model = Record({}); - Model.prototype.toJSON = function() { return 'model'; } - expect( - Map({ a: new Model() }).toJS() - ).toEqual({ "a": {} }); - expect( - JSON.stringify(Map({ a: new Model() })) - ).toEqual('{"a":"model"}'); + const Model = Record({}); + Model.prototype.toJSON = function () { + return 'model'; + }; + expect(Map({ a: new Model() }).toJS()).toEqual({ a: {} }); + expect(JSON.stringify(Map({ a: new Model() }))).toEqual('{"a":"model"}'); }); it('is conservative with array-likes, only accepting true Arrays.', () => { - expect(fromJS({1: 2, length: 3})).is( + expect(fromJS({ 1: 2, length: 3 })).toEqual( Map().set('1', 2).set('length', 3) ); expect(fromJS('string')).toEqual('string'); }); - check.it('toJS isomorphic value', {maxSize: 30}, [gen.JSONValue], (js) => { - var imm = fromJS(js); - expect(imm && imm.toJS ? imm.toJS() : imm).toEqual(js); + it('toJS isomorphic value', () => { + fc.assert( + fc.property(fc.jsonValue(), (v: JsonValue) => { + const imm = fromJS(v); + expect( + // @ts-expect-error Property 'toJS' does not exist on type '{}'.ts(2339) + imm && imm.toJS ? imm.toJS() : imm + ).toEqual(v); + }), + { numRuns: 30 } + ); }); it('Explicitly convert values to string using String constructor', () => { - expect(() => { - fromJS({ foo: Symbol('bar') }) + ''; - Map().set('foo', Symbol('bar')) + ''; - Map().set(Symbol('bar'), 'foo') + ''; - }).not.toThrow(); + expect(() => fromJS({ foo: Symbol('bar') }) + '').not.toThrow(); + expect(() => Map().set('foo', Symbol('bar')) + '').not.toThrow(); + expect(() => Map().set(Symbol('bar'), 'foo') + '').not.toThrow(); }); it('Converts an immutable value of an entry correctly', () => { - var js = [{"key": "a"}]; - var result = fromJS(js).entrySeq().toJS(); - expect(result).toEqual([[0, {"key": "a"}]]); + const arr = [{ key: 'a' }]; + const result = fromJS(arr).entrySeq().toJS(); + expect(result).toEqual([[0, { key: 'a' }]]); }); - }); diff --git a/__tests__/Equality.ts b/__tests__/Equality.ts index 426f622343..ae95ef4a12 100644 --- a/__tests__/Equality.ts +++ b/__tests__/Equality.ts @@ -1,23 +1,19 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { List, Map, Set, Seq, is } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { is, List, Map, Seq, Set } from 'immutable'; +import fc from 'fast-check'; describe('Equality', () => { - function expectIs(left, right) { - var comparison = is(left, right); + const comparison = is(left, right); expect(comparison).toBe(true); - var commutative = is(right, left); + const commutative = is(right, left); expect(commutative).toBe(true); } function expectIsNot(left, right) { - var comparison = is(left, right); + const comparison = is(left, right); expect(comparison).toBe(false); - var commutative = is(right, left); + const commutative = is(right, left); expect(commutative).toBe(false); } @@ -38,109 +34,127 @@ describe('Equality', () => { // Note: Unlike Object.is, is assumes 0 and -0 are the same value, // matching the behavior of ES6 Map key equality. expectIs(0, -0); - expectIs(NaN, 0/0); + expectIs(NaN, 0 / 0); - var string = "hello"; - expectIs(string, string); - expectIs(string, "hello"); - expectIsNot("hello", "HELLO"); - expectIsNot("hello", "goodbye"); + const str = 'hello'; + expectIs(str, str); + expectIs(str, 'hello'); + expectIsNot('hello', 'HELLO'); + expectIsNot('hello', 'goodbye'); - var array = [1,2,3]; + const array = [1, 2, 3]; expectIs(array, array); - expectIsNot(array, [1,2,3]); + expectIsNot(array, [1, 2, 3]); - var object = {key:'value'}; + const object = { key: 'value' }; expectIs(object, object); - expectIsNot(object, {key:'value'}); + expectIsNot(object, { key: 'value' }); }); it('dereferences things', () => { - var ptrA = {foo: 1}, ptrB = {foo: 2}; + const ptrA = { foo: 1 }; + const ptrB = { foo: 2 }; expectIsNot(ptrA, ptrB); - ptrA.valueOf = ptrB.valueOf = function() { + ptrA.valueOf = ptrB.valueOf = function () { return 5; - } + }; expectIs(ptrA, ptrB); - var object = {key:'value'}; - ptrA.valueOf = ptrB.valueOf = function() { + const object = { key: 'value' }; + ptrA.valueOf = ptrB.valueOf = function () { return object; - } + }; expectIs(ptrA, ptrB); - ptrA.valueOf = ptrB.valueOf = function() { - return null; - } + ptrA.valueOf = ptrB.valueOf = function () { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return null as any; + }; expectIs(ptrA, ptrB); - ptrA.valueOf = ptrB.valueOf = function() { - return void 0; - } + ptrA.valueOf = ptrB.valueOf = function () { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return undefined as any; + }; expectIs(ptrA, ptrB); - ptrA.valueOf = function() { + ptrA.valueOf = function () { return 4; - } - ptrB.valueOf = function() { + }; + ptrB.valueOf = function () { return 5; - } + }; expectIsNot(ptrA, ptrB); }); it('compares sequences', () => { - var arraySeq = Seq.of(1,2,3); - var arraySeq2 = Seq([1,2,3]); + const arraySeq = Seq([1, 2, 3]); + const arraySeq2 = Seq([1, 2, 3]); expectIs(arraySeq, arraySeq); - expectIs(arraySeq, Seq.of(1,2,3)); + expectIs(arraySeq, Seq([1, 2, 3])); expectIs(arraySeq2, arraySeq2); - expectIs(arraySeq2, Seq([1,2,3])); - expectIsNot(arraySeq, [1,2,3]); - expectIsNot(arraySeq2, [1,2,3]); + expectIs(arraySeq2, Seq([1, 2, 3])); + expectIsNot(arraySeq, [1, 2, 3]); + expectIsNot(arraySeq2, [1, 2, 3]); expectIs(arraySeq, arraySeq2); - expectIs(arraySeq, arraySeq.map(x => x)); - expectIs(arraySeq2, arraySeq2.map(x => x)); + expectIs( + arraySeq, + arraySeq.map((x) => x) + ); + expectIs( + arraySeq2, + arraySeq2.map((x) => x) + ); }); it('compares lists', () => { - var list = List.of(1,2,3); + const list = List([1, 2, 3]); expectIs(list, list); - expectIsNot(list, [1,2,3]); + expectIsNot(list, [1, 2, 3]); - expectIs(list, Seq.of(1,2,3)); - expectIs(list, List.of(1,2,3)); + expectIs(list, Seq([1, 2, 3])); + expectIs(list, List([1, 2, 3])); - var listLonger = list.push(4); + const listLonger = list.push(4); expectIsNot(list, listLonger); - var listShorter = listLonger.pop(); + const listShorter = listLonger.pop(); expect(list === listShorter).toBe(false); expectIs(list, listShorter); }); - var genSimpleVal = gen.returnOneOf(['A', 1]); - - var genVal = gen.oneOf([ - gen.map(List, gen.array(genSimpleVal, 0, 4)), - gen.map(Set, gen.array(genSimpleVal, 0, 4)), - gen.map(Map, gen.array(gen.array(genSimpleVal, 2), 0, 4)) - ]); - - check.it('has symmetric equality', {times: 1000}, [genVal, genVal], (a, b) => { - expect(is(a, b)).toBe(is(b, a)); + const genSimpleVal = fc.oneof(fc.constant('A'), fc.constant(1)); + + const genVal = fc.oneof( + fc.array(genSimpleVal, { minLength: 0, maxLength: 4 }).map(List), + fc.array(genSimpleVal, { minLength: 0, maxLength: 4 }).map(Set), + fc + .array(fc.array(genSimpleVal, { minLength: 2, maxLength: 2 }), { + minLength: 0, + maxLength: 4, + }) + .map(Map) + ); + + it('has symmetric equality', () => { + fc.assert( + fc.property(genVal, genVal, (a, b) => { + expect(is(a, b)).toBe(is(b, a)); + }), + { numRuns: 1000 } + ); }); - check.it('has hash equality', {times: 1000}, [genVal, genVal], (a, b) => { - if (is(a, b)) { - expect(a.hashCode()).toBe(b.hashCode()); - } + it('has hash symmetry', () => { + fc.assert( + fc.property(genVal, genVal, (a, b) => { + if (is(a, b)) { + // eslint-disable-next-line jest/no-conditional-expect + expect(a.hashCode()).toBe(b.hashCode()); + } + }), + { numRuns: 1000 } + ); }); describe('hash', () => { - it('differentiates decimals', () => { - expect( - Seq.of(1.5).hashCode() - ).not.toBe( - Seq.of(1.6).hashCode() - ); + expect(Seq([1.5]).hashCode()).not.toBe(Seq([1.6]).hashCode()); }); - }); - }); diff --git a/__tests__/IndexedSeq.ts b/__tests__/IndexedSeq.ts index a8cff15451..9d33c234e0 100644 --- a/__tests__/IndexedSeq.ts +++ b/__tests__/IndexedSeq.ts @@ -1,32 +1,27 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Seq } from 'immutable'; describe('IndexedSequence', () => { - it('maintains skipped offset', () => { - var seq = Seq(['A', 'B', 'C', 'D', 'E']); + const seq = Seq(['A', 'B', 'C', 'D', 'E']); // This is what we expect for IndexedSequences - var operated = seq.skip(1); + const operated = seq.skip(1); expect(operated.entrySeq().toArray()).toEqual([ [0, 'B'], [1, 'C'], [2, 'D'], - [3, 'E'] + [3, 'E'], ]); expect(operated.first()).toEqual('B'); }); it('reverses correctly', () => { - var seq = Seq(['A', 'B', 'C', 'D', 'E']); + const seq = Seq(['A', 'B', 'C', 'D', 'E']); // This is what we expect for IndexedSequences - var operated = seq.reverse(); + const operated = seq.reverse(); expect(operated.get(0)).toEqual('E'); expect(operated.get(1)).toEqual('D'); expect(operated.get(4)).toEqual('A'); @@ -36,7 +31,7 @@ describe('IndexedSequence', () => { }); it('negative indexes correctly', () => { - var seq = Seq(['A', 'B', 'C', 'D', 'E']); + const seq = Seq(['A', 'B', 'C', 'D', 'E']); expect(seq.first()).toEqual('A'); expect(seq.last()).toEqual('E'); @@ -44,7 +39,7 @@ describe('IndexedSequence', () => { expect(seq.get(2)).toEqual('C'); expect(seq.get(-2)).toEqual('D'); - var indexes = seq.keySeq(); + const indexes = seq.keySeq(); expect(indexes.first()).toEqual(0); expect(indexes.last()).toEqual(4); expect(indexes.get(-0)).toEqual(0); diff --git a/__tests__/IterableSeq.ts b/__tests__/IterableSeq.ts deleted file mode 100644 index 11a7bb74ad..0000000000 --- a/__tests__/IterableSeq.ts +++ /dev/null @@ -1,179 +0,0 @@ -/// - -declare var Symbol: any; -import { Seq } from '../'; - -describe('IterableSequence', () => { - - it('creates a sequence from an iterable', () => { - var i = new SimpleIterable(); - var s = Seq(i); - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - }) - - it('is stable', () => { - var i = new SimpleIterable(); - var s = Seq(i); - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - expect(s.take(5).take(Infinity).toArray()).toEqual([ 0,1,2,3,4 ]); - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - }) - - it('counts iterations', () => { - var i = new SimpleIterable(10); - var s = Seq(i); - expect(s.forEach(x => x)).toEqual(10); - expect(s.take(5).forEach(x => x)).toEqual(5); - expect(s.forEach(x => x < 3)).toEqual(4); - }) - - it('creates a new iterator on every operations', () => { - var mockFn = jest.genMockFunction(); - var i = new SimpleIterable(3, mockFn); - var s = Seq(i); - expect(s.toArray()).toEqual([ 0,1,2 ]); - expect(mockFn.mock.calls).toEqual([[0],[1],[2]]); - // The iterator is recreated for the second time. - expect(s.toArray()).toEqual([ 0,1,2 ]); - expect(mockFn.mock.calls).toEqual([[0],[1],[2],[0],[1],[2]]); - }) - - it('can be iterated', () => { - var mockFn = jest.genMockFunction(); - var i = new SimpleIterable(3, mockFn); - var seq = Seq(i); - var entries = seq.entries(); - expect(entries.next()).toEqual({ value: [0, 0], done: false }); - // The iteration is lazy - expect(mockFn.mock.calls).toEqual([[0]]); - expect(entries.next()).toEqual({ value: [1, 1], done: false }); - expect(entries.next()).toEqual({ value: [2, 2], done: false }); - expect(entries.next()).toEqual({ value: undefined, done: true }); - expect(mockFn.mock.calls).toEqual([[0],[1],[2]]); - // The iterator is recreated for the second time. - entries = seq.entries(); - expect(entries.next()).toEqual({ value: [0, 0], done: false }); - expect(entries.next()).toEqual({ value: [1, 1], done: false }); - expect(entries.next()).toEqual({ value: [2, 2], done: false }); - expect(entries.next()).toEqual({ value: undefined, done: true }); - expect(mockFn.mock.calls).toEqual([[0],[1],[2],[0],[1],[2]]); - }) - - it('can be mapped and filtered', () => { - var mockFn = jest.genMockFunction(); - var i = new SimpleIterable(undefined, mockFn); // infinite - var seq = Seq(i) - .filter(x => x % 2 === 1) - .map(x => x * x); - var entries = seq.entries(); - expect(entries.next()).toEqual({ value: [0, 1], done: false }); - expect(entries.next()).toEqual({ value: [1, 9], done: false }); - expect(entries.next()).toEqual({ value: [2, 25], done: false }); - expect(mockFn.mock.calls).toEqual([[0],[1],[2],[3],[4],[5]]); - }) - - describe('IteratorSequence', () => { - - it('creates a sequence from a raw iterable', () => { - var i = new SimpleIterable(10); - var s = Seq(i[ITERATOR_SYMBOL]()); - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - }) - - it('is stable', () => { - var i = new SimpleIterable(10); - var s = Seq(i[ITERATOR_SYMBOL]()); - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - }) - - it('counts iterations', () => { - var i = new SimpleIterable(10); - var s = Seq(i[ITERATOR_SYMBOL]()); - expect(s.forEach(x => x)).toEqual(10); - expect(s.take(5).forEach(x => x)).toEqual(5); - expect(s.forEach(x => x < 3)).toEqual(4); - }) - - it('memoizes the iterator', () => { - var mockFn = jest.genMockFunction(); - var i = new SimpleIterable(10, mockFn); - var s = Seq(i[ITERATOR_SYMBOL]()); - expect(s.take(3).toArray()).toEqual([ 0,1,2 ]); - expect(mockFn.mock.calls).toEqual([[0],[1],[2]]); - - // Second call uses memoized values - expect(s.take(3).toArray()).toEqual([ 0,1,2 ]); - expect(mockFn.mock.calls).toEqual([[0],[1],[2]]); - - // Further ahead in the iterator yields more results. - expect(s.take(5).toArray()).toEqual([ 0,1,2,3,4 ]); - expect(mockFn.mock.calls).toEqual([[0],[1],[2],[3],[4]]); - }) - - it('can be iterated', () => { - var mockFn = jest.genMockFunction(); - var i = new SimpleIterable(3, mockFn); - var seq = Seq(i[ITERATOR_SYMBOL]()); - var entries = seq.entries(); - expect(entries.next()).toEqual({ value: [0, 0], done: false }); - // The iteration is lazy - expect(mockFn.mock.calls).toEqual([[0]]); - expect(entries.next()).toEqual({ value: [1, 1], done: false }); - expect(entries.next()).toEqual({ value: [2, 2], done: false }); - expect(entries.next()).toEqual({ value: undefined, done: true }); - expect(mockFn.mock.calls).toEqual([[0],[1],[2]]); - // The iterator has been memoized for the second time. - entries = seq.entries(); - expect(entries.next()).toEqual({ value: [0, 0], done: false }); - expect(entries.next()).toEqual({ value: [1, 1], done: false }); - expect(entries.next()).toEqual({ value: [2, 2], done: false }); - expect(entries.next()).toEqual({ value: undefined, done: true }); - expect(mockFn.mock.calls).toEqual([[0],[1],[2]]); - }) - - it('can iterate an skipped seq based on an iterator', () => { - var i = new SimpleIterable(4); - var seq = Seq(i[ITERATOR_SYMBOL]()); - expect(seq.size).toBe(undefined); - var skipped = seq.skip(2); - expect(skipped.size).toBe(undefined); - var iter = skipped[ITERATOR_SYMBOL](); - // The first two were skipped - expect(iter.next()).toEqual({ value: 2, done: false }); - expect(iter.next()).toEqual({ value: 3, done: false }); - expect(iter.next()).toEqual({ value: undefined, done: true }); - }) - }) - -}) - - -// Helper for this test -var ITERATOR_SYMBOL = - typeof Symbol === 'function' && Symbol.iterator || '@@iterator'; - -function SimpleIterable(max?: number, watcher?: any) { - this.max = max; - this.watcher = watcher; -} -SimpleIterable.prototype[ITERATOR_SYMBOL] = function() { - return new SimpleIterator(this); -} - -function SimpleIterator(iterable) { - this.iterable = iterable; - this.value = 0; -} -SimpleIterator.prototype.next = function() { - if (this.value >= this.iterable.max) { - return { value: undefined, done: true }; - } - this.iterable.watcher && this.iterable.watcher(this.value); - return { value: this.value++, done: false }; -} -SimpleIterator.prototype[ITERATOR_SYMBOL] = function() { - return this; -} diff --git a/__tests__/KeyedSeq.ts b/__tests__/KeyedSeq.ts index cebfa8ddc8..528c28f523 100644 --- a/__tests__/KeyedSeq.ts +++ b/__tests__/KeyedSeq.ts @@ -1,33 +1,34 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Seq, Range } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Range, Seq } from 'immutable'; +import fc from 'fast-check'; describe('KeyedSeq', () => { - - check.it('it iterates equivalently', [gen.array(gen.int)], (ints) => { - var seq = Seq(ints); - var keyed = seq.toKeyedSeq(); - - var seqEntries = seq.entries(); - var keyedEntries = keyed.entries(); - - var seqStep, keyedStep; - do { - seqStep = seqEntries.next(); - keyedStep = keyedEntries.next(); - expect(keyedStep).toEqual(seqStep); - } while (!seqStep.done); + it('iterates equivalently', () => { + fc.assert( + fc.property(fc.array(fc.integer()), (ints) => { + const seq = Seq(ints); + const keyed = seq.toKeyedSeq(); + + const seqEntries = seq.entries(); + const keyedEntries = keyed.entries(); + + let seqStep; + let keyedStep; + do { + seqStep = seqEntries.next(); + keyedStep = keyedEntries.next(); + expect(keyedStep).toEqual(seqStep); + } while (!seqStep.done); + }) + ); }); it('maintains keys', () => { - var isEven = x => x % 2 === 0; - var seq = Range(0, 100); + const isEven = (x) => x % 2 === 0; + const seq = Range(0, 100); // This is what we expect for IndexedSequences - var operated = seq.filter(isEven).skip(10).take(5); + const operated = seq.filter(isEven).skip(10).take(5); expect(operated.entrySeq().toArray()).toEqual([ [0, 20], [1, 22], @@ -35,10 +36,27 @@ describe('KeyedSeq', () => { [3, 26], [4, 28], ]); + const [indexed0, indexed1] = seq + .partition(isEven) + .map((part) => part.skip(10).take(5)); + expect(indexed0.entrySeq().toArray()).toEqual([ + [0, 21], + [1, 23], + [2, 25], + [3, 27], + [4, 29], + ]); + expect(indexed1.entrySeq().toArray()).toEqual([ + [0, 20], + [1, 22], + [2, 24], + [3, 26], + [4, 28], + ]); // Where Keyed Sequences maintain keys. - var keyed = seq.toKeyedSeq(); - var keyedOperated = keyed.filter(isEven).skip(10).take(5); + const keyed = seq.toKeyedSeq(); + const keyedOperated = keyed.filter(isEven).skip(10).take(5); expect(keyedOperated.entrySeq().toArray()).toEqual([ [20, 20], [22, 22], @@ -46,10 +64,27 @@ describe('KeyedSeq', () => { [26, 26], [28, 28], ]); + const [keyed0, keyed1] = keyed + .partition(isEven) + .map((part) => part.skip(10).take(5)); + expect(keyed0.entrySeq().toArray()).toEqual([ + [21, 21], + [23, 23], + [25, 25], + [27, 27], + [29, 29], + ]); + expect(keyed1.entrySeq().toArray()).toEqual([ + [20, 20], + [22, 22], + [24, 24], + [26, 26], + [28, 28], + ]); }); it('works with reverse', () => { - var seq = Range(0, 100); + const seq = Range(0, 100); // This is what we expect for IndexedSequences expect(seq.reverse().take(5).entrySeq().toArray()).toEqual([ @@ -71,10 +106,12 @@ describe('KeyedSeq', () => { }); it('works with double reverse', () => { - var seq = Range(0, 100); + const seq = Range(0, 100); // This is what we expect for IndexedSequences - expect(seq.reverse().skip(10).take(5).reverse().entrySeq().toArray()).toEqual([ + expect( + seq.reverse().skip(10).take(5).reverse().entrySeq().toArray() + ).toEqual([ [0, 85], [1, 86], [2, 87], @@ -83,7 +120,9 @@ describe('KeyedSeq', () => { ]); // Where Keyed Sequences maintain keys. - expect(seq.reverse().toKeyedSeq().skip(10).take(5).reverse().entrySeq().toArray()).toEqual([ + expect( + seq.reverse().toKeyedSeq().skip(10).take(5).reverse().entrySeq().toArray() + ).toEqual([ [14, 85], [13, 86], [12, 87], @@ -91,5 +130,4 @@ describe('KeyedSeq', () => { [10, 89], ]); }); - }); diff --git a/__tests__/List.ts b/__tests__/List.ts index deee5f32fe..da2e9d996b 100644 --- a/__tests__/List.ts +++ b/__tests__/List.ts @@ -1,142 +1,181 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { List, Range, Seq, Set, Map, fromJS } from '../'; - -function arrayOfSize(s) { - var a = new Array(s); - for (var ii = 0; ii < s; ii++) { +import { describe, expect, it } from '@jest/globals'; +import { fromJS, List, Map, Range, Seq, Set } from 'immutable'; +import fc from 'fast-check'; +import { create as createSeed } from 'random-seed'; + +function arrayOfSize(s: number) { + const a = new Array(s); + for (let ii = 0; ii < s; ii++) { a[ii] = ii; } return a; } describe('List', () => { - it('determines assignment of unspecified value types', () => { interface Test { - list: List - }; + list: List; + } - var t: Test = { - list: List() + const t: Test = { + list: List(), }; expect(t.list.size).toBe(0); }); it('of provides initial values', () => { - var v = List.of('a', 'b', 'c'); + const v = List.of('a', 'b', 'c'); expect(v.get(0)).toBe('a'); expect(v.get(1)).toBe('b'); expect(v.get(2)).toBe('c'); }); it('toArray provides a JS array', () => { - var v = List.of('a', 'b', 'c'); + const v = List.of('a', 'b', 'c'); expect(v.toArray()).toEqual(['a', 'b', 'c']); }); it('does not accept a scalar', () => { expect(() => { - List(3 as any); - }).toThrow('Expected Array or iterable object of values: 3'); + // @ts-expect-error -- test that runtime does throw + List(3); + }).toThrow('Expected Array or collection object of values: 3'); }); it('accepts an array', () => { - var v = List(['a', 'b', 'c']); + const v = List(['a', 'b', 'c']); expect(v.get(1)).toBe('b'); expect(v.toArray()).toEqual(['a', 'b', 'c']); }); it('accepts an array-like', () => { - var v = List({ 'length': 3, '1': 'b' } as any); - expect(v.get(1)).toBe('b'); - expect(v.toArray()).toEqual([undefined, 'b', undefined]); + const v = List({ length: 3, 2: 'c' }); + expect(v.get(2)).toBe('c'); + expect(v.toArray()).toEqual([undefined, undefined, 'c']); }); - it('accepts any array-like iterable, including strings', () => { - var v = List('abc'); + it('accepts any array-like collection, including strings', () => { + const v = List('abc'); expect(v.get(1)).toBe('b'); expect(v.toArray()).toEqual(['a', 'b', 'c']); }); it('accepts an indexed Seq', () => { - var seq = Seq(['a', 'b', 'c']); - var v = List(seq); + const seq = Seq(['a', 'b', 'c']); + const v = List(seq); expect(v.toArray()).toEqual(['a', 'b', 'c']); }); it('accepts a keyed Seq as a list of entries', () => { - var seq = Seq({a:null, b:null, c:null}).flip(); - var v = List(seq); - expect(v.toArray()).toEqual([[null,'a'], [null,'b'], [null,'c']]); + const seq = Seq({ a: null, b: null, c: null }).flip(); + const v = List(seq); + expect(v.toArray()).toEqual([ + [null, 'a'], + [null, 'b'], + [null, 'c'], + ]); // Explicitly getting the values sequence - var v2 = List(seq.valueSeq()); - expect(v2.toArray()).toEqual(['a','b','c']); + const v2 = List(seq.valueSeq()); + expect(v2.toArray()).toEqual(['a', 'b', 'c']); // toList() does this for you. - var v3 = seq.toList(); + const v3 = seq.toList(); expect(v3.toArray()).toEqual(['a', 'b', 'c']); }); it('can set and get a value', () => { - var v = List(); + let v = List(); expect(v.get(0)).toBe(undefined); v = v.set(0, 'value'); expect(v.get(0)).toBe('value'); }); it('can setIn and getIn a deep value', () => { - var v = List([ + let v = List([ Map({ - aKey: List([ - "bad", - "good" - ]) - }) + aKey: List(['bad', 'good']), + }), ]); - expect(v.getIn([0, 'aKey', 1])).toBe("good") - v = v.setIn([0, 'aKey', 1], "great") - expect(v.getIn([0, 'aKey', 1])).toBe("great") + expect(v.getIn([0, 'aKey', 1])).toBe('good'); + v = v.setIn([0, 'aKey', 1], 'great'); + expect(v.getIn([0, 'aKey', 1])).toBe('great'); + }); + + it('can setIn on an inexistant index', () => { + const myMap = Map<{ a: Array; b: Array; c?: List }>( + { a: [], b: [] } + ); + const out = myMap.setIn(['a', 0], 'v').setIn(['c', 0], 'v'); + + expect(out.getIn(['a', 0])).toEqual('v'); + expect(out.getIn(['c', 0])).toEqual('v'); + expect(out.get('a')).toBeInstanceOf(Array); + expect(out.get('b')).toBeInstanceOf(Array); + expect(out.get('c')).toBeInstanceOf(Map); + expect(out.get('c')?.keySeq().first()).toBe(0); + }); + + it('throw when calling setIn on a non data structure', () => { + const avengers = [ + 'ironMan', // index [0] + [ + 'captainAmerica', // index [1][0] + [ + 'blackWidow', // index [1][1][0] + ['theHulk'], // index [1][1][1][0] + ], + ], + ]; + + const avengersList = fromJS(avengers) as List; + + // change theHulk to scarletWitch + const out1 = avengersList.setIn([1, 1, 1, 0], 'scarletWitch'); + expect(out1.getIn([1, 1, 1, 0])).toEqual('scarletWitch'); + + const out2 = avengersList.setIn([1, 1, 1, 3], 'scarletWitch'); + expect(out2.getIn([1, 1, 1, 3])).toEqual('scarletWitch'); + + expect(() => { + avengersList.setIn([0, 1], 'scarletWitch'); + }).toThrow( + 'Cannot update within non-data-structure value in path [0]: ironMan' + ); }); it('can update a value', () => { - var v = List.of(5); - expect(v.update(0, v => v * v).toArray()).toEqual([25]); + const l = List.of(5); + // @ts-expect-error -- Type definition limitation + expect(l.update(0, (v) => v * v).toArray()).toEqual([25]); }); it('can updateIn a deep value', () => { - var v = List([ + let l = List([ Map({ - aKey: List([ - "bad", - "good" - ]) - }) + aKey: List(['bad', 'good']), + }), ]); - v = v.updateIn([0, 'aKey', 1], v => v + v); - expect(v.toJS()).toEqual([ + // @ts-expect-error -- Type definition limitation + l = l.updateIn([0, 'aKey', 1], (v) => v + v); + expect(l.toJS()).toEqual([ { - aKey: [ - 'bad', - 'goodgood' - ] - } + aKey: ['bad', 'goodgood'], + }, ]); }); it('returns undefined when getting a null value', () => { - var v = List([1, 2, 3]); + const v = List([1, 2, 3]); + // @ts-expect-error -- test runtime expect(v.get(null)).toBe(undefined); - var o = List([{ a: 1 },{ b: 2 }, { c: 3 }]); + const o = List([{ a: 1 }, { b: 2 }, { c: 3 }]); + // @ts-expect-error -- test runtime expect(o.get(null)).toBe(undefined); }); it('counts from the end of the list on negative index', () => { - var i = List.of(1, 2, 3, 4, 5, 6, 7); + const i = List.of(1, 2, 3, 4, 5, 6, 7); expect(i.get(-1)).toBe(7); expect(i.get(-5)).toBe(3); expect(i.get(-9)).toBe(undefined); @@ -145,7 +184,8 @@ describe('List', () => { it('coerces numeric-string keys', () => { // Of course, TypeScript protects us from this, so cast to "any" to test. - var i: any = List.of(1, 2, 3, 4, 5, 6); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const i: any = List.of(1, 2, 3, 4, 5, 6); expect(i.get('1')).toBe(2); expect(i.set('3', 10).get('3')).toBe(10); // Like array, string negative numbers do not qualify @@ -155,52 +195,67 @@ describe('List', () => { }); it('uses not set value for string index', () => { - var list: any = List(); + const list = List(); + // @ts-expect-error -- test runtime expect(list.get('stringKey', 'NOT-SET')).toBe('NOT-SET'); }); it('uses not set value for index {}', () => { - var list: any = List.of(1, 2, 3, 4, 5); + const list = List.of(1, 2, 3, 4, 5); + // @ts-expect-error -- test runtime expect(list.get({}, 'NOT-SET')).toBe('NOT-SET'); }); it('uses not set value for index void 0', () => { - var list: any = List.of(1, 2, 3, 4, 5); + const list = List.of(1, 2, 3, 4, 5); + // @ts-expect-error -- test runtime + expect(list.get(void 0, 'NOT-SET')).toBe('NOT-SET'); }); it('uses not set value for index undefined', () => { - var list: any = List.of(1, 2, 3, 4, 5); + const list = List.of(1, 2, 3, 4, 5); + // @ts-expect-error -- test runtime expect(list.get(undefined, 'NOT-SET')).toBe('NOT-SET'); }); it('doesnt coerce empty strings to index 0', () => { - var list: any = List.of(1, 2, 3); + const list = List.of(1, 2, 3); + // @ts-expect-error -- test runtime expect(list.has('')).toBe(false); }); it('doesnt contain elements at non-empty string keys', () => { - var list: any = List.of(1, 2, 3, 4, 5); + const list = List.of(1, 2, 3, 4, 5); + // @ts-expect-error -- test runtime expect(list.has('str')).toBe(false); }); it('hasIn doesnt contain elements at non-empty string keys', () => { - var list: any = List.of(1, 2, 3, 4, 5); - expect(list.hasIn(('str'))).toBe(false); + const list = List.of(1, 2, 3, 4, 5); + expect(list.hasIn(['str'])).toBe(false); + }); + + it('hasIn doesnt throw for bad key-path', () => { + const list = List.of(1, 2, 3, 4, 5); + expect(list.hasIn([1, 2, 3])).toBe(false); + + const list2 = List([{}]); + expect(list2.hasIn([0, 'bad'])).toBe(false); }); it('setting creates a new instance', () => { - var v0 = List.of('a'); - var v1 = v0.set(0, 'A'); + const v0 = List.of('a'); + const v1 = v0.set(0, 'A'); expect(v0.get(0)).toBe('a'); expect(v1.get(0)).toBe('A'); }); it('size includes the highest index', () => { - var v0 = List(); - var v1 = v0.set(0, 'a'); - var v2 = v1.set(1, 'b'); - var v3 = v2.set(2, 'c'); + const v0 = List(); + const v1 = v0.set(0, 'a'); + const v2 = v1.set(1, 'b'); + const v3 = v2.set(2, 'c'); expect(v0.size).toBe(0); expect(v1.size).toBe(1); expect(v2.size).toBe(2); @@ -208,17 +263,17 @@ describe('List', () => { }); it('get helpers make for easier to read code', () => { - var v = List.of('a', 'b', 'c'); + const v = List.of('a', 'b', 'c'); expect(v.first()).toBe('a'); expect(v.get(1)).toBe('b'); expect(v.last()).toBe('c'); }); it('slice helpers make for easier to read code', () => { - var v0 = List.of('a', 'b', 'c'); - var v1 = List.of('a', 'b'); - var v2 = List.of('a'); - var v3 = List(); + const v0 = List.of('a', 'b', 'c'); + const v1 = List.of('a', 'b'); + const v2 = List.of('a'); + const v3 = List(); expect(v0.rest().toArray()).toEqual(['b', 'c']); expect(v0.butLast().toArray()).toEqual(['a', 'b']); @@ -234,16 +289,16 @@ describe('List', () => { }); it('can set at arbitrary indices', () => { - var v0 = List.of('a', 'b', 'c'); - var v1 = v0.set(1, 'B'); // within existing tail - var v2 = v1.set(3, 'd'); // at last position - var v3 = v2.set(31, 'e'); // (testing internal guts) - var v4 = v3.set(32, 'f'); // (testing internal guts) - var v5 = v4.set(1023, 'g'); // (testing internal guts) - var v6 = v5.set(1024, 'h'); // (testing internal guts) - var v7 = v6.set(32, 'F'); // set within existing tree + const v0 = List.of('a', 'b', 'c'); + const v1 = v0.set(1, 'B'); // within existing tail + const v2 = v1.set(3, 'd'); // at last position + const v3 = v2.set(31, 'e'); // (testing internal guts) + const v4 = v3.set(32, 'f'); // (testing internal guts) + const v5 = v4.set(1023, 'g'); // (testing internal guts) + const v6 = v5.set(1024, 'h'); // (testing internal guts) + const v7 = v6.set(32, 'F'); // set within existing tree expect(v7.size).toBe(1025); - var expectedArray = ['a', 'B', 'c', 'd']; + const expectedArray = ['a', 'B', 'c', 'd']; expectedArray[31] = 'e'; expectedArray[32] = 'F'; expectedArray[1023] = 'g'; @@ -252,43 +307,52 @@ describe('List', () => { }); it('can contain a large number of indices', () => { - var v = Range(0,20000).toList(); - var iterations = 0; - v.forEach(v => { + const r = Range(0, 20000).toList(); + let iterations = 0; + r.forEach((v) => { expect(v).toBe(iterations); iterations++; }); - }) + }); it('describes a dense list', () => { - var v = List.of('a', 'b', 'c').push('d').set(14, 'o').set(6, undefined).remove(1); + const v = List.of('a', 'b', 'c') + .push('d') + .set(14, 'o') + .set(6, undefined) + .remove(1); expect(v.size).toBe(14); - expect(v.toJS()).toEqual( - ['a','c','d',,,,,,,,,,,'o'] - ); + // eslint-disable-next-line no-sparse-arrays + expect(v.toJS()).toEqual(['a', 'c', 'd', , , , , , , , , , , 'o']); }); it('iterates a dense list', () => { - var v = List().setSize(11).set(1,1).set(3,3).set(5,5).set(7,7).set(9,9); + const v = List() + .setSize(11) + .set(1, 1) + .set(3, 3) + .set(5, 5) + .set(7, 7) + .set(9, 9); expect(v.size).toBe(11); - var forEachResults = []; + const forEachResults: Array<[number, undefined | number]> = []; v.forEach((val, i) => forEachResults.push([i, val])); expect(forEachResults).toEqual([ - [0,undefined], - [1,1], - [2,undefined], - [3,3], - [4,undefined], - [5,5], - [6,undefined], - [7,7], - [8,undefined], - [9,9], - [10,undefined], + [0, undefined], + [1, 1], + [2, undefined], + [3, 3], + [4, undefined], + [5, 5], + [6, undefined], + [7, 7], + [8, undefined], + [9, 9], + [10, undefined], ]); - var arrayResults = v.toArray(); + const arrayResults = v.toArray(); expect(arrayResults).toEqual([ undefined, 1, @@ -303,55 +367,62 @@ describe('List', () => { undefined, ]); - var iteratorResults = []; - var iterator = v.entries(); - var step; + const iteratorResults: Array<[number, undefined | number]> = []; + const iterator = v.entries(); + let step; while (!(step = iterator.next()).done) { iteratorResults.push(step.value); } expect(iteratorResults).toEqual([ - [0,undefined], - [1,1], - [2,undefined], - [3,3], - [4,undefined], - [5,5], - [6,undefined], - [7,7], - [8,undefined], - [9,9], - [10,undefined], + [0, undefined], + [1, 1], + [2, undefined], + [3, 3], + [4, undefined], + [5, 5], + [6, undefined], + [7, 7], + [8, undefined], + [9, 9], + [10, undefined], ]); }); + it('has the same iterator function for values', () => { + const l = List(['a', 'b', 'c']); + expect(l[Symbol.iterator]).toBe(l.values); + }); + it('push inserts at highest index', () => { - var v0 = List.of('a', 'b', 'c'); - var v1 = v0.push('d', 'e', 'f'); + const v0 = List.of('a', 'b', 'c'); + const v1 = v0.push('d', 'e', 'f'); expect(v0.size).toBe(3); expect(v1.size).toBe(6); expect(v1.toArray()).toEqual(['a', 'b', 'c', 'd', 'e', 'f']); }); - check.it('pushes multiple values to the end', {maxSize: 2000}, - [gen.posInt, gen.posInt], (s1, s2) => { - var a1 = arrayOfSize(s1); - var a2 = arrayOfSize(s2); + it('pushes multiple values to the end', () => { + fc.assert( + fc.property(fc.nat(100), fc.nat(100), (s1, s2) => { + const a1 = arrayOfSize(s1); + const a2 = arrayOfSize(s2); - var v1 = List(a1); - var v3 = v1.push.apply(v1, a2); + const v1 = List(a1); + const v3 = v1.push.apply(v1, a2); - var a3 = a1.slice(); - a3.push.apply(a3, a2); + const a3 = a1.slice(); + a3.push.apply(a3, a2); - expect(v3.size).toEqual(a3.length); - expect(v3.toArray()).toEqual(a3); - } - ); + expect(v3.size).toEqual(a3.length); + expect(v3.toArray()).toEqual(a3); + }) + ); + }); it('pop removes the highest index, decrementing size', () => { - var v = List.of('a', 'b', 'c').pop(); + let v = List.of('a', 'b', 'c').pop(); expect(v.last()).toBe('b'); - expect(v.toArray()).toEqual(['a','b']); + expect(v.toArray()).toEqual(['a', 'b']); v = v.set(1230, 'x'); expect(v.size).toBe(1231); expect(v.last()).toBe('x'); @@ -363,40 +434,44 @@ describe('List', () => { expect(v.last()).toBe('X'); }); - check.it('pop removes the highest index, just like array', {maxSize: 2000}, - [gen.posInt], len => { - var a = arrayOfSize(len); - var v = List(a); + it('pop removes the highest index, just like array', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + const a = arrayOfSize(len); + let v = List(a); - while (a.length) { + while (a.length) { + expect(v.size).toBe(a.length); + expect(v.toArray()).toEqual(a); + v = v.pop(); + a.pop(); + } expect(v.size).toBe(a.length); expect(v.toArray()).toEqual(a); - v = v.pop(); - a.pop(); - } - expect(v.size).toBe(a.length); - expect(v.toArray()).toEqual(a); - } - ); + }) + ); + }); - check.it('push adds the next highest index, just like array', {maxSize: 2000}, - [gen.posInt], len => { - var a = []; - var v = List(); + it('push adds the next highest index, just like array', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + const a: Array = []; + let v = List(); - for (var ii = 0; ii < len; ii++) { + for (let ii = 0; ii < len; ii++) { + expect(v.size).toBe(a.length); + expect(v.toArray()).toEqual(a); + v = v.push(ii); + a.push(ii); + } expect(v.size).toBe(a.length); expect(v.toArray()).toEqual(a); - v = v.push(ii); - a.push(ii); - } - expect(v.size).toBe(a.length); - expect(v.toArray()).toEqual(a); - } - ); + }) + ); + }); it('allows popping an empty list', () => { - var v = List.of('a').pop(); + let v = List.of('a').pop(); expect(v.size).toBe(0); expect(v.toArray()).toEqual([]); v = v.pop().pop().pop().pop().pop(); @@ -404,8 +479,8 @@ describe('List', () => { expect(v.toArray()).toEqual([]); }); - it('remove removes any index', () => { - var v = List.of('a', 'b', 'c').remove(2).remove(0); + it.each(['remove', 'delete'])('remove removes any index', (fn) => { + let v = List.of('a', 'b', 'c')[fn](2)[fn](0); expect(v.size).toBe(1); expect(v.get(0)).toBe('b'); expect(v.get(1)).toBe(undefined); @@ -414,125 +489,189 @@ describe('List', () => { v = v.push('d'); expect(v.size).toBe(2); expect(v.get(1)).toBe('d'); - expect(v.toArray()).toEqual(['b','d']); + expect(v.toArray()).toEqual(['b', 'd']); }); it('shifts values from the front', () => { - var v = List.of('a', 'b', 'c').shift(); + const v = List.of('a', 'b', 'c').shift(); expect(v.first()).toBe('b'); expect(v.size).toBe(2); }); it('unshifts values to the front', () => { - var v = List.of('a', 'b', 'c').unshift('x', 'y', 'z'); + const v = List.of('a', 'b', 'c').unshift('x', 'y', 'z'); expect(v.first()).toBe('x'); expect(v.size).toBe(6); expect(v.toArray()).toEqual(['x', 'y', 'z', 'a', 'b', 'c']); }); - check.it('unshifts multiple values to the front', {maxSize: 2000}, - [gen.posInt, gen.posInt], (s1, s2) => { - var a1 = arrayOfSize(s1); - var a2 = arrayOfSize(s2); + it('unshifts multiple values to the front', () => { + fc.assert( + fc.property(fc.nat(100), fc.nat(100), (s1, s2) => { + const a1 = arrayOfSize(s1); + const a2 = arrayOfSize(s2); - var v1 = List(a1); - var v3 = v1.unshift.apply(v1, a2); + const v1 = List(a1); + const v3 = v1.unshift.apply(v1, a2); - var a3 = a1.slice(); - a3.unshift.apply(a3, a2); + const a3 = a1.slice(); + a3.unshift.apply(a3, a2); - expect(v3.size).toEqual(a3.length); - expect(v3.toArray()).toEqual(a3); - } - ); + expect(v3.size).toEqual(a3.length); + expect(v3.toArray()).toEqual(a3); + }) + ); + }); it('finds values using indexOf', () => { - var v = List.of('a', 'b', 'c', 'b', 'a'); + const v = List.of('a', 'b', 'c', 'b', 'a'); expect(v.indexOf('b')).toBe(1); expect(v.indexOf('c')).toBe(2); expect(v.indexOf('d')).toBe(-1); }); it('finds values using lastIndexOf', () => { - var v = List.of('a', 'b', 'c', 'b', 'a'); + const v = List.of('a', 'b', 'c', 'b', 'a'); expect(v.lastIndexOf('b')).toBe(3); expect(v.lastIndexOf('c')).toBe(2); expect(v.lastIndexOf('d')).toBe(-1); }); it('finds values using findIndex', () => { - var v = List.of('a', 'b', 'c', 'B', 'a'); - expect(v.findIndex(value => value.toUpperCase() === value)).toBe(3); - expect(v.findIndex(value => value.length > 1)).toBe(-1); + const v = List.of('a', 'b', 'c', 'B', 'a'); + expect(v.findIndex((value) => value.toUpperCase() === value)).toBe(3); + expect(v.findIndex((value) => value.length > 1)).toBe(-1); }); it('finds values using findEntry', () => { - var v = List.of('a', 'b', 'c', 'B', 'a'); - expect(v.findEntry(value => value.toUpperCase() === value)).toEqual([3, 'B']); - expect(v.findEntry(value => value.length > 1)).toBe(undefined); + const v = List.of('a', 'b', 'c', 'B', 'a'); + expect(v.findEntry((value) => value.toUpperCase() === value)).toEqual([ + 3, + 'B', + ]); + expect(v.findEntry((value) => value.length > 1)).toBe(undefined); }); it('maps values', () => { - var v = List.of('a', 'b', 'c'); - var r = v.map(value => value.toUpperCase()); + const v = List.of('a', 'b', 'c'); + const r = v.map((value) => value.toUpperCase()); expect(r.toArray()).toEqual(['A', 'B', 'C']); }); + it('map no-ops return the same reference', () => { + const v = List.of('a', 'b', 'c'); + const r = v.map((value) => value); + expect(r).toBe(v); + }); + + it('ensures iter is unmodified', () => { + const v = List.of(1, 2, 3); + const r = v.map((value, index, iter) => iter.get(index - 1)); + expect(r.toArray()).toEqual([3, 1, 2]); + }); + it('filters values', () => { - var v = List.of('a', 'b', 'c', 'd', 'e', 'f'); - var r = v.filter((value, index) => index % 2 === 1); + const v = List.of('a', 'b', 'c', 'd', 'e', 'f'); + const r = v.filter((value, index) => index % 2 === 1); expect(r.toArray()).toEqual(['b', 'd', 'f']); }); + it('partitions values', () => { + const v = List.of('a', 'b', 'c', 'd', 'e', 'f'); + const r = v + .partition((value, index) => index % 2 === 1) + .map((part) => part.toArray()); + expect(r).toEqual([ + ['a', 'c', 'e'], + ['b', 'd', 'f'], + ]); + }); + + it('filters values based on type', () => { + class A {} + class B extends A { + b(): void {} + } + class C extends A { + c(): void {} + } + const l1 = List([new B(), new C(), new B(), new C()]); + const l2: List = l1.filter((v): v is C => v instanceof C); + expect(l2.size).toEqual(2); + expect(l2.every((v) => v instanceof C)).toBe(true); + }); + + it('partitions values based on type', () => { + class A {} + class B extends A { + b(): void {} + } + class C extends A { + c(): void {} + } + const l1 = List([new B(), new C(), new B(), new C()]); + const [la, lc]: [List, List] = l1.partition( + (v): v is C => v instanceof C + ); + expect(la.size).toEqual(2); + expect(la.some((v) => v instanceof C)).toBe(false); + expect(lc.size).toEqual(2); + expect(lc.every((v) => v instanceof C)).toBe(true); + }); + it('reduces values', () => { - var v = List.of(1,10,100); - var r = v.reduce((reduction, value) => reduction + value); + const v = List.of(1, 10, 100); + const r = v.reduce((reduction, value) => reduction + value); expect(r).toEqual(111); + const r2 = v.reduce((reduction, value) => reduction + value, 1000); + expect(r2).toEqual(1111); }); it('reduces from the right', () => { - var v = List.of('a','b','c'); - var r = v.reduceRight((reduction, value) => reduction + value); + const v = List.of('a', 'b', 'c'); + const r = v.reduceRight((reduction, value) => reduction + value); expect(r).toEqual('cba'); + const r2 = v.reduceRight((reduction, value) => reduction + value, 'x'); + expect(r2).toEqual('xcba'); }); it('takes maximum number', () => { - var v = List.of('a','b','c'); - var r = v.take(Number.MAX_SAFE_INTEGER); + const v = List.of('a', 'b', 'c'); + const r = v.take(Number.MAX_SAFE_INTEGER); expect(r).toBe(v); - }) + }); it('takes and skips values', () => { - var v = List.of('a', 'b', 'c', 'd', 'e', 'f'); - var r = v.skip(2).take(2); + const v = List.of('a', 'b', 'c', 'd', 'e', 'f'); + const r = v.skip(2).take(2); expect(r.toArray()).toEqual(['c', 'd']); }); it('takes and skips no-ops return same reference', () => { - var v = List.of('a', 'b', 'c', 'd', 'e', 'f'); - var r = v.skip(0).take(6); + const v = List.of('a', 'b', 'c', 'd', 'e', 'f'); + const r = v.skip(0).take(6); expect(r).toBe(v); }); it('takeLast and skipLast values', () => { - var v = List.of('a', 'b', 'c', 'd', 'e', 'f'); - var r = v.skipLast(1).takeLast(2); + const v = List.of('a', 'b', 'c', 'd', 'e', 'f'); + const r = v.skipLast(1).takeLast(2); expect(r.toArray()).toEqual(['d', 'e']); }); it('takeLast and skipLast no-ops return same reference', () => { - var v = List.of('a', 'b', 'c', 'd', 'e', 'f'); - var r = v.skipLast(0).takeLast(6); + const v = List.of('a', 'b', 'c', 'd', 'e', 'f'); + const r = v.skipLast(0).takeLast(6); expect(r).toBe(v); }); it('efficiently chains array methods', () => { - var v = List.of(1,2,3,4,5,6,7,8,9,10,11,12,13,14); + const v = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14); - var r = v - .filter(x => x % 2 == 0) + const r = v + .filter((x) => x % 2 === 0) .skip(2) - .map(x => x * x) + .map((x) => x * x) .take(3) .reduce((a: number, b: number) => a + b, 0); @@ -540,51 +679,80 @@ describe('List', () => { }); it('can convert to a map', () => { - var v = List.of('a', 'b', 'c'); - var m = v.toMap(); + const v = List.of('a', 'b', 'c'); + const m = v.toMap(); expect(m.size).toBe(3); expect(m.get(1)).toBe('b'); }); it('reverses', () => { - var v = List.of('a', 'b', 'c'); + const v = List.of('a', 'b', 'c'); expect(v.reverse().toArray()).toEqual(['c', 'b', 'a']); }); it('ensures equality', () => { // Make a sufficiently long list. - var a = Array(100).join('abcdefghijklmnopqrstuvwxyz').split(''); - var v1 = List(a); - var v2 = List(a); + const a = Array(100).join('abcdefghijklmnopqrstuvwxyz').split(''); + const v1 = List(a); + const v2 = List(a); + + // eslint-disable-next-line eqeqeq expect(v1 == v2).not.toBe(true); expect(v1 === v2).not.toBe(true); expect(v1.equals(v2)).toBe(true); }); it('works with insert', () => { - var v = List.of('a', 'b', 'c'); - var m = v.insert(1, 'd'); + const v = List.of('a', 'b', 'c'); + const m = v.insert(1, 'd'); expect(m.size).toBe(4); expect(m.get(1)).toBe('d'); - //works when index is greater than size of array - var n = v.insert(10, 'e'); + // Works when index is greater than size of array. + const n = v.insert(10, 'e'); expect(n.size).toBe(4); expect(n.get(3)).toBe('e'); - //works when index is negative - var o = v.insert(-4, 'f'); + // Works when index is negative. + const o = v.insert(-4, 'f'); expect(o.size).toBe(4); expect(o.get(0)).toBe('f'); }); + it('works with push, set and insert without phantom values', () => { + const v = List.of().set(287, 287).push(42).insert(33, 33); + expect(v.toJS().filter((item) => item === 287)).toHaveLength(1); + const v2 = List.of().push(0).unshift(-1).unshift(-2).pop().pop().set(2, 2); + expect(v2.toJS()).toEqual([-2, undefined, 2]); + const v3 = List.of().set(447, 447).push(0).insert(65, 65); + expect(v3.toJS().filter((item) => item === 447)).toHaveLength(1); + const v4 = List.of().set(-28, -28).push(0).shift().set(-30, -30); + expect(v4.toJS().filter((item) => item === -28)).toHaveLength(0); + const v5 = List.of().unshift(0).set(33, 33).shift().set(-35, -35); + expect(v5.toJS().filter((item) => item === 0)).toHaveLength(0); + + // execute the same test as `v` but for the 2000 first integers + const isOkV1 = (v) => + List.of() + .set(v, v) + .push('pushed-value') + .insert(33, 'inserted-value') + .filter((item) => item === v).size === 1; + + const arr = new Array(2000).fill(null).map((_, v) => v); + + const notOkArray = arr.filter((v) => !isOkV1(v)); + + expect(notOkArray).toHaveLength(0); + }); + // TODO: assert that findIndex only calls the function as much as it needs to. it('forEach iterates in the correct order', () => { - var n = 0; - var a = []; - var v = List.of(0, 1, 2, 3, 4); - v.forEach(x => { + let n = 0; + const a: Array = []; + const v = List.of(0, 1, 2, 3, 4); + v.forEach((x) => { a.push(x); n++; }); @@ -594,53 +762,123 @@ describe('List', () => { }); it('forEach iteration terminates when callback returns false', () => { - var a = []; + const a: Array = []; function count(x) { - if(x > 2) { + if (x > 2) { return false; } a.push(x); - }; - var v = List.of(0, 1, 2, 3, 4); + } + const v = List.of(0, 1, 2, 3, 4); v.forEach(count); expect(a).toEqual([0, 1, 2]); }); it('concat works like Array.prototype.concat', () => { - var v1 = List.of(1, 2, 3); - var v2 = v1.concat(4, List.of(5, 6), [7, 8], Seq({a:9,b:10}), Set.of(11,12), null); + const v1 = List([1, 2, 3]); + const v2 = v1.concat( + 4, + List([5, 6]), + [7, 8], + Seq([9, 10]), + Set.of(11, 12), + null + ); expect(v1.toArray()).toEqual([1, 2, 3]); expect(v2.toArray()).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, null]); }); + it('concat works like Array.prototype.concat even for IE11', () => { + const v1 = List([1, 2, 3]); + const a = [4]; + + // remove Symbol.iterator as IE11 does not handle it. + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/@@iterator#browser_compatibility + // @ts-expect-error -- simulate IE11 + a[Symbol.iterator] = undefined; + + const v2 = v1.concat(a); + expect(v1.toArray()).toEqual([1, 2, 3]); + expect(v2.toArray()).toEqual([1, 2, 3, 4]); + }); + + it('concat returns self when no changes', () => { + const v1 = List([1, 2, 3]); + expect(v1.concat([])).toBe(v1); + }); + + it('concat returns arg when concat to empty', () => { + const v1 = List([1, 2, 3]); + expect(List().concat(v1)).toBe(v1); + }); + + it('concats a single value', () => { + const v1 = List([1, 2, 3]); + expect(v1.concat(4)).toEqual(List([1, 2, 3, 4])); + }); + + it('concat returns List-coerced arg when concat to empty', () => { + expect(List().concat([1, 2, 3])).toEqual(List([1, 2, 3])); + }); + + it('concat does not spread in string characters', () => { + const v1 = List([1, 2, 3]); + expect(v1.concat('abcdef')).toEqual(List([1, 2, 3, 'abcdef'])); + }); + it('allows chained mutations', () => { - var v1 = List(); - var v2 = v1.push(1); - var v3 = v2.withMutations(v => v.push(2).push(3).push(4)); - var v4 = v3.push(5); + const v1 = List(); + const v2 = v1.push(1); + const v3 = v2.withMutations((v) => v.push(2).push(3).push(4)); + const v4 = v3.push(5); expect(v1.toArray()).toEqual([]); expect(v2.toArray()).toEqual([1]); - expect(v3.toArray()).toEqual([1,2,3,4]); - expect(v4.toArray()).toEqual([1,2,3,4,5]); + expect(v3.toArray()).toEqual([1, 2, 3, 4]); + expect(v4.toArray()).toEqual([1, 2, 3, 4, 5]); }); it('allows chained mutations using alternative API', () => { - var v1 = List(); - var v2 = v1.push(1); - var v3 = v2.asMutable().push(2).push(3).push(4).asImmutable(); - var v4 = v3.push(5); + const v1 = List(); + const v2 = v1.push(1); + const v3 = v2.asMutable().push(2).push(3).push(4).asImmutable(); + const v4 = v3.push(5); expect(v1.toArray()).toEqual([]); expect(v2.toArray()).toEqual([1]); - expect(v3.toArray()).toEqual([1,2,3,4]); - expect(v4.toArray()).toEqual([1,2,3,4,5]); + expect(v3.toArray()).toEqual([1, 2, 3, 4]); + expect(v4.toArray()).toEqual([1, 2, 3, 4, 5]); + }); + + it('chained mutations does not result in new empty list instance', () => { + const v1 = List(['x']); + const v2 = v1.withMutations((v) => v.push('y').pop().pop()); + expect(v2).toEqual(List()); + }); + + it('calling `clear` and `setSize` should set all items to undefined', () => { + const l = List(['a', 'b']); + const l2 = l.clear().setSize(3); + + expect(l2.get(0)).toBeUndefined(); + expect(l2.get(1)).toBeUndefined(); + expect(l2.get(2)).toBeUndefined(); + }); + + it('calling `clear` and `setSize` while mutating should set all items to undefined', () => { + const l = List(['a', 'b']); + const l2 = l.withMutations((innerList) => { + innerList.clear().setSize(3); + }); + expect(l2.get(0)).toBeUndefined(); + expect(l2.get(1)).toBeUndefined(); + expect(l2.get(2)).toBeUndefined(); }); it('allows size to be set', () => { - var v1 = Range(0,2000).toList(); - var v2 = v1.setSize(1000); - var v3 = v2.setSize(1500); + const v1 = Range(0, 2000).toList(); + const v2 = v1.setSize(1000); + const v3 = v2.setSize(1500); expect(v1.size).toBe(2000); expect(v2.size).toBe(1000); expect(v3.size).toBe(1500); @@ -656,34 +894,34 @@ describe('List', () => { }); it('discards truncated elements when using slice', () => { - var list = [1,2,3,4,5,6]; - var v1 = fromJS(list); - var v2 = v1.slice(0,3); - var v3 = v2.setSize(6); + const list: Array = [1, 2, 3, 4, 5, 6]; + const v1 = fromJS(list) as List; + const v2 = v1.slice(0, 3); + const v3 = v2.setSize(6); - expect(v2.toArray()).toEqual(list.slice(0,3)); + expect(v2.toArray()).toEqual(list.slice(0, 3)); expect(v3.toArray()).toEqual( - list.slice(0,3).concat([undefined, undefined, undefined]) + list.slice(0, 3).concat([undefined, undefined, undefined]) ); }); it('discards truncated elements when using setSize', () => { - var list = [1,2,3,4,5,6]; - var v1 = fromJS(list); - var v2 = v1.setSize(3); - var v3 = v2.setSize(6); + const list: Array = [1, 2, 3, 4, 5, 6]; + const v1 = fromJS(list) as List; + const v2 = v1.setSize(3); + const v3 = v2.setSize(6); - expect(v2.toArray()).toEqual(list.slice(0,3)); + expect(v2.toArray()).toEqual(list.slice(0, 3)); expect(v3.toArray()).toEqual( - list.slice(0,3).concat([undefined, undefined, undefined]) + list.slice(0, 3).concat([undefined, undefined, undefined]) ); }); it('can be efficiently sliced', () => { - var v1 = Range(0,2000).toList(); - var v2 = v1.slice(100,-100).toList(); - var v3 = v2.slice(0, Infinity); - expect(v1.size).toBe(2000) + const v1 = Range(0, 2000).toList(); + const v2 = v1.slice(100, -100).toList(); + const v3 = v2.slice(0, Infinity); + expect(v1.size).toBe(2000); expect(v2.size).toBe(1800); expect(v3.size).toBe(1800); expect(v2.first()).toBe(100); @@ -694,25 +932,56 @@ describe('List', () => { [NaN, Infinity, -Infinity].forEach((zeroishValue) => { it(`treats ${zeroishValue} like zero when setting size`, () => { - var v1 = List.of('a', 'b', 'c'); - var v2 = v1.setSize(zeroishValue); + const v1 = List.of('a', 'b', 'c'); + const v2 = v1.setSize(zeroishValue); expect(v2.size).toBe(0); }); }); it('Does not infinite loop when sliced with NaN #459', () => { - var list = List([1, 2, 3, 4, 5]); - var newList = list.slice(0, NaN); + const list = List([1, 2, 3, 4, 5]); + const newList = list.slice(0, NaN); expect(newList.toJS()).toEqual([]); }); it('Accepts NaN for slice and concat #602', () => { - var list = List().slice(0, NaN).concat(NaN); + const list = List().slice(0, NaN).concat(NaN); // toEqual([ NaN ]) expect(list.size).toBe(1); expect(isNaNValue(list.get(0))).toBe(true); }); + it('return a new emptyList if the emptyList has been mutated #2003', () => { + const emptyList = List(); + + const nonEmptyList = emptyList.withMutations((l) => { + l.setSize(1); + l.set(0, 'a'); + }); + + expect(nonEmptyList.size).toBe(1); + expect(nonEmptyList).toEqual(List.of('a')); + expect(emptyList.size).toBe(0); + + const mutableList = emptyList.asMutable(); + + mutableList.setSize(1); + mutableList.set(0, 'b'); + + expect(mutableList.size).toBe(1); + expect(mutableList).toEqual(List.of('b')); + + expect(emptyList.size).toBe(0); + expect(List().size).toBe(0); + }); + + it('Mutating empty list with a JS API should not mutate new instances', () => { + Object.assign(List(), List([1, 2])); + + expect(List().size).toBe(0); + expect(List().toArray()).toEqual([]); + }); + // Note: NaN is the only value not equal to itself. The isNaN() built-in // function returns true for any non-numeric value, not just the NaN value. function isNaNValue(value) { @@ -722,56 +991,86 @@ describe('List', () => { describe('when slicing', () => { [NaN, -Infinity].forEach((zeroishValue) => { it(`considers a ${zeroishValue} begin argument to be zero`, () => { - var v1 = List.of('a', 'b', 'c'); - var v2 = v1.slice(zeroishValue, 3); + const v1 = List.of('a', 'b', 'c'); + const v2 = v1.slice(zeroishValue, 3); expect(v2.size).toBe(3); }); it(`considers a ${zeroishValue} end argument to be zero`, () => { - var v1 = List.of('a', 'b', 'c'); - var v2 = v1.slice(0, zeroishValue); + const v1 = List.of('a', 'b', 'c'); + const v2 = v1.slice(0, zeroishValue); expect(v2.size).toBe(0); }); it(`considers ${zeroishValue} begin and end arguments to be zero`, () => { - var v1 = List.of('a', 'b', 'c'); - var v2 = v1.slice(zeroishValue, zeroishValue); + const v1 = List.of('a', 'b', 'c'); + const v2 = v1.slice(zeroishValue, zeroishValue); expect(v2.size).toBe(0); }); }); }); - describe('Iterator', () => { + describe('when shuffling', () => { + const list = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); - var pInt = gen.posInt; - - check.it('iterates through List', [pInt, pInt], (start, len) => { - var l = Range(0, start + len).toList(); - l = > l.slice(start, start + len); - expect(l.size).toBe(len); - var valueIter = l.values(); - var keyIter = l.keys(); - var entryIter = l.entries(); - for (var ii = 0; ii < len; ii++) { - expect(valueIter.next().value).toBe(start + ii); - expect(keyIter.next().value).toBe(ii); - expect(entryIter.next().value).toEqual([ii, start + ii]); - } + it('should work when empty', () => { + expect(List().shuffle()).toStrictEqual(List()); }); + it('should work with Math.random', () => { + expect(list.shuffle().sort()).toStrictEqual(list); + }); + it('should work with a pseudo random number generator', () => { + const seed = createSeed('lorem ipsum'); + const random = () => seed.random(); + + expect(list.shuffle(random)).toStrictEqual( + List.of(5, 2, 4, 7, 6, 3, 10, 1, 9, 8) + ); + expect(list.shuffle(random)).toStrictEqual( + List.of(1, 6, 2, 3, 9, 7, 4, 10, 5, 8) + ); + expect(list.shuffle(random)).toStrictEqual( + List.of(6, 1, 8, 10, 9, 5, 4, 7, 3, 2) + ); + }); + }); - check.it('iterates through List in reverse', [pInt, pInt], (start, len) => { - var l = Range(0, start + len).toList(); - l = > l.slice(start, start + len); - var s = l.toSeq().reverse(); // impl calls List.__iterator(REVERSE) - expect(s.size).toBe(len); - var valueIter = s.values(); - var keyIter = s.keys(); - var entryIter = s.entries(); - for (var ii = 0; ii < len; ii++) { - expect(valueIter.next().value).toBe(start + len - 1 - ii); - expect(keyIter.next().value).toBe(ii); - expect(entryIter.next().value).toEqual([ii, start + len - 1 - ii]); - } + describe('Iterator', () => { + const pInt = fc.nat(100); + + it('iterates through List', () => { + fc.assert( + fc.property(pInt, pInt, (start, len) => { + const l1 = Range(0, start + len).toList(); + const l2: List = l1.slice(start, start + len); + expect(l2.size).toBe(len); + const valueIter = l2.values(); + const keyIter = l2.keys(); + const entryIter = l2.entries(); + for (let ii = 0; ii < len; ii++) { + expect(valueIter.next().value).toBe(start + ii); + expect(keyIter.next().value).toBe(ii); + expect(entryIter.next().value).toEqual([ii, start + ii]); + } + }) + ); }); + it('iterates through List in reverse', () => { + fc.assert( + fc.property(pInt, pInt, (start, len) => { + const l1 = Range(0, start + len).toList(); + const l2: List = l1.slice(start, start + len); + const s = l2.toSeq().reverse(); // impl calls List.__iterator(REVERSE) + expect(s.size).toBe(len); + const valueIter = s.values(); + const keyIter = s.keys(); + const entryIter = s.entries(); + for (let ii = 0; ii < len; ii++) { + expect(valueIter.next().value).toBe(start + len - 1 - ii); + expect(keyIter.next().value).toBe(ii); + expect(entryIter.next().value).toEqual([ii, start + len - 1 - ii]); + } + }) + ); + }); }); - }); diff --git a/__tests__/ListJS.js b/__tests__/ListJS.js index cb9a129cb5..ae18d4881d 100644 --- a/__tests__/ListJS.js +++ b/__tests__/ListJS.js @@ -1,32 +1,32 @@ -var Immutable = require('../'); -var List = Immutable.List; +import { describe, expect, it } from '@jest/globals'; +import { List } from 'immutable'; -var NON_NUMBERS = { - 'array': ['not', 'a', 'number'], - 'NaN': NaN, - 'object': {not: 'a number'}, - 'string': 'not a number', +const NON_NUMBERS = { + array: ['not', 'a', 'number'], + NaN: NaN, + object: { not: 'a number' }, + string: 'not a number', }; describe('List', () => { describe('setSize()', () => { - Object.keys(NON_NUMBERS).forEach(function(type) { - var nonNumber = NON_NUMBERS[type]; + Object.keys(NON_NUMBERS).forEach((type) => { + const nonNumber = NON_NUMBERS[type]; it(`considers a size argument of type '${type}' to be zero`, () => { - var v1 = List.of(1,2,3); - var v2 = v1.setSize(nonNumber); + const v1 = List.of(1, 2, 3); + const v2 = v1.setSize(nonNumber); expect(v2.size).toBe(0); }); - }) + }); }); describe('slice()', () => { // Mimic the behavior of Array::slice() // http://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.slice - Object.keys(NON_NUMBERS).forEach(function(type) { - var nonNumber = NON_NUMBERS[type]; + Object.keys(NON_NUMBERS).forEach((type) => { + const nonNumber = NON_NUMBERS[type]; it(`considers a begin argument of type '${type}' to be zero`, () => { - var v1 = List.of('a', 'b', 'c'); - var v2 = v1.slice(nonNumber, 2); + const v1 = List.of('a', 'b', 'c'); + const v2 = v1.slice(nonNumber, 2); expect(v2.size).toBe(2); expect(v2.first()).toBe('a'); expect(v2.rest().size).toBe(1); @@ -34,8 +34,8 @@ describe('List', () => { expect(v2.butLast().size).toBe(1); }); it(`considers an end argument of type '${type}' to be zero`, () => { - var v1 = List.of('a', 'b', 'c'); - var v2 = v1.slice(0, nonNumber); + const v1 = List.of('a', 'b', 'c'); + const v2 = v1.slice(0, nonNumber); expect(v2.size).toBe(0); expect(v2.first()).toBe(undefined); expect(v2.rest().size).toBe(0); diff --git a/__tests__/Map.ts b/__tests__/Map.ts index 919f3508cd..d8ae8b16ca 100644 --- a/__tests__/Map.ts +++ b/__tests__/Map.ts @@ -1,14 +1,25 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Map, Seq, List, Range, Record, is } from '../'; +import { describe, expect, it, jest } from '@jest/globals'; +import { fromJS, is, List, Map, Range, Record, Seq } from 'immutable'; +import fc from 'fast-check'; describe('Map', () => { - it('converts from object', () => { - var m = Map({'a': 'A', 'b': 'B', 'c': 'C'}); + const m = Map({ a: 'A', b: 'B', c: 'C' }); + expect(m.size).toBe(3); + expect(m.get('a')).toBe('A'); + expect(m.get('b')).toBe('B'); + expect(m.get('c')).toBe('C'); + }); + + it('converts from JS (global) Map', () => { + const m = Map( + new global.Map([ + ['a', 'A'], + ['b', 'B'], + ['c', 'C'], + ]) + ); + expect(Map.isMap(m)).toBe(true); expect(m.size).toBe(3); expect(m.get('a')).toBe('A'); expect(m.get('b')).toBe('B'); @@ -16,7 +27,7 @@ describe('Map', () => { }); it('constructor provides initial values', () => { - var m = Map({'a': 'A', 'b': 'B', 'c': 'C'}); + const m = Map({ a: 'A', b: 'B', c: 'C' }); expect(m.size).toBe(3); expect(m.get('a')).toBe('A'); expect(m.get('b')).toBe('B'); @@ -24,7 +35,11 @@ describe('Map', () => { }); it('constructor provides initial values as array of entries', () => { - var m = Map([['a','A'],['b','B'],['c','C']]); + const m = Map([ + ['a', 'A'], + ['b', 'B'], + ['c', 'C'], + ]); expect(m.size).toBe(3); expect(m.get('a')).toBe('A'); expect(m.get('b')).toBe('B'); @@ -32,8 +47,8 @@ describe('Map', () => { }); it('constructor provides initial values as sequence', () => { - var s = Seq({'a': 'A', 'b': 'B', 'c': 'C'}); - var m = Map(s); + const s = Seq({ a: 'A', b: 'B', c: 'C' }); + const m = Map(s); expect(m.size).toBe(3); expect(m.get('a')).toBe('A'); expect(m.get('b')).toBe('B'); @@ -41,91 +56,107 @@ describe('Map', () => { }); it('constructor provides initial values as list of lists', () => { - var l = List([ - List(['a', 'A']), - List(['b', 'B']), - List(['c', 'C']) - ]); - var m = Map(l); + const l = List([List(['a', 'A']), List(['b', 'B']), List(['c', 'C'])]); + const m = Map(l); expect(m.size).toBe(3); + // @ts-expect-error -- Not supported by typescript since 4.0.0 https://github.com/immutable-js/immutable-js/pull/1626 expect(m.get('a')).toBe('A'); + // @ts-expect-error -- Not supported by typescript since 4.0.0 https://github.com/immutable-js/immutable-js/pull/1626 expect(m.get('b')).toBe('B'); + // @ts-expect-error -- Not supported by typescript since 4.0.0 https://github.com/immutable-js/immutable-js/pull/1626 expect(m.get('c')).toBe('C'); }); it('constructor is identity when provided map', () => { - var m1 = Map({'a': 'A', 'b': 'B', 'c': 'C'}); - var m2 = Map(m1); + const m1 = Map({ a: 'A', b: 'B', c: 'C' }); + const m2 = Map(m1); expect(m2).toBe(m1); }); it('does not accept a scalar', () => { expect(() => { - Map(3 as any); - }).toThrow('Expected Array or iterable object of [k, v] entries, or keyed object: 3'); + // TODO: should expect error + Map(3); + }).toThrow( + 'Expected Array or collection object of [k, v] entries, or keyed object: 3' + ); }); - it('does not accept strings (iterable, but scalar)', () => { + it('does not accept strings (collection, but scalar)', () => { expect(() => { + // @ts-expect-error -- constructor does not accept strings, this is expected to throw Map('abc'); }).toThrow(); }); it('does not accept non-entries array', () => { expect(() => { - Map([1,2,3] as any); + // @ts-expect-error -- not an array of entries, this is expected to throw + Map([1, 2, 3]); }).toThrow('Expected [K, V] tuple: 1'); }); - it('accepts non-iterable array-like objects as keyed collections', () => { - var m = Map({ 'length': 3, '1': 'one' }); + it('accepts non-collection array-like objects as keyed collections', () => { + const m = Map({ length: 3, 1: 'one' }); expect(m.get('length')).toBe(3); + // @ts-expect-error -- type error, but the API is tolerante expect(m.get('1')).toBe('one'); - expect(m.toJS()).toEqual({ 'length': 3, '1': 'one' }); - }); - - it('accepts flattened pairs via of()', () => { - var m: Map = Map.of(1, 'a', 2, 'b', 3, 'c'); - expect(m.size).toBe(3); - expect(m.get(1)).toBe('a'); - expect(m.get(2)).toBe('b'); - expect(m.get(3)).toBe('c'); - }); - - it('does not accept mismatched flattened pairs via of()', () => { - expect(() => { - Map.of(1, 2, 3); - }).toThrow('Missing value for key: 3'); + expect(m.toJS()).toEqual({ length: 3, 1: 'one' }); }); it('converts back to JS object', () => { - var m = Map({'a': 'A', 'b': 'B', 'c': 'C'}); - expect(m.toObject()).toEqual({'a': 'A', 'b': 'B', 'c': 'C'}); + const m = Map({ a: 'A', b: 'B', c: 'C' }); + expect(m.toObject()).toEqual({ a: 'A', b: 'B', c: 'C' }); }); it('iterates values', () => { - var m = Map({'a': 'A', 'b': 'B', 'c': 'C'}); - var iterator = jest.genMockFunction(); + const m = Map({ a: 'A', b: 'B', c: 'C' }); + const iterator = jest.fn(); m.forEach(iterator); expect(iterator.mock.calls).toEqual([ ['A', 'a', m], ['B', 'b', m], - ['C', 'c', m] + ['C', 'c', m], ]); }); + it('has the same iterator function for entries', () => { + const m = Map({ a: 'A', b: 'B', c: 'C' }); + expect(m[Symbol.iterator]).toBe(m.entries); + }); + it('merges two maps', () => { - var m1 = Map({'a': 'A', 'b': 'B', 'c': 'C'}); - var m2 = Map({'wow': 'OO', 'd': 'DD', 'b': 'BB'}); - expect(m2.toObject()).toEqual({'wow': 'OO', 'd': 'DD', 'b': 'BB'}); - var m3 = m1.merge(m2); - expect(m3.toObject()).toEqual({'a': 'A', 'b': 'BB', 'c': 'C', 'wow': 'OO', 'd': 'DD'}); + const m1 = Map({ a: 'A', b: 'B', c: 'C' }); + const m2 = Map({ wow: 'OO', d: 'DD', b: 'BB' }); + expect(m2.toObject()).toEqual({ wow: 'OO', d: 'DD', b: 'BB' }); + const m3 = m1.merge(m2); + expect(m3.toObject()).toEqual({ + a: 'A', + b: 'BB', + c: 'C', + wow: 'OO', + d: 'DD', + }); + }); + + it('concatenates two maps (alias for merge)', () => { + const m1 = Map({ a: 'A', b: 'B', c: 'C' }); + const m2 = Map({ wow: 'OO', d: 'DD', b: 'BB' }); + expect(m2.toObject()).toEqual({ wow: 'OO', d: 'DD', b: 'BB' }); + const m3 = m1.concat(m2); + expect(m3.toObject()).toEqual({ + a: 'A', + b: 'BB', + c: 'C', + wow: 'OO', + d: 'DD', + }); }); it('accepts null as a key', () => { - var m1 = Map(); - var m2 = m1.set(null, 'null'); - var m3 = m2.remove(null); + const m1 = Map(); + const m2 = m1.set(null, 'null'); + const m3 = m2.remove(null); expect(m1.size).toBe(0); expect(m2.size).toBe(1); expect(m3.size).toBe(0); @@ -133,11 +164,11 @@ describe('Map', () => { }); it('is persistent to sets', () => { - var m1 = Map(); - var m2 = m1.set('a', 'Aardvark'); - var m3 = m2.set('b', 'Baboon'); - var m4 = m3.set('c', 'Canary'); - var m5 = m4.set('b', 'Bonobo'); + const m1 = Map(); + const m2 = m1.set('a', 'Aardvark'); + const m3 = m2.set('b', 'Baboon'); + const m4 = m3.set('c', 'Canary'); + const m5 = m4.set('b', 'Bonobo'); expect(m1.size).toBe(0); expect(m2.size).toBe(1); expect(m3.size).toBe(2); @@ -148,11 +179,11 @@ describe('Map', () => { }); it('is persistent to deletes', () => { - var m1 = Map(); - var m2 = m1.set('a', 'Aardvark'); - var m3 = m2.set('b', 'Baboon'); - var m4 = m3.set('c', 'Canary'); - var m5 = m4.remove('b'); + const m1 = Map(); + const m2 = m1.set('a', 'Aardvark'); + const m3 = m2.set('b', 'Baboon'); + const m4 = m3.set('c', 'Canary'); + const m5 = m4.remove('b'); expect(m1.size).toBe(0); expect(m2.size).toBe(1); expect(m3.size).toBe(2); @@ -165,31 +196,38 @@ describe('Map', () => { expect(m5.get('c')).toBe('Canary'); }); - check.it('deletes down to empty map', [gen.posInt], size => { - var m = Range(0, size).toMap(); - expect(m.size).toBe(size); - for (var ii = size - 1; ii >= 0; ii--) { - m = m.remove(ii); - expect(m.size).toBe(ii); - } - expect(m).toBe(Map()); + it('deletes down to empty map', () => { + fc.assert( + fc.property(fc.nat(100), (size) => { + let m = Range(0, size).toMap(); + expect(m.size).toBe(size); + for (let ii = size - 1; ii >= 0; ii--) { + m = m.remove(ii); + expect(m.size).toBe(ii); + } + expect(m).toBe(Map()); + }) + ); }); it('can map many items', () => { - var m = Map(); - for (var ii = 0; ii < 2000; ii++) { - m = m.set('thing:' + ii, ii); + let m = Map(); + for (let ii = 0; ii < 2000; ii++) { + m = m.set('thing:' + ii, ii); } expect(m.size).toBe(2000); expect(m.get('thing:1234')).toBe(1234); }); it('can use weird keys', () => { - var m: Map = Map() + const symbol = Symbol('A'); + const m = Map() .set(NaN, 1) .set(Infinity, 2) + .set(symbol, 'A') .set(-Infinity, 3); + expect(m.get(symbol)).toBe('A'); expect(m.get(NaN)).toBe(1); expect(m.get(Infinity)).toBe(2); expect(m.get(-Infinity)).toBe(3); @@ -197,8 +235,8 @@ describe('Map', () => { it('can map items known to hash collide', () => { // make a big map, so it hashmaps - var m: Map = Range(0, 32).toMap(); - var m = m.set('AAA', 'letters').set(64545, 'numbers'); + let m: Map = Range(0, 32).toMap(); + m = m.set('AAA', 'letters').set(64545, 'numbers'); expect(m.size).toBe(34); expect(m.get('AAA')).toEqual('letters'); expect(m.get(64545)).toEqual('numbers'); @@ -206,7 +244,7 @@ describe('Map', () => { it('can progressively add items known to collide', () => { // make a big map, so it hashmaps - var map: Map = Range(0, 32).toMap(); + let map: Map = Range(0, 32).toMap(); map = map.set('@', '@'); map = map.set(64, 64); map = map.set(96, 96); @@ -217,43 +255,76 @@ describe('Map', () => { }); it('maps values', () => { - var m = Map({a:'a', b:'b', c:'c'}); - var r = m.map(value => value.toUpperCase()); - expect(r.toObject()).toEqual({a:'A', b:'B', c:'C'}); + const m = Map({ a: 'a', b: 'b', c: 'c' }); + const r = m.map((value) => value.toUpperCase()); + expect(r.toObject()).toEqual({ a: 'A', b: 'B', c: 'C' }); }); it('maps keys', () => { - var m = Map({a:'a', b:'b', c:'c'}); - var r = m.mapKeys(key => key.toUpperCase()); - expect(r.toObject()).toEqual({A:'a', B:'b', C:'c'}); + const m = Map({ a: 'a', b: 'b', c: 'c' }); + const r = m.mapKeys((key) => key.toUpperCase()); + expect(r.toObject()).toEqual({ A: 'a', B: 'b', C: 'c' }); + }); + + it('maps no-ops return the same reference', () => { + const m = Map({ a: 'a', b: 'b', c: 'c' }); + const r = m.map((value) => value); + expect(r).toBe(m); + }); + + it('provides unmodified original collection as 3rd iter argument', () => { + const m = Map({ a: 1, b: 1 }); + const r = m.map((value, key, iter) => { + expect(iter).toEqual(m); + return 2 * (iter.get(key) as number); + }); + expect(r.toObject()).toEqual({ a: 2, b: 2 }); }); it('filters values', () => { - var m = Map({a:1, b:2, c:3, d:4, e:5, f:6}); - var r = m.filter(value => value % 2 === 1); - expect(r.toObject()).toEqual({a:1, c:3, e:5}); + const m = Map({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }); + const r = m.filter((value) => value % 2 === 1); + expect(r.toObject()).toEqual({ a: 1, c: 3, e: 5 }); }); it('filterNots values', () => { - var m = Map({a:1, b:2, c:3, d:4, e:5, f:6}); - var r = m.filterNot(value => value % 2 === 1); - expect(r.toObject()).toEqual({b:2, d:4, f:6}); + const m = Map({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }); + const r = m.filterNot((value) => value % 2 === 1); + expect(r.toObject()).toEqual({ b: 2, d: 4, f: 6 }); + }); + + it('partitions values', () => { + const m = Map({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }); + const r = m + .partition((value) => value % 2 === 1) + .map((part) => part.toObject()); + expect(r).toEqual([ + { b: 2, d: 4, f: 6 }, + { a: 1, c: 3, e: 5 }, + ]); }); it('derives keys', () => { - var v = Map({a:1, b:2, c:3, d:4, e:5, f:6}); + const v = Map({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }); expect(v.keySeq().toArray()).toEqual(['a', 'b', 'c', 'd', 'e', 'f']); }); it('flips keys and values', () => { - var v = Map({a:1, b:2, c:3, d:4, e:5, f:6}); - expect(v.flip().toObject()).toEqual({1:'a', 2:'b', 3:'c', 4:'d', 5:'e', 6:'f'}); + const v = Map({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }); + expect(v.flip().toObject()).toEqual({ + 1: 'a', + 2: 'b', + 3: 'c', + 4: 'd', + 5: 'e', + 6: 'f', + }); }); it('can convert to a list', () => { - var m = Map({a:1, b:2, c:3}); - var v = m.toList(); - var k = m.keySeq().toList(); + const m = Map({ a: 1, b: 2, c: 3 }); + const v = m.toList(); + const k = m.keySeq().toList(); expect(v.size).toBe(3); expect(k.size).toBe(3); // Note: Map has undefined ordering, this List may not be the same @@ -262,113 +333,261 @@ describe('Map', () => { expect(k.get(1)).toBe('b'); }); - check.it('works like an object', {maxSize: 50}, [gen.object(gen.JSONPrimitive)], obj => { - var map = Map(obj); - Object.keys(obj).forEach(key => { - expect(map.get(key)).toBe(obj[key]); - expect(map.has(key)).toBe(true); - }); - Object.keys(obj).forEach(key => { - expect(map.get(key)).toBe(obj[key]); - expect(map.has(key)).toBe(true); - map = map.remove(key); - expect(map.get(key)).toBe(undefined); - expect(map.has(key)).toBe(false); - }); - }); - - check.it('sets', {maxSize: 5000}, [gen.posInt], len => { - var map = Map(); - for (var ii = 0; ii < len; ii++) { - expect(map.size).toBe(ii); - map = map.set(''+ii, ii); - } - expect(map.size).toBe(len); - expect(is(map.toSet(), Range(0, len).toSet())).toBe(true); - }); - - check.it('has and get', {maxSize: 5000}, [gen.posInt], len => { - var map = Range(0, len).toKeyedSeq().mapKeys(x => ''+x).toMap(); - for (var ii = 0; ii < len; ii++) { - expect(map.get(''+ii)).toBe(ii); - expect(map.has(''+ii)).toBe(true); - } - }); - - check.it('deletes', {maxSize: 5000}, [gen.posInt], len => { - var map = Range(0, len).toMap(); - for (var ii = 0; ii < len; ii++) { - expect(map.size).toBe(len - ii); - map = map.remove(ii); - } - expect(map.size).toBe(0); - expect(map.toObject()).toEqual({}); - }); - - check.it('deletes from transient', {maxSize: 5000}, [gen.posInt], len => { - var map = Range(0, len).toMap().asMutable(); - for (var ii = 0; ii < len; ii++) { - expect(map.size).toBe(len - ii); - map.remove(ii); - } - expect(map.size).toBe(0); - expect(map.toObject()).toEqual({}); - }); - - check.it('iterates through all entries', [gen.posInt], len => { - var v = Range(0, len).toMap(); - var a = v.toArray(); - var iter = v.entries(); - for (var ii = 0; ii < len; ii++) { - delete a[ iter.next().value[0] ]; - } - expect(a).toEqual(new Array(len)); + it('works like an object', () => { + fc.assert( + fc.property(fc.object({ maxKeys: 50 }), (obj) => { + let map = Map(obj); + Object.keys(obj).forEach((key) => { + expect(map.get(key)).toBe(obj[key]); + expect(map.has(key)).toBe(true); + }); + Object.keys(obj).forEach((key) => { + expect(map.get(key)).toBe(obj[key]); + expect(map.has(key)).toBe(true); + map = map.remove(key); + expect(map.get(key)).toBe(undefined); + expect(map.has(key)).toBe(false); + }); + }) + ); + }); + + it('sets', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + let map = Map(); + for (let ii = 0; ii < len; ii++) { + expect(map.size).toBe(ii); + map = map.set('' + ii, ii); + } + expect(map.size).toBe(len); + expect(is(map.toSet(), Range(0, len).toSet())).toBe(true); + }) + ); + }); + + it('has and get', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + const map = Range(0, len) + .toKeyedSeq() + .mapKeys((x) => '' + x) + .toMap(); + for (let ii = 0; ii < len; ii++) { + expect(map.get('' + ii)).toBe(ii); + expect(map.has('' + ii)).toBe(true); + } + }) + ); + }); + + it('deletes', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + let map = Range(0, len).toMap(); + for (let ii = 0; ii < len; ii++) { + expect(map.size).toBe(len - ii); + map = map.remove(ii); + } + expect(map.size).toBe(0); + expect(map.toObject()).toEqual({}); + }) + ); + }); + + it('deletes from transient', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + const map = Range(0, len).toMap().asMutable(); + for (let ii = 0; ii < len; ii++) { + expect(map.size).toBe(len - ii); + map.remove(ii); + } + expect(map.size).toBe(0); + expect(map.toObject()).toEqual({}); + }) + ); + }); + + it('iterates through all entries', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + const v = Range(0, len).toMap(); + const a = v.toArray(); + const iter = v.entries(); + for (let ii = 0; ii < len; ii++) { + delete a[iter.next().value[0]]; + } + expect(a).toEqual(new Array(len)); + }) + ); }); it('allows chained mutations', () => { - var m1 = Map(); - var m2 = m1.set('a', 1); - var m3 = m2.withMutations(m => m.set('b', 2).set('c', 3)); - var m4 = m3.set('d', 4); + const m1 = Map(); + const m2 = m1.set('a', 1); + const m3 = m2.withMutations((m) => m.set('b', 2).set('c', 3)); + const m4 = m3.set('d', 4); expect(m1.toObject()).toEqual({}); - expect(m2.toObject()).toEqual({'a':1}); - expect(m3.toObject()).toEqual({'a': 1, 'b': 2, 'c': 3}); - expect(m4.toObject()).toEqual({'a': 1, 'b': 2, 'c': 3, 'd': 4}); + expect(m2.toObject()).toEqual({ a: 1 }); + expect(m3.toObject()).toEqual({ a: 1, b: 2, c: 3 }); + expect(m4.toObject()).toEqual({ a: 1, b: 2, c: 3, d: 4 }); + }); + + it('chained mutations does not result in new empty map instance', () => { + const v1 = Map<{ x?: number; y?: number }>({ x: 1 }); + const v2 = v1.withMutations((v) => v.set('y', 2).delete('x').delete('y')); + expect(v2).toBe(Map()); }); it('expresses value equality with unordered sequences', () => { - var m1 = Map({ A: 1, B: 2, C: 3 }); - var m2 = Map({ C: 3, B: 2, A: 1 }); + const m1 = Map({ A: 1, B: 2, C: 3 }); + const m2 = Map({ C: 3, B: 2, A: 1 }); expect(is(m1, m2)).toBe(true); }); + it('does not equal Record with same values', () => { + const m1 = Map({ A: 1, B: 2, C: 3 }); + const m2 = Record({ A: 1, B: 2, C: 3 }); + expect(is(m1, m2)).toBe(false); + }); + it('deletes all the provided keys', () => { - var NOT_SET = undefined; - var m1 = Map({ A: 1, B: 2, C: 3 }); - var m2 = m1.deleteAll(["A", "B"]); - expect(m2.get("A")).toBe(NOT_SET); - expect(m2.get("B")).toBe(NOT_SET); - expect(m2.get("C")).toBe(3); + const NOT_SET = undefined; + const m1 = Map({ A: 1, B: 2, C: 3 }); + const m2 = m1.deleteAll(['A', 'B']); + expect(m2.get('A')).toBe(NOT_SET); + expect(m2.get('B')).toBe(NOT_SET); + expect(m2.get('C')).toBe(3); expect(m2.size).toBe(1); }); it('remains unchanged when no keys are provided', () => { - var m1 = Map({ A: 1, B: 2, C: 3 }); - var m2 = m1.deleteAll([]); + const m1 = Map({ A: 1, B: 2, C: 3 }); + const m2 = m1.deleteAll([]); expect(m1).toBe(m2); }); it('uses toString on keys and values', () => { - class A extends Record({x: null}) { + class A extends Record({ x: null as number | null }) { toString() { return this.x; } } - let r = new A({x: 2}); - let map = Map([[r, r]]); + const r = new A({ x: 2 }); + const map = Map([[r, r]]); expect(map.toString()).toEqual('Map { 2: 2 }'); - }) + }); + + it('supports Symbols as tuple keys', () => { + const a = Symbol('a'); + const b = Symbol('b'); + const c = Symbol('c'); + const m = Map([ + [a, 'a'], + [b, 'b'], + [c, 'c'], + ]); + expect(m.size).toBe(3); + expect(m.get(a)).toBe('a'); + expect(m.get(b)).toBe('b'); + expect(m.get(c)).toBe('c'); + }); + + it('supports Symbols as object constructor keys', () => { + const a = Symbol.for('a'); + const b = Symbol('b'); + const c = Symbol('c'); + const m = Map({ + [a]: 'a', + [b]: 'b', + [c]: 'c', + }); + expect(m.size).toBe(3); + expect(m.get(a)).toBe('a'); + expect(m.get(b)).toBe('b'); + expect(m.get(c)).toBe('c'); + + const m2 = fromJS({ [a]: 'a' }) as Map; + expect(m2.size).toBe(1); + expect(m2.get(a)).toBe('a'); + }); + it('Symbol keys are unique', () => { + const a = Symbol('FooBar'); + const b = Symbol('FooBar'); + const m = Map([ + [a, 'FizBuz'], + [b, 'FooBar'], + ]); + expect(m.size).toBe(2); + expect(m.get(a)).toBe('FizBuz'); + expect(m.get(b)).toBe('FooBar'); + }); + + it('mergeDeep with tuple Symbol keys', () => { + const a = Symbol('a'); + const b = Symbol('b'); + const c = Symbol('c'); + const d = Symbol('d'); + const e = Symbol('e'); + const f = Symbol('f'); + const g = Symbol('g'); + + // Note the use of nested Map constructors, Map() does not do a + // deep conversion! + const m1 = Map([ + [ + a, + Map([ + [ + b, + Map([ + [c, 1], + [d, 2], + ]), + ], + ]), + ], + ]); + const m2 = Map([ + [ + a, + Map([ + [ + b, + Map([ + [c, 10], + [e, 20], + [f, 30], + [g, 40], + ]), + ], + ]), + ], + ]); + const merged = m1.mergeDeep(m2); + + expect(merged).toEqual( + Map([ + [ + a, + Map([ + [ + b, + Map([ + [c, 10], + [d, 2], + [e, 20], + [f, 30], + [g, 40], + ]), + ], + ]), + ], + ]) + ); + }); }); diff --git a/__tests__/MultiRequire.js b/__tests__/MultiRequire.js index 39c302738d..17c3de9472 100644 --- a/__tests__/MultiRequire.js +++ b/__tests__/MultiRequire.js @@ -1,31 +1,40 @@ -var Immutable1 = require('../'); -jest.resetModuleRegistry(); -var Immutable2 = require('../'); +import { describe, expect, it, jest } from '@jest/globals'; +import * as Immutable1 from '../src/Immutable'; -describe('MultiRequire', () => { +jest.resetModules(); + +const Immutable2 = jest.requireActual('../src/Immutable'); +describe('MultiRequire', () => { it('might require two different instances of Immutable', () => { expect(Immutable1).not.toBe(Immutable2); - expect(Immutable1.Map({a: 1}).toJS()).toEqual({a: 1}); - expect(Immutable2.Map({a: 1}).toJS()).toEqual({a: 1}); + expect(Immutable1.Map({ a: 1 }).toJS()).toEqual({ a: 1 }); + expect(Immutable2.Map({ a: 1 }).toJS()).toEqual({ a: 1 }); }); it('detects sequences', () => { - var x = Immutable1.Map({a: 1}); - var y = Immutable2.Map({a: 1}); - expect(Immutable1.Iterable.isIterable(y)).toBe(true); - expect(Immutable2.Iterable.isIterable(x)).toBe(true); + const x = Immutable1.Map({ a: 1 }); + const y = Immutable2.Map({ a: 1 }); + expect(Immutable1.isCollection(y)).toBe(true); + expect(Immutable2.isCollection(x)).toBe(true); + }); + + it('detects records', () => { + const R1 = Immutable1.Record({ a: 1 }); + const R2 = Immutable2.Record({ a: 1 }); + expect(Immutable1.Record.isRecord(R2())).toBe(true); + expect(Immutable2.Record.isRecord(R1())).toBe(true); }); it('converts to JS when inter-nested', () => { - var deep = Immutable1.Map({ + const deep = Immutable1.Map({ a: 1, b: 2, c: Immutable2.Map({ x: 3, y: 4, - z: Immutable1.Map() - }) + z: Immutable1.Map(), + }), }); expect(deep.toJS()).toEqual({ @@ -34,55 +43,50 @@ describe('MultiRequire', () => { c: { x: 3, y: 4, - z: {} - } + z: {}, + }, }); }); it('compares for equality', () => { - var x = Immutable1.Map({a: 1}); - var y = Immutable2.Map({a: 1}); + const x = Immutable1.Map({ a: 1 }); + const y = Immutable2.Map({ a: 1 }); expect(Immutable1.is(x, y)).toBe(true); expect(Immutable2.is(x, y)).toBe(true); }); it('flattens nested values', () => { - var nested = Immutable1.List( - Immutable2.List( - Immutable1.List( - Immutable2.List.of(1, 2) - ) - ) + const nested = Immutable1.List( + Immutable2.List(Immutable1.List(Immutable2.List.of(1, 2))) ); - expect(nested.flatten().toJS()).toEqual([1,2]); + expect(nested.flatten().toJS()).toEqual([1, 2]); }); it('detects types', () => { - var c1 = Immutable1.Map(); - var c2 = Immutable2.Map(); + let c1 = Immutable1.Map(); + let c2 = Immutable2.Map(); expect(Immutable1.Map.isMap(c2)).toBe(true); expect(Immutable2.Map.isMap(c1)).toBe(true); - var c1 = Immutable1.OrderedMap(); - var c2 = Immutable2.OrderedMap(); + c1 = Immutable1.OrderedMap(); + c2 = Immutable2.OrderedMap(); expect(Immutable1.OrderedMap.isOrderedMap(c2)).toBe(true); expect(Immutable2.OrderedMap.isOrderedMap(c1)).toBe(true); - var c1 = Immutable1.List(); - var c2 = Immutable2.List(); + c1 = Immutable1.List(); + c2 = Immutable2.List(); expect(Immutable1.List.isList(c2)).toBe(true); expect(Immutable2.List.isList(c1)).toBe(true); - var c1 = Immutable1.Stack(); - var c2 = Immutable2.Stack(); + c1 = Immutable1.Stack(); + c2 = Immutable2.Stack(); expect(Immutable1.Stack.isStack(c2)).toBe(true); expect(Immutable2.Stack.isStack(c1)).toBe(true); - var c1 = Immutable1.Set(); - var c2 = Immutable2.Set(); + c1 = Immutable1.Set(); + c2 = Immutable2.Set(); expect(Immutable1.Set.isSet(c2)).toBe(true); expect(Immutable2.Set.isSet(c1)).toBe(true); }); - }); diff --git a/__tests__/ObjectSeq.ts b/__tests__/ObjectSeq.ts index 83b12777dd..2b10807cb5 100644 --- a/__tests__/ObjectSeq.ts +++ b/__tests__/ObjectSeq.ts @@ -1,43 +1,49 @@ -/// - -import { Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Seq } from 'immutable'; describe('ObjectSequence', () => { - it('maps', () => { - var i = Seq({'a': 'A', 'b': 'B', 'c': 'C'}); - var m = i.map(x => x + x).toObject(); - expect(m).toEqual({'a': 'AA', 'b': 'BB', 'c': 'CC'}); + const i = Seq({ a: 'A', b: 'B', c: 'C' }); + const m = i.map((x) => x + x).toObject(); + expect(m).toEqual({ a: 'AA', b: 'BB', c: 'CC' }); }); it('reduces', () => { - var i = Seq({'a': 'A', 'b': 'B', 'c': 'C'}); - var r = i.reduce((r, x) => r + x, ''); + const i = Seq({ a: 'A', b: 'B', c: 'C' }); + const r = i.reduce((acc, x) => acc + x, ''); expect(r).toEqual('ABC'); }); it('extracts keys', () => { - var i = Seq({'a': 'A', 'b': 'B', 'c': 'C'}); - var k = i.keySeq().toArray(); + const i = Seq({ a: 'A', b: 'B', c: 'C' }); + const k = i.keySeq().toArray(); expect(k).toEqual(['a', 'b', 'c']); }); it('is reversable', () => { - var i = Seq({'a': 'A', 'b': 'B', 'c': 'C'}); - var k = i.reverse().toArray(); - expect(k).toEqual(['C', 'B', 'A']); + const i = Seq({ a: 'A', b: 'B', c: 'C' }); + const k = i.reverse().toArray(); + expect(k).toEqual([ + ['c', 'C'], + ['b', 'B'], + ['a', 'A'], + ]); }); - it('can double reversable', () => { - var i = Seq({'a': 'A', 'b': 'B', 'c': 'C'}); - var k = i.reverse().reverse().toArray(); - expect(k).toEqual(['A', 'B', 'C']); + it('is double reversable', () => { + const i = Seq({ a: 'A', b: 'B', c: 'C' }); + const k = i.reverse().reverse().toArray(); + expect(k).toEqual([ + ['a', 'A'], + ['b', 'B'], + ['c', 'C'], + ]); }); it('can be iterated', () => { - var obj = { a: 1, b: 2, c: 3 }; - var seq = Seq(obj); - var entries = seq.entries(); + const obj = { a: 1, b: 2, c: 3 }; + const seq = Seq(obj); + const entries = seq.entries(); expect(entries.next()).toEqual({ value: ['a', 1], done: false }); expect(entries.next()).toEqual({ value: ['b', 2], done: false }); expect(entries.next()).toEqual({ value: ['c', 3], done: false }); @@ -45,11 +51,11 @@ describe('ObjectSequence', () => { }); it('cannot be mutated after calling toObject', () => { - var seq = Seq({ a: 1, b: 2, c: 3 }); + const seq = Seq({ a: 1, b: 2, c: 3 }); - var obj = seq.toObject(); - obj['c'] = 10; - var seq2 = Seq(obj); + const obj = seq.toObject(); + obj.c = 10; + const seq2 = Seq(obj); expect(seq.get('c')).toEqual(3); expect(seq2.get('c')).toEqual(10); diff --git a/__tests__/OrderedMap.ts b/__tests__/OrderedMap.ts index f086ae4d49..9c06a6582e 100644 --- a/__tests__/OrderedMap.ts +++ b/__tests__/OrderedMap.ts @@ -1,68 +1,88 @@ -/// - -import { OrderedMap, Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { OrderedMap, Range, Seq } from 'immutable'; describe('OrderedMap', () => { - it('converts from object', () => { - var m = OrderedMap({'c': 'C', 'b': 'B', 'a': 'A'}); + const m = OrderedMap({ c: 'C', b: 'B', a: 'A' }); expect(m.get('a')).toBe('A'); expect(m.get('b')).toBe('B'); expect(m.get('c')).toBe('C'); - expect(m.toArray()).toEqual(['C','B','A']); + expect(m.toArray()).toEqual([ + ['c', 'C'], + ['b', 'B'], + ['a', 'A'], + ]); }); it('constructor provides initial values', () => { - var m = OrderedMap({'a': 'A', 'b': 'B', 'c': 'C'}); + const m = OrderedMap({ a: 'A', b: 'B', c: 'C' }); expect(m.get('a')).toBe('A'); expect(m.get('b')).toBe('B'); expect(m.get('c')).toBe('C'); expect(m.size).toBe(3); - expect(m.toArray()).toEqual(['A','B','C']); + expect(m.toArray()).toEqual([ + ['a', 'A'], + ['b', 'B'], + ['c', 'C'], + ]); }); it('provides initial values in a mixed order', () => { - var m = OrderedMap({'c': 'C', 'b': 'B', 'a': 'A'}); + const m = OrderedMap({ c: 'C', b: 'B', a: 'A' }); expect(m.get('a')).toBe('A'); expect(m.get('b')).toBe('B'); expect(m.get('c')).toBe('C'); expect(m.size).toBe(3); - expect(m.toArray()).toEqual(['C','B','A']); + expect(m.toArray()).toEqual([ + ['c', 'C'], + ['b', 'B'], + ['a', 'A'], + ]); }); it('constructor accepts sequences', () => { - var s = Seq({'c': 'C', 'b': 'B', 'a': 'A'}); - var m = OrderedMap(s); + const s = Seq({ c: 'C', b: 'B', a: 'A' }); + const m = OrderedMap(s); expect(m.get('a')).toBe('A'); expect(m.get('b')).toBe('B'); expect(m.get('c')).toBe('C'); expect(m.size).toBe(3); - expect(m.toArray()).toEqual(['C','B','A']); + expect(m.toArray()).toEqual([ + ['c', 'C'], + ['b', 'B'], + ['a', 'A'], + ]); }); it('maintains order when new keys are set', () => { - var m = OrderedMap() + const m = OrderedMap() .set('A', 'aardvark') .set('Z', 'zebra') .set('A', 'antelope'); expect(m.size).toBe(2); - expect(m.toArray()).toEqual(['antelope', 'zebra']); + expect(m.toArray()).toEqual([ + ['A', 'antelope'], + ['Z', 'zebra'], + ]); }); it('resets order when a keys is deleted', () => { - var m = OrderedMap() + const m = OrderedMap() .set('A', 'aardvark') .set('Z', 'zebra') .remove('A') .set('A', 'antelope'); expect(m.size).toBe(2); - expect(m.toArray()).toEqual(['zebra', 'antelope']); + expect(m.toArray()).toEqual([ + ['Z', 'zebra'], + ['A', 'antelope'], + ]); }); it('removes correctly', () => { - var m = OrderedMap({ - 'A': 'aardvark', - 'Z': 'zebra' + const m = OrderedMap({ + A: 'aardvark', + Z: 'zebra', }).remove('A'); expect(m.size).toBe(1); expect(m.get('A')).toBe(undefined); @@ -70,21 +90,53 @@ describe('OrderedMap', () => { }); it('respects order for equality', () => { - var m1 = OrderedMap().set('A', 'aardvark').set('Z', 'zebra'); - var m2 = OrderedMap().set('Z', 'zebra').set('A', 'aardvark'); + const m1 = OrderedMap().set('A', 'aardvark').set('Z', 'zebra'); + const m2 = OrderedMap().set('Z', 'zebra').set('A', 'aardvark'); expect(m1.equals(m2)).toBe(false); expect(m1.equals(m2.reverse())).toBe(true); }); it('respects order when merging', () => { - var m1 = OrderedMap({A: 'apple', B: 'banana', C: 'coconut'}); - var m2 = OrderedMap({C: 'chocolate', B: 'butter', D: 'donut'}); - expect(m1.merge(m2).entrySeq().toArray()).toEqual( - [['A','apple'],['B','butter'],['C','chocolate'],['D','donut']] - ); - expect(m2.merge(m1).entrySeq().toArray()).toEqual( - [['C','coconut'],['B','banana'],['D','donut'],['A','apple']] - ); + const m1 = OrderedMap({ A: 'apple', B: 'banana', C: 'coconut' }); + const m2 = OrderedMap({ C: 'chocolate', B: 'butter', D: 'donut' }); + expect(m1.merge(m2).entrySeq().toArray()).toEqual([ + ['A', 'apple'], + ['B', 'butter'], + ['C', 'chocolate'], + ['D', 'donut'], + ]); + expect(m2.merge(m1).entrySeq().toArray()).toEqual([ + ['C', 'coconut'], + ['B', 'banana'], + ['D', 'donut'], + ['A', 'apple'], + ]); + }); + + it('performs deleteAll correctly after resizing internal list', () => { + // See condition for resizing internal list here: + // https://github.com/immutable-js/immutable-js/blob/91c7c1e82ec616804768f968cc585565e855c8fd/src/OrderedMap.js#L138 + + // Create OrderedMap greater than or equal to SIZE (currently 32) + const SIZE = 32; + let map = OrderedMap(Range(0, SIZE).map((key) => [key, 0])); + + // Delete half of the keys so that internal list is twice the size of internal map + const keysToDelete = Range(0, SIZE / 2); + map = map.deleteAll(keysToDelete); + + // Delete one more key to trigger resizing + map = map.deleteAll([SIZE / 2]); + + expect(map.size).toBe(SIZE / 2 - 1); }); + it('hashCode should return the same value if the values are the same', () => { + const m1 = OrderedMap({ b: 'b' }); + const m2 = OrderedMap({ a: 'a', b: 'b' }).remove('a'); + const m3 = OrderedMap({ b: 'b' }).remove('b').set('b', 'b'); + + expect(m1.hashCode()).toEqual(m2.hashCode()); + expect(m1.hashCode()).toEqual(m3.hashCode()); + }); }); diff --git a/__tests__/OrderedSet.ts b/__tests__/OrderedSet.ts index 313124d9ed..12c958072d 100644 --- a/__tests__/OrderedSet.ts +++ b/__tests__/OrderedSet.ts @@ -1,63 +1,153 @@ -/// - -import { OrderedSet } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { OrderedSet, Map } from 'immutable'; describe('OrderedSet', () => { - it('provides initial values in a mixed order', () => { - var s = OrderedSet.of('C', 'B', 'A'); + const s = OrderedSet.of('C', 'B', 'A'); expect(s.has('A')).toBe(true); expect(s.has('B')).toBe(true); expect(s.has('C')).toBe(true); expect(s.size).toBe(3); - expect(s.toArray()).toEqual(['C','B','A']); + expect(s.toArray()).toEqual(['C', 'B', 'A']); }); it('maintains order when new values are added', () => { - var s = OrderedSet() - .add('A') - .add('Z') - .add('A'); + const s = OrderedSet().add('A').add('Z').add('A'); expect(s.size).toBe(2); expect(s.toArray()).toEqual(['A', 'Z']); }); it('resets order when a value is deleted', () => { - var s = OrderedSet() - .add('A') - .add('Z') - .remove('A') - .add('A'); + const s = OrderedSet().add('A').add('Z').remove('A').add('A'); expect(s.size).toBe(2); expect(s.toArray()).toEqual(['Z', 'A']); }); it('removes correctly', () => { - var s = OrderedSet([ 'A', 'Z' ]).remove('A'); + const s = OrderedSet(['A', 'Z']).remove('A'); expect(s.size).toBe(1); expect(s.has('A')).toBe(false); expect(s.has('Z')).toBe(true); }); it('respects order for equality', () => { - var s1 = OrderedSet.of('A', 'Z') - var s2 = OrderedSet.of('Z', 'A') + const s1 = OrderedSet.of('A', 'Z'); + const s2 = OrderedSet.of('Z', 'A'); expect(s1.equals(s2)).toBe(false); expect(s1.equals(s2.reverse())).toBe(true); }); it('respects order when unioning', () => { - var s1 = OrderedSet.of('A', 'B', 'C'); - var s2 = OrderedSet.of('C', 'B', 'D'); - expect(s1.union(s2).toArray()).toEqual(['A','B','C','D']); - expect(s2.union(s1).toArray()).toEqual(['C','B','D','A']); + const s1 = OrderedSet.of('A', 'B', 'C'); + const s2 = OrderedSet.of('C', 'B', 'D'); + expect(s1.union(s2).toArray()).toEqual(['A', 'B', 'C', 'D']); + expect(s2.union(s1).toArray()).toEqual(['C', 'B', 'D', 'A']); }); it('can be zipped', () => { - var s1 = OrderedSet.of('A', 'B', 'C'); - var s2 = OrderedSet.of('C', 'B', 'D'); - expect(s1.zip(s2).toArray()).toEqual([['A','C'],['B','B'],['C','D']]); - expect(s1.zipWith((c1, c2) => c1 + c2, s2).toArray()).toEqual(['AC','BB','CD']); - }) + const s1 = OrderedSet.of('A', 'B', 'C'); + const s2 = OrderedSet.of('C', 'B', 'D'); + expect(s1.zip(s2).toArray()).toEqual([ + ['A', 'C'], + ['B', 'B'], + ['C', 'D'], + ]); + expect(s1.zipWith((c1, c2) => c1 + c2, s2).toArray()).toEqual([ + 'AC', + 'BB', + 'CD', + ]); + }); + + /** + * @see https://github.com/immutable-js/immutable-js/issues/1716 + */ + it('handles `subtract` when Set contains >=32 elements', () => { + const fillArray = (nb) => + Array(nb) + .fill(1) + .map((el, i) => i + 1); + + const capacity = 32; + // items from keys 0 to 31 and values 1 to 32 + const defaultItems = fillArray(capacity); + + const allItems = OrderedSet(defaultItems); + + const partialCapacity = Math.ceil(capacity / 2) + 1; + const someOfThem = fillArray(partialCapacity); + expect(someOfThem.length).toBe(17); + + const existingItems = OrderedSet(someOfThem).intersect(allItems); + + expect(allItems.subtract(existingItems).size).toBe(15); + expect(allItems.subtract(existingItems).size + someOfThem.length).toBe(32); + }); + + /** + * @see https://github.com/immutable-js/immutable-js/issues/1603 + */ + it('handles consecutive `subtract` invocations', () => { + let a = OrderedSet(); + let b = OrderedSet(); + let c; + let d; + // Set a to 0-45 + for (let i = 0; i < 46; i++) { + a = a.add(i); + } + // Set b to 0-24 + for (let i = 0; i < 25; i++) { + b = b.add(i); + } + // Set c to 0-23 + // eslint-disable-next-line prefer-const + c = b.butLast(); + + // Set d to 0-22 + // eslint-disable-next-line prefer-const + d = c.butLast(); + // Internal list resizing happens on the final `subtract` when subtracting d from a + const aNotB = a.subtract(b); + const aNotC = a.subtract(c); + const aNotD = a.subtract(d); + + expect(aNotB.size).toBe(21); + expect(aNotC.size).toBe(22); + expect(aNotD.size).toBe(23); + }); + + it('keeps the Set ordered when updating a value with .map()', () => { + const first = Map({ id: 1, valid: true }); + const second = Map({ id: 2, valid: true }); + const third = Map({ id: 3, valid: true }); + const initial = OrderedSet([first, second, third]); + + const out = initial.map((t) => { + if (t.get('id') === 2) { + return t.set('valid', false); + } + return t; + }); + + const expected = OrderedSet([ + Map({ id: 1, valid: true }), + Map({ id: 2, valid: false }), + Map({ id: 3, valid: true }), + ]); + + expect(out).toEqual(expected); + + expect(out.has(first)).toBe(true); + expect(out.has(second)).toBe(false); + expect(out.has(third)).toBe(true); + }); + + it('hashCode should return the same value if the values are the same', () => { + const set1 = OrderedSet(['hello']); + const set2 = OrderedSet(['goodbye', 'hello']).remove('goodbye'); + + expect(set1.hashCode()).toBe(set2.hashCode()); + }); }); diff --git a/__tests__/Predicates.ts b/__tests__/Predicates.ts new file mode 100644 index 0000000000..0ab282205b --- /dev/null +++ b/__tests__/Predicates.ts @@ -0,0 +1,61 @@ +import { describe, expect, it } from '@jest/globals'; +import { + is, + isImmutable, + isValueObject, + List, + Map, + Set, + Stack, +} from 'immutable'; + +describe('isImmutable', () => { + it('behaves as advertised', () => { + expect(isImmutable([])).toBe(false); + expect(isImmutable({})).toBe(false); + expect(isImmutable(Map())).toBe(true); + expect(isImmutable(List())).toBe(true); + expect(isImmutable(Set())).toBe(true); + expect(isImmutable(Stack())).toBe(true); + expect(isImmutable(Map().asMutable())).toBe(true); + }); +}); + +describe('isValueObject', () => { + it('behaves as advertised', () => { + expect(isValueObject(null)).toBe(false); + expect(isValueObject(123)).toBe(false); + expect(isValueObject('abc')).toBe(false); + expect(isValueObject([])).toBe(false); + expect(isValueObject({})).toBe(false); + expect(isValueObject(Map())).toBe(true); + expect(isValueObject(List())).toBe(true); + expect(isValueObject(Set())).toBe(true); + expect(isValueObject(Stack())).toBe(true); + expect(isValueObject(Map().asMutable())).toBe(true); + }); + + it('works on custom types', () => { + class MyValueType { + v: number; + + constructor(val: number) { + this.v = val; + } + + equals(other) { + return Boolean(other && this.v === other.v); + } + + hashCode() { + return this.v; + } + } + + expect(isValueObject(new MyValueType(123))).toBe(true); + expect(is(new MyValueType(123), new MyValueType(123))).toBe(true); + expect(Set().add(new MyValueType(123)).add(new MyValueType(123)).size).toBe( + 1 + ); + }); +}); diff --git a/__tests__/Range.ts b/__tests__/Range.ts index 262683a65a..94c096d1a8 100644 --- a/__tests__/Range.ts +++ b/__tests__/Range.ts @@ -1,55 +1,68 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Range } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Range } from 'immutable'; +import fc from 'fast-check'; describe('Range', () => { - it('fixed range', () => { - var v = Range(0, 3); + const v = Range(0, 3); expect(v.size).toBe(3); expect(v.first()).toBe(0); - expect(v.rest().toArray()).toEqual([1,2]); + expect(v.rest().toArray()).toEqual([1, 2]); expect(v.last()).toBe(2); - expect(v.butLast().toArray()).toEqual([0,1]); - expect(v.toArray()).toEqual([0,1,2]); + expect(v.butLast().toArray()).toEqual([0, 1]); + expect(v.toArray()).toEqual([0, 1, 2]); }); it('stepped range', () => { - var v = Range(1, 10, 3); + const v = Range(1, 10, 3); expect(v.size).toBe(3); expect(v.first()).toBe(1); - expect(v.rest().toArray()).toEqual([4,7]); + expect(v.rest().toArray()).toEqual([4, 7]); expect(v.last()).toBe(7); - expect(v.butLast().toArray()).toEqual([1,4]); - expect(v.toArray()).toEqual([1,4,7]); + expect(v.butLast().toArray()).toEqual([1, 4]); + expect(v.toArray()).toEqual([1, 4, 7]); + }); + + it('range should contain start and end values', () => { + // @ts-expect-error -- test that runtime error is thrown + expect(() => Range()).toThrow( + 'You must define a start value when using Range' + ); + // @ts-expect-error -- test that runtime error is thrown + expect(() => Range(1)).toThrow( + 'You must define an end value when using Range' + ); }); it('open range', () => { - var v = Range(10); + const v = Range(10, Infinity); expect(v.size).toBe(Infinity); expect(v.first()).toBe(10); expect(v.rest().first()).toBe(11); expect(v.last()).toBe(Infinity); expect(v.butLast().first()).toBe(10); expect(v.butLast().last()).toBe(Infinity); - expect(() => v.rest().toArray()).toThrow('Cannot perform this action with an infinite size.'); - expect(() => v.butLast().toArray()).toThrow('Cannot perform this action with an infinite size.'); - expect(() => v.toArray()).toThrow('Cannot perform this action with an infinite size.'); + expect(() => v.rest().toArray()).toThrow( + 'Cannot perform this action with an infinite size.' + ); + expect(() => v.butLast().toArray()).toThrow( + 'Cannot perform this action with an infinite size.' + ); + expect(() => v.toArray()).toThrow( + 'Cannot perform this action with an infinite size.' + ); }); it('backwards range', () => { - var v = Range(10, 1, 3); + const v = Range(10, 1, 3); expect(v.size).toBe(3); expect(v.first()).toBe(10); expect(v.last()).toBe(4); - expect(v.toArray()).toEqual([10,7,4]); + expect(v.toArray()).toEqual([10, 7, 4]); }); it('empty range', () => { - var v = Range(10, 10); + const v = Range(10, 10); expect(v.size).toBe(0); expect(v.first()).toBe(undefined); expect(v.rest().toArray()).toEqual([]); @@ -58,127 +71,162 @@ describe('Range', () => { expect(v.toArray()).toEqual([]); }); - check.it('includes first, excludes last', [gen.int, gen.int], function (from, to) { - var isIncreasing = to >= from; - var size = isIncreasing ? to - from : from - to; - var r = Range(from, to); - var a = r.toArray(); - expect(r.size).toBe(size); - expect(a.length).toBe(size); - expect(r.get(0)).toBe(size ? from : undefined); - expect(a[0]).toBe(size ? from : undefined); - var last = to + (isIncreasing ? -1 : 1); - expect(r.last()).toBe(size ? last : undefined); - if (size) { - expect(a[a.length - 1]).toBe(last); - } - }); - - var shrinkInt = gen.shrink(gen.int); - - check.it('slices the same as array slices', - [shrinkInt, shrinkInt, shrinkInt, shrinkInt], - function (from, to, begin, end) { - var r = Range(from, to); - var a = r.toArray(); - expect(r.slice(begin, end).toArray()).toEqual(a.slice(begin, end)); - } - ); + const shrinkInt = fc.integer({ min: -1000, max: 1000 }); + + it('includes first, excludes last', () => { + fc.assert( + fc.property(shrinkInt, shrinkInt, (from, to) => { + const isIncreasing = to >= from; + const size = isIncreasing ? to - from : from - to; + const r = Range(from, to); + const a = r.toArray(); + expect(r.size).toBe(size); + expect(a.length).toBe(size); + expect(r.get(0)).toBe(size ? from : undefined); + expect(a[0]).toBe(size ? from : undefined); + const last = to + (isIncreasing ? -1 : 1); + expect(r.last()).toBe(size ? last : undefined); + if (size) { + // eslint-disable-next-line jest/no-conditional-expect + expect(a[a.length - 1]).toBe(last); + } + }) + ); + }); + + it('slices the same as array slices', () => { + fc.assert( + fc.property( + shrinkInt, + shrinkInt, + shrinkInt, + shrinkInt, + (from, to, begin, end) => { + const r = Range(from, to); + const a = r.toArray(); + expect(r.slice(begin, end).toArray()).toEqual(a.slice(begin, end)); + } + ) + ); + }); it('slices range', () => { - var v = Range(1, 11, 2); - var s = v.slice(1, -2); + const v = Range(1, 11, 2); + const s = v.slice(1, -2); expect(s.size).toBe(2); - expect(s.toArray()).toEqual([3,5]); + expect(s.toArray()).toEqual([3, 5]); }); it('empty slice of range', () => { - var v = Range(1, 11, 2); - var s = v.slice(100, 200); + const v = Range(1, 11, 2); + const s = v.slice(100, 200); expect(s.size).toBe(0); expect(s.toArray()).toEqual([]); }); it('slices empty range', () => { - var v = Range(10, 10); - var s = v.slice(1, -2); + const v = Range(10, 10); + const s = v.slice(1, -2); expect(s.size).toBe(0); expect(s.toArray()).toEqual([]); }); it('stepped range does not land on end', () => { - var v = Range(0, 7, 2); + const v = Range(0, 7, 2); expect(v.size).toBe(4); - expect(v.toArray()).toEqual([0,2,4,6]); + expect(v.toArray()).toEqual([0, 2, 4, 6]); }); it('can be float', () => { - var v = Range(0.5, 2.5, 0.5); + const v = Range(0.5, 2.5, 0.5); expect(v.size).toBe(4); expect(v.toArray()).toEqual([0.5, 1, 1.5, 2]); }); it('can be negative', () => { - var v = Range(10, -10, 5); + const v = Range(10, -10, 5); expect(v.size).toBe(4); - expect(v.toArray()).toEqual([10,5,0,-5]); + expect(v.toArray()).toEqual([10, 5, 0, -5]); }); it('can get from any index in O(1)', () => { - var v = Range(0, Infinity, 8); + const v = Range(0, Infinity, 8); expect(v.get(111)).toBe(888); }); it('can find an index in O(1)', () => { - var v = Range(0, Infinity, 8); + const v = Range(0, Infinity, 8); expect(v.indexOf(888)).toBe(111); }); it('maps values', () => { - var r = Range(0, 4).map(v => v * v); - expect(r.toArray()).toEqual([0,1,4,9]); + const r = Range(0, 4).map((v) => v * v); + expect(r.toArray()).toEqual([0, 1, 4, 9]); }); it('filters values', () => { - var r = Range(0, 10).filter(v => v % 2 == 0); - expect(r.toArray()).toEqual([0,2,4,6,8]); + const r = Range(0, 10).filter((v) => v % 2 === 0); + expect(r.toArray()).toEqual([0, 2, 4, 6, 8]); }); - it('reduces values', () => { - var v = Range(0, 10, 2); - - var r = v.reduce((a, b) => a + b, 0); + it('partitions values', () => { + const r = Range(0, 10) + .partition((v) => v % 2 === 0) + .map((part) => part.toArray()); + expect(r).toEqual([ + [1, 3, 5, 7, 9], + [0, 2, 4, 6, 8], + ]); + }); + it('reduces values', () => { + const v = Range(0, 10, 2); + const r = v.reduce((a, b) => a + b, 0); expect(r).toEqual(20); }); it('takes and skips values', () => { - var v = Range(0, 100, 3) - - var r = v.skip(2).take(2); - + const v = Range(0, 100, 3); + const r = v.skip(2).take(2); expect(r.toArray()).toEqual([6, 9]); }); it('can describe lazy operations', () => { expect( - Range(1, Infinity).map(n => -n).take(5).toArray() - ).toEqual( - [ -1, -2, -3, -4, -5 ] - ); + Range(1, Infinity) + .map((n) => -n) + .take(5) + .toArray() + ).toEqual([-1, -2, -3, -4, -5]); }); it('efficiently chains array methods', () => { - var v = Range(1, Infinity); - - var r = v - .filter(x => x % 2 == 0) + const v = Range(1, Infinity); + const r = v + .filter((x) => x % 2 === 0) .skip(2) - .map(x => x * x) + .map((x) => x * x) .take(3) .reduce((a, b) => a + b, 0); expect(r).toEqual(200); }); + it('sliced sequence works even on filtered sequence', () => { + expect(Range(0, 3).slice(-2).toArray()).toEqual([1, 2]); + + expect( + Range(0, 3) + .filter(() => true) + .slice(-2) + .toArray() + ).toEqual([1, 2]); + }); + + it('toString', () => { + expect(Range(0, 0).toString()).toBe('Range []'); + expect(Range(0, 3).toString()).toBe('Range [ 0...3 ]'); + expect(Range(0, 10, 2).toString()).toBe('Range [ 0...10 by 2 ]'); + expect(Range(10, 0, -2).toString()).toBe('Range [ 10...0 by -2 ]'); + }); }); diff --git a/__tests__/Record.ts b/__tests__/Record.ts index 727ea4b586..3839b6c46b 100644 --- a/__tests__/Record.ts +++ b/__tests__/Record.ts @@ -1,69 +1,59 @@ -/// - -import { Record, Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { isKeyed, List, Map, Record, Seq } from 'immutable'; describe('Record', () => { - it('defines a constructor', () => { - var MyType = Record({a:1, b:2, c:3}); + const MyType = Record({ a: 1, b: 2, c: 3 }); - var t1 = new MyType(); - var t2 = t1.set('a', 10); - var t3 = t2.clear(); + const t1 = MyType(); + const t2 = t1.set('a', 10); expect(t1 instanceof Record).toBe(true); expect(t1 instanceof MyType).toBe(true); - expect(t3 instanceof Record).toBe(true); - expect(t3 instanceof MyType).toBe(true); + expect(t2 instanceof Record).toBe(true); + expect(t2 instanceof MyType).toBe(true); expect(t1.get('a')).toBe(1); expect(t2.get('a')).toBe(10); - - expect(t1.size).toBe(3); - expect(t2.size).toBe(3); - }) + }); it('allows for a descriptive name', () => { - var Person = Record({name: null}, 'Person'); + const Person = Record({ name: null as string | null }, 'Person'); - var me = Person({ name: 'My Name' }) - expect(me.toString()).toEqual('Person { "name": "My Name" }'); + const me = Person({ name: 'My Name' }); + expect(me.toString()).toEqual('Person { name: "My Name" }'); expect(Record.getDescriptiveName(me)).toEqual('Person'); - }) + expect(Person.displayName).toBe('Person'); + }); it('passes through records of the same type', () => { - var P2 = Record({ x: 0, y: 0 }); - var P3 = Record({ x: 0, y: 0, z: 0 }); - var p2 = P2(); - var p3 = P3(); + const P2 = Record({ x: 0, y: 0 }); + const P3 = Record({ x: 0, y: 0, z: 0 }); + const p2 = P2(); + const p3 = P3(); expect(P3(p2) instanceof P3).toBe(true); expect(P2(p3) instanceof P2).toBe(true); expect(P2(p2)).toBe(p2); expect(P3(p3)).toBe(p3); - }) + }); it('setting an unknown key is a no-op', () => { - var MyType = Record({a:1, b:2, c:3}); + const MyType = Record({ a: 1, b: 2, c: 3 }); - var t1 = new MyType({a: 10, b:20}); - var t2 = t1.set('d' as any, 4); + const t1 = MyType({ a: 10, b: 20 }); + // @ts-expect-error -- try to force an unknown value + const t2 = t1.set('d', 4); expect(t2).toBe(t1); }); - it('has a fixed size and falls back to default values', () => { - var MyType = Record({a:1, b:2, c:3}); - - var t1 = new MyType({a: 10, b:20}); - var t2 = new MyType({b: 20}); - var t3 = t1.remove('a'); - var t4 = t3.clear(); - - expect(t1.size).toBe(3); - expect(t2.size).toBe(3); - expect(t3.size).toBe(3); - expect(t4.size).toBe(3); + it('falls back to default values when deleted or cleared', () => { + const MyType = Record({ a: 1, b: 2, c: 3 }); + const t1 = MyType({ a: 10, b: 20 }); + const t2 = MyType({ b: 20 }); + const t3 = t1.delete('a'); + const t4 = t3.clear(); expect(t1.get('a')).toBe(10); expect(t2.get('a')).toBe(1); @@ -72,117 +62,258 @@ describe('Record', () => { expect(t2.equals(t3)).toBe(true); expect(t2.equals(t4)).toBe(false); - expect(t4.equals(new MyType())).toBe(true); - }) + expect(t4.equals(MyType())).toBe(true); + }); + + it('allows deletion of values deep within a tree', () => { + const AType = Record({ a: 1 }); + const BType = Record({ b: AType({ a: 2 }) }); + const t1 = BType(); + const t2 = t1.deleteIn(['b', 'a']); + + expect(t1.get('b').get('a')).toBe(2); + expect(t2.get('b').get('a')).toBe(1); + }); + + it('is a value type and equals other similar Records', () => { + const MyType = Record({ a: 1, b: 2, c: 3 }); + const t1 = MyType({ a: 10 }); + const t2 = MyType({ a: 10, b: 2 }); + expect(t1.equals(t2)).toBe(true); + }); + + it('if compared against undefined or null should return false', () => { + const MyType = Record({ a: 1, b: 2 }); + const t1 = MyType(); + expect(t1.equals(undefined)).toBeFalsy(); + expect(t1.equals(null)).toBeFalsy(); + }); + + it('if compared against Map should return false', () => { + const MyType = Record({ a: 1, b: 2 }); + const t1 = MyType(); + expect(t1.equals(Map({ a: 1, b: 2 }))).toBeFalsy(); + }); it('merges in Objects and other Records', () => { - var Point2 = Record({x:0, y:0}); - var Point3 = Record({x:0, y:0, z:0}); + const Point2 = Record({ x: 0, y: 0 }); + const Point3 = Record({ x: 0, y: 0, z: 0 }); - var p2 = Point2({x:20, y:20}); - var p3 = Point3({x:10, y:10, z:10}); + const p2 = Point2({ x: 20, y: 20 }); + const p3 = Point3({ x: 10, y: 10, z: 10 }); - expect(p3.merge(p2).toObject()).toEqual({x:20, y:20, z:10}); + expect(p3.merge(p2).toObject()).toEqual({ x: 20, y: 20, z: 10 }); - expect(p2.merge({y: 30}).toObject()).toEqual({x:20, y:30}); - expect(p3.merge({y: 30, z: 30}).toObject()).toEqual({x:10, y:30, z:30}); - }) + expect(p2.merge({ y: 30 }).toObject()).toEqual({ x: 20, y: 30 }); + expect(p3.merge({ y: 30, z: 30 }).toObject()).toEqual({ + x: 10, + y: 30, + z: 30, + }); + }); it('converts sequences to records', () => { - var MyType = Record({a:1, b:2, c:3}); - var seq = Seq({a: 10, b:20}); - var t = new MyType(seq); - expect(t.toObject()).toEqual({a:10, b:20, c:3}) - }) + const MyType = Record({ a: 1, b: 2, c: 3 }); + const seq = Seq({ a: 10, b: 20 }); + const t = MyType(seq); + expect(t.toObject()).toEqual({ a: 10, b: 20, c: 3 }); + }); it('allows for functional construction', () => { - var MyType = Record({a:1, b:2, c:3}); - var seq = Seq({a: 10, b:20}); - var t = MyType(seq); - expect(t.toObject()).toEqual({a:10, b:20, c:3}) - }) + const MyType = Record({ a: 1, b: 2, c: 3 }); + const seq = Seq({ a: 10, b: 20 }); + const t = MyType(seq); + expect(t.toObject()).toEqual({ a: 10, b: 20, c: 3 }); + }); it('skips unknown keys', () => { - var MyType = Record({a:1, b:2}); - var seq = Seq({b:20, c:30}); - var t = new MyType(seq); + const MyType = Record({ a: 1, b: 2 }); + const seq = Seq({ b: 20, c: 30 }); + const t = MyType(seq); expect(t.get('a')).toEqual(1); expect(t.get('b')).toEqual(20); - expect((t as any).get('c')).toBeUndefined(); - }) + // @ts-expect-error -- unknown key should not return anything + expect(t.get('c')).toBeUndefined(); + }); it('returns itself when setting identical values', () => { - var MyType = Record({a:1, b:2}); - var t1 = new MyType; - var t2 = new MyType({a: 1}); - var t3 = t1.set('a', 1); - var t4 = t2.set('a', 1); + const MyType = Record({ a: 1, b: 2 }); + const t1 = MyType(); + const t2 = MyType({ a: 1 }); + const t3 = t1.set('a', 1); + const t4 = t2.set('a', 1); expect(t3).toBe(t1); expect(t4).toBe(t2); - }) - - it('returns new record when setting new values', () => { - var MyType = Record({a:1, b:2}); - var t1 = new MyType; - var t2 = new MyType({a: 1}); - var t3 = t1.set('a', 3); - var t4 = t2.set('a', 3); + }); + + it('returns record when setting values', () => { + const MyType = Record({ a: 1, b: 2 }); + const t1 = MyType(); + const t2 = MyType({ a: 1 }); + const t3 = t1.set('a', 3); + const t4 = t2.set('a', 3); expect(t3).not.toBe(t1); expect(t4).not.toBe(t2); - }) + }); - it('allows for property access', () => { - var MyType = Record({a:1, b:'foo'}); - var t1 = new MyType(); - var a: number = t1.a; - var b: string = t1.b; + it('allows for readonly property access', () => { + const MyType = Record({ a: 1, b: 'foo' }); + const t1 = MyType(); + const a: number = t1.a; + const b: string = t1.b; expect(a).toEqual(1); expect(b).toEqual('foo'); + // @ts-expect-error -- test that runtime does throw + expect(() => (t1.a = 2)).toThrow('Cannot set on an immutable record.'); }); it('allows for class extension', () => { - class ABClass extends Record({a:1, b:2}) { - setA(a: number) { - return this.set('a', a); + class ABClass extends Record({ a: 1, b: 2 }) { + setA(aVal: number) { + return this.set('a', aVal); } - setB(b: number) { - return this.set('b', b); + setB(bVal: number) { + return this.set('b', bVal); } } - var t1 = new ABClass({a: 1}); - var t2 = t1.setA(3); - var t3 = t2.setB(10); + // Note: `new` is only used because of `class` + const t1 = new ABClass({ a: 1 }); + const t2 = t1.setA(3); + const t3 = t2.setB(10); - var a: number = t3.a; + const a: number = t3.a; expect(a).toEqual(3); - expect(t3.toObject()).toEqual({a:3, b:10}); - }) + expect(t3.toObject()).toEqual({ a: 3, b: 10 }); + }); it('does not allow overwriting property names', () => { + const realWarn = console.warn; + try { - var realWarn = console.warn; - var warnings = []; - console.warn = w => warnings.push(w); + const warnings: Array = []; - var MyType1 = Record({size:0}); - var t1 = MyType1(); + console.warn = (w) => warnings.push(w); + + // size is a safe key to use + const MyType1 = Record({ size: 123 }); + const t1 = MyType1(); + expect(warnings.length).toBe(0); + expect(t1.size).toBe(123); + + // get() is not safe to use + const MyType2 = Record({ get: 0 }); + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const t2 = MyType2(); expect(warnings.length).toBe(1); expect(warnings[0]).toBe( - 'Cannot define Record with property "size" since that property name is part of the Record API.' - ); - - var MyType2 = Record({get:0}); - var t2 = MyType2(); - expect(warnings.length).toBe(2); - expect(warnings[1]).toBe( 'Cannot define Record with property "get" since that property name is part of the Record API.' ); } finally { console.warn = realWarn; } - }) + }); + + it('can be converted to a keyed sequence', () => { + const MyType = Record({ a: 0, b: 0 }); + const t1 = MyType({ a: 10, b: 20 }); + + const seq1 = t1.toSeq(); + expect(isKeyed(seq1)).toBe(true); + expect(seq1.toJS()).toEqual({ a: 10, b: 20 }); + + const seq2 = Seq(t1); + expect(isKeyed(seq2)).toBe(true); + expect(seq2.toJS()).toEqual({ a: 10, b: 20 }); + + const seq3 = Seq.Keyed(t1); + expect(isKeyed(seq3)).toBe(true); + expect(seq3.toJS()).toEqual({ a: 10, b: 20 }); + + const seq4 = Seq.Indexed(t1); + expect(isKeyed(seq4)).toBe(false); + expect(seq4.toJS()).toEqual([ + ['a', 10], + ['b', 20], + ]); + }); + + it('can be iterated over', () => { + const MyType = Record({ a: 0, b: 0 }); + const t1 = MyType({ a: 10, b: 20 }); + + const entries: Array<[string, number]> = []; + for (const entry of t1) { + entries.push(entry); + } + + expect(entries).toEqual([ + ['a', 10], + ['b', 20], + ]); + }); + + it('calling `equals` between two instance of factories with same properties and same value should return true', () => { + const factoryA = Record({ id: '' }); + const factoryB = Record({ id: '' }); + expect(factoryA().equals(factoryA())).toBe(true); + expect(factoryA().equals(factoryB())).toBe(true); + }); + + /** + * @see https://github.com/immutable-js/immutable-js/issues/1565 + */ + it('check that reset does reset the record.', () => { + type UserType = { + name: string; + roles: List | Array; + }; + + const User = Record({ + name: 'default name', + roles: List(), + }); + + const user0 = new User({ + name: 'John', + roles: ['superuser', 'admin'], + }); + const user1 = user0.clear(); + + expect(user1.name).toBe('default name'); + expect(user1.roles).toEqual(List()); + + const user2 = user0.withMutations((mutable: Record) => { + mutable.clear(); + }); + + expect(user2.name).toBe('default name'); + expect(user2.roles).toEqual(List()); + }); + + it('does not accept a Record as constructor', () => { + const Foo = Record({ foo: 'bar' }); + const fooInstance = Foo(); + expect(() => { + Record(fooInstance); + }).toThrowErrorMatchingSnapshot(); + }); + + it('does not accept a non object as constructor', () => { + const defaultValues = null; + expect(() => { + // @ts-expect-error -- test that runtime does throw + Record(defaultValues); + }).toThrowErrorMatchingSnapshot(); + }); + + it('does not accept an immutable object that is not a Record as constructor', () => { + const defaultValues = Map({ foo: 'bar' }); + expect(() => { + Record(defaultValues); + }).toThrowErrorMatchingSnapshot(); + }); }); diff --git a/__tests__/RecordJS.js b/__tests__/RecordJS.js index dee4725920..3ae53fb878 100644 --- a/__tests__/RecordJS.js +++ b/__tests__/RecordJS.js @@ -1,26 +1,27 @@ -var Immutable = require('../'); -var Record = Immutable.Record; +import { describe, expect, it } from '@jest/globals'; +import { Record } from 'immutable'; describe('Record', () => { + it('defines a record factory', () => { + const MyType = Record({ a: 1, b: 2, c: 3 }); - it('defines a constructor', () => { - var MyType = Record({a:1, b:2, c:3}); - - var t = new MyType(); - var t2 = t.set('a', 10); + const t = MyType(); + const t2 = t.set('a', 10); expect(t.a).toBe(1); expect(t2.a).toBe(10); }); it('can have mutations apply', () => { - var MyType = Record({a:1, b:2, c:3}); + const MyType = Record({ a: 1, b: 2, c: 3 }); - var t = new MyType(); + const t = MyType(); - expect(() => { t.a = 10; }).toThrow(); + expect(() => { + t.a = 10; + }).toThrow(); - var t2 = t.withMutations(mt => { + const t2 = t.withMutations((mt) => { mt.a = 10; mt.b = 20; mt.c = 30; @@ -31,32 +32,40 @@ describe('Record', () => { }); it('can be subclassed', () => { - - class Alphabet extends Record({a:1, b:2, c:3}) { + class Alphabet extends Record({ a: 1, b: 2, c: 3 }) { soup() { return this.a + this.b + this.c; } } - var t = new Alphabet(); - var t2 = t.set('b', 200); + // Note: `new` is only used because of `class` + const t = new Alphabet(); + const t2 = t.set('b', 200); - expect(t instanceof Record); - expect(t instanceof Alphabet); + expect(t instanceof Record).toBe(true); + expect(t instanceof Alphabet).toBe(true); expect(t.soup()).toBe(6); expect(t2.soup()).toBe(204); + + // Uses class name as descriptive name + expect(Record.getDescriptiveName(t)).toBe('Alphabet'); + + // Uses display name over class name + class NotADisplayName extends Record({ x: 1 }, 'DisplayName') {} + const t3 = new NotADisplayName(); + expect(Record.getDescriptiveName(t3)).toBe('DisplayName'); }); it('can be cleared', () => { - var MyType = Record({a:1, b:2, c:3}); - var t = new MyType({c:'cats'}); + const MyType = Record({ a: 1, b: 2, c: 3 }); + let t = MyType({ c: 'cats' }); expect(t.c).toBe('cats'); t = t.clear(); expect(t.c).toBe(3); - var MyType2 = Record({d:4, e:5, f:6}); - var t2 = new MyType2({d:'dogs'}); + const MyType2 = Record({ d: 4, e: 5, f: 6 }); + let t2 = MyType2({ d: 'dogs' }); expect(t2.d).toBe('dogs'); t2 = t2.clear(); diff --git a/__tests__/Repeat.ts b/__tests__/Repeat.ts index 26c99ddea7..1553232ba5 100644 --- a/__tests__/Repeat.ts +++ b/__tests__/Repeat.ts @@ -1,18 +1,19 @@ -/// - -import { Repeat } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Repeat } from 'immutable'; describe('Repeat', () => { - it('fixed repeat', () => { - var v = Repeat('wtf', 3); + const v = Repeat('wtf', 3); expect(v.size).toBe(3); expect(v.first()).toBe('wtf'); - expect(v.rest().toArray()).toEqual(['wtf','wtf']); + expect(v.rest().toArray()).toEqual(['wtf', 'wtf']); expect(v.last()).toBe('wtf'); - expect(v.butLast().toArray()).toEqual(['wtf','wtf']); - expect(v.toArray()).toEqual(['wtf','wtf','wtf']); + expect(v.butLast().toArray()).toEqual(['wtf', 'wtf']); + expect(v.toArray()).toEqual(['wtf', 'wtf', 'wtf']); expect(v.join()).toEqual('wtf,wtf,wtf'); }); + it('does not claim to be equal to undefined', () => { + expect(Repeat(1).equals(undefined)).toEqual(false); + }); }); diff --git a/__tests__/Seq.ts b/__tests__/Seq.ts index 35182ec009..cbb048eb8b 100644 --- a/__tests__/Seq.ts +++ b/__tests__/Seq.ts @@ -1,22 +1,40 @@ -/// - -import { Iterable, Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { isCollection, isIndexed, isKeyed, Seq } from 'immutable'; describe('Seq', () => { + it('returns undefined if empty and first is called without default argument', () => { + expect(Seq().first()).toBeUndefined(); + }); + + it('returns undefined if empty and last is called without default argument', () => { + expect(Seq().last()).toBeUndefined(); + }); + + it('returns default value if empty and first is called with default argument', () => { + expect(Seq().first({})).toEqual({}); + }); + + it('returns default value if empty and last is called with default argument', () => { + expect(Seq().last({})).toEqual({}); + }); it('can be empty', () => { expect(Seq().size).toBe(0); }); it('accepts an array', () => { - expect(Seq([1,2,3]).size).toBe(3); + expect(Seq([1, 2, 3]).size).toBe(3); }); it('accepts an object', () => { - expect(Seq({a:1,b:2,c:3}).size).toBe(3); + expect(Seq({ a: 1, b: 2, c: 3 }).size).toBe(3); }); - it('accepts an iterable string', () => { + it('accepts an object with a next property', () => { + expect(Seq({ a: 1, b: 2, next: (_) => _ }).size).toBe(3); + }); + + it('accepts a collection string', () => { expect(Seq('foo').size).toBe(3); }); @@ -28,58 +46,97 @@ describe('Seq', () => { expect(Seq(new Foo()).size).toBe(2); }); - it('of accepts varargs', () => { - expect(Seq.of(1,2,3).size).toBe(3); - }); - it('accepts another sequence', () => { - var seq = Seq.of(1,2,3); + const seq = Seq([1, 2, 3]); expect(Seq(seq).size).toBe(3); }); it('accepts a string', () => { - var seq = Seq('abc'); + const seq = Seq('abc'); expect(seq.size).toBe(3); expect(seq.get(1)).toBe('b'); expect(seq.join('')).toBe('abc'); }); it('accepts an array-like', () => { - var alike: any = { length: 2, 0: 'a', 1: 'b' }; - var seq = Seq(alike); - expect(Iterable.isIndexed(seq)).toBe(true); + const seq = Seq({ length: 2, 0: 'a', 1: 'b' }); + expect(isIndexed(seq)).toBe(true); expect(seq.size).toBe(2); expect(seq.get(1)).toBe('b'); + + const map = Seq({ length: 1, foo: 'bar' }); + expect(isIndexed(map)).toBe(false); + expect(map.size).toBe(2); + expect(map.get('foo')).toBe('bar'); + + const empty = Seq({ length: 0 }); + expect(isIndexed(empty)).toBe(true); + expect(empty.size).toEqual(0); + }); + + it('accepts a JS (global) Map', () => { + const seq = Seq( + new global.Map([ + ['a', 'A'], + ['b', 'B'], + ['c', 'C'], + ]) + ); + expect(isKeyed(seq)).toBe(true); + expect(seq.size).toBe(3); + }); + + it('accepts a JS (global) Set', () => { + const seq = Seq(new global.Set(['a', 'b', 'c'])); + expect(isIndexed(seq)).toBe(false); + expect(isKeyed(seq)).toBe(false); + expect(seq.size).toBe(3); }); it('does not accept a scalar', () => { expect(() => { - Seq(3 as any); - }).toThrow('Expected Array or iterable object of values, or keyed object: 3'); + // @ts-expect-error -- test that runtime does throw + Seq(3); + }).toThrow( + 'Expected Array or collection object of values, or keyed object: 3' + ); }); it('detects sequences', () => { - var seq = Seq.of(1,2,3); + const seq = Seq([1, 2, 3]); expect(Seq.isSeq(seq)).toBe(true); - expect(Iterable.isIterable(seq)).toBe(true); + expect(isCollection(seq)).toBe(true); }); it('Does not infinite loop when sliced with NaN', () => { - var list = Seq([1, 2, 3, 4, 5]); + const list = Seq([1, 2, 3, 4, 5]); expect(list.slice(0, NaN).toJS()).toEqual([]); expect(list.slice(NaN).toJS()).toEqual([1, 2, 3, 4, 5]); }); it('Does not infinite loop when spliced with negative number #559', () => { - var dog = Seq(['d', 'o', 'g']); - var dg = dog.filter(c => c !== 'o'); - var dig = (dg).splice(-1, 0, 'i'); + const dog = Seq(['d', 'o', 'g']); + const dg = dog.filter((c) => c !== 'o'); + const dig = dg.splice(-1, 0, 'i'); expect(dig.toJS()).toEqual(['d', 'i', 'g']); }); it('Does not infinite loop when an undefined number is passed to take', () => { - var list = Seq([1, 2, 3, 4, 5]); + const list = Seq([1, 2, 3, 4, 5]); expect(list.take(NaN).toJS()).toEqual([]); }); + it('Converts deeply toJS after converting to entries', () => { + const list = Seq([Seq([1, 2]), Seq({ a: 'z' })]); + expect(list.entrySeq().toJS()).toEqual([ + [0, [1, 2]], + [1, { a: 'z' }], + ]); + + const map = Seq({ x: Seq([1, 2]), y: Seq({ a: 'z' }) }); + expect(map.entrySeq().toJS()).toEqual([ + ['x', [1, 2]], + ['y', { a: 'z' }], + ]); + }); }); diff --git a/__tests__/Set.ts b/__tests__/Set.ts index 7199ad9704..5e8f1fe5d7 100644 --- a/__tests__/Set.ts +++ b/__tests__/Set.ts @@ -1,32 +1,9 @@ -/// - -declare var Symbol: any; -import { List, Map, OrderedSet, Seq, Set, is } from '../'; - -declare function expect(val: any): ExpectWithIs; - -interface ExpectWithIs extends Expect { - is(expected: any): void; - not: ExpectWithIs; -} - -jasmine.addMatchers({ - is: function() { - return { - compare: function(actual, expected) { - var passed = is(actual, expected); - return { - pass: passed, - message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected - }; - } - }; - } -}); +import { describe, expect, it, jest } from '@jest/globals'; +import { fromJS, is, List, Map, OrderedSet, Seq, Set } from 'immutable'; describe('Set', () => { it('accepts array of values', () => { - var s = Set([1,2,3]); + const s = Set([1, 2, 3]); expect(s.has(1)).toBe(true); expect(s.has(2)).toBe(true); expect(s.has(3)).toBe(true); @@ -34,16 +11,26 @@ describe('Set', () => { }); it('accepts array-like of values', () => { - var s = Set({ 'length': 3, '1': 2 } as any); - expect(s.size).toBe(2) + const s = Set({ length: 3, 2: 3 }); + expect(s.size).toBe(2); expect(s.has(undefined)).toBe(true); + expect(s.has(3)).toBe(true); + expect(s.has(2)).toBe(false); + }); + + it('accepts a JS (global) Set', () => { + const s = Set(new global.Set([1, 2, 3])); + expect(Set.isSet(s)).toBe(true); + expect(s.size).toBe(3); + expect(s.has(1)).toBe(true); expect(s.has(2)).toBe(true); - expect(s.has(1)).toBe(false); + expect(s.has(3)).toBe(true); + expect(s.has(4)).toBe(false); }); - it('accepts string, an array-like iterable', () => { - var s = Set('abc'); - expect(s.size).toBe(3) + it('accepts string, an array-like collection', () => { + const s = Set('abc'); + expect(s.size).toBe(3); expect(s.has('a')).toBe(true); expect(s.has('b')).toBe(true); expect(s.has('c')).toBe(true); @@ -51,8 +38,8 @@ describe('Set', () => { }); it('accepts sequence of values', () => { - var seq = Seq.of(1,2,3); - var s = Set(seq); + const seq = Seq([1, 2, 3]); + const s = Set(seq); expect(s.has(1)).toBe(true); expect(s.has(2)).toBe(true); expect(s.has(3)).toBe(true); @@ -60,19 +47,23 @@ describe('Set', () => { }); it('accepts a keyed Seq as a set of entries', () => { - var seq = Seq({a:null, b:null, c:null}).flip(); - var s = Set(seq); - expect(s.toArray()).toEqual([[null,'a'], [null,'b'], [null,'c']]); + const seq = Seq({ a: null, b: null, c: null }).flip(); + const s = Set(seq); + expect(s.toArray()).toEqual([ + [null, 'a'], + [null, 'b'], + [null, 'c'], + ]); // Explicitly getting the values sequence - var s2 = Set(seq.valueSeq()); - expect(s2.toArray()).toEqual(['a','b','c']); + const s2 = Set(seq.valueSeq()); + expect(s2.toArray()).toEqual(['a', 'b', 'c']); // toSet() does this for you. - var v3 = seq.toSet(); + const v3 = seq.toSet(); expect(v3.toArray()).toEqual(['a', 'b', 'c']); }); it('accepts object keys', () => { - var s = Set.fromKeys({a:null, b:null, c:null}); + const s = Set.fromKeys({ a: null, b: null, c: null }); expect(s.has('a')).toBe(true); expect(s.has('b')).toBe(true); expect(s.has('c')).toBe(true); @@ -80,8 +71,8 @@ describe('Set', () => { }); it('accepts sequence keys', () => { - var seq = Seq({a:null, b:null, c:null}); - var s = Set.fromKeys(seq); + const seq = Seq({ a: null, b: null, c: null }); + const s = Set.fromKeys(seq); expect(s.has('a')).toBe(true); expect(s.has('b')).toBe(true); expect(s.has('c')).toBe(true); @@ -89,7 +80,7 @@ describe('Set', () => { }); it('accepts explicit values', () => { - var s = Set.of(1,2,3); + const s = Set([1, 2, 3]); expect(s.has(1)).toBe(true); expect(s.has(2)).toBe(true); expect(s.has(3)).toBe(true); @@ -97,56 +88,102 @@ describe('Set', () => { }); it('converts back to JS array', () => { - var s = Set.of(1,2,3); - expect(s.toArray()).toEqual([1,2,3]); + const s = Set([1, 2, 3]); + expect(s.toArray()).toEqual([1, 2, 3]); }); it('converts back to JS object', () => { - var s = Set.of('a','b','c'); - expect(s.toObject()).toEqual({a:'a',b:'b',c:'c'}); + const s = Set.of('a', 'b', 'c'); + expect(s.toObject()).toEqual({ a: 'a', b: 'b', c: 'c' }); + }); + + it('maps no-ops return the same reference', () => { + const s = Set([1, 2, 3]); + const r = s.map((value) => value); + expect(r).toBe(s); + }); + + it('maps should produce new set if values changed', () => { + const s = Set([1, 2, 3]); + expect(s.has(4)).toBe(false); + expect(s.size).toBe(3); + + const m = s.map((v) => v + 1); + expect(m.has(1)).toBe(false); + expect(m.has(2)).toBe(true); + expect(m.has(3)).toBe(true); + expect(m.has(4)).toBe(true); + expect(m.size).toBe(3); + }); + + it('unions an unknown collection of Sets', () => { + const abc = Set(['a', 'b', 'c']); + const cat = Set(['c', 'a', 't']); + expect(Set.union([abc, cat]).toArray()).toEqual(['c', 'a', 't', 'b']); + expect(Set.union([abc])).toBe(abc); + expect(Set.union([])).toBe(Set()); + }); + + it('intersects an unknown collection of Sets', () => { + const abc = Set(['a', 'b', 'c']); + const cat = Set(['c', 'a', 't']); + expect(Set.intersect([abc, cat]).toArray()).toEqual(['c', 'a']); + expect(Set.intersect([abc])).toBe(abc); + expect(Set.intersect([])).toBe(Set()); + }); + + it('concatenates strings using union', () => { + const s = Set(['one', 'two']); + expect(s.union('three').toArray()).toEqual(['one', 'two', 'three']); }); it('iterates values', () => { - var s = Set.of(1,2,3); - var iterator = jest.genMockFunction(); + const s = Set([1, 2, 3]); + const iterator = jest.fn(); s.forEach(iterator); expect(iterator.mock.calls).toEqual([ [1, 1, s], [2, 2, s], - [3, 3, s] + [3, 3, s], ]); }); + it('has the same iterator function for keys and values', () => { + const s = Set([1, 2, 3]); + expect(s[Symbol.iterator]).toBe(s.keys); + expect(s[Symbol.iterator]).toBe(s.values); + }); + it('unions two sets', () => { - var s1 = Set.of('a', 'b', 'c'); - var s2 = Set.of('d', 'b', 'wow'); - var s3 = s1.union(s2); + const s1 = Set.of('a', 'b', 'c'); + const s2 = Set.of('d', 'b', 'wow'); + const s3 = s1.union(s2); expect(s3.toArray()).toEqual(['a', 'b', 'c', 'd', 'wow']); }); it('returns self when union results in no-op', () => { - var s1 = Set.of('a', 'b', 'c'); - var s2 = Set.of('c', 'a'); - var s3 = s1.union(s2); + const s1 = Set.of('a', 'b', 'c'); + const s2 = Set.of('c', 'a'); + const s3 = s1.union(s2); expect(s3).toBe(s1); }); it('returns arg when union results in no-op', () => { - var s1 = Set(); - var s2 = Set.of('a', 'b', 'c'); - var s3 = s1.union(s2); + const s1 = Set(); + const s2 = Set.of('a', 'b', 'c'); + const s3 = s1.union(s2); expect(s3).toBe(s2); }); - it('unions a set and an iterable and returns a set', () => { - var s1 = Set([1,2,3]); - var emptySet = Set(); - var l = List([1,2,3]); - var s2 = s1.union(l); - var s3 = emptySet.union(l); - var o = OrderedSet([1,2,3]); - var s4 = s1.union(o); - var s5 = emptySet.union(o); + it('unions a set and another collection and returns a set', () => { + const s1 = Set([1, 2, 3]); + const emptySet = Set(); + const l = List([1, 2, 3]); + const s2 = s1.union(l); + const s3 = emptySet.union(l); + const o = OrderedSet([1, 2, 3]); + const s4 = s1.union(o); + const s5 = emptySet.union(o); expect(Set.isSet(s2)).toBe(true); expect(Set.isSet(s3)).toBe(true); expect(Set.isSet(s4) && !OrderedSet.isOrderedSet(s4)).toBe(true); @@ -154,11 +191,11 @@ describe('Set', () => { }); it('is persistent to adds', () => { - var s1 = Set(); - var s2 = s1.add('a'); - var s3 = s2.add('b'); - var s4 = s3.add('c'); - var s5 = s4.add('b'); + const s1 = Set(); + const s2 = s1.add('a'); + const s3 = s2.add('b'); + const s4 = s3.add('c'); + const s5 = s4.add('b'); expect(s1.size).toBe(0); expect(s2.size).toBe(1); expect(s3.size).toBe(2); @@ -167,11 +204,11 @@ describe('Set', () => { }); it('is persistent to deletes', () => { - var s1 = Set(); - var s2 = s1.add('a'); - var s3 = s2.add('b'); - var s4 = s3.add('c'); - var s5 = s4.remove('b'); + const s1 = Set(); + const s2 = s1.add('a'); + const s3 = s2.add('b'); + const s4 = s3.add('c'); + const s5 = s4.remove('b'); expect(s1.size).toBe(0); expect(s2.size).toBe(1); expect(s3.size).toBe(2); @@ -182,97 +219,159 @@ describe('Set', () => { }); it('deletes down to empty set', () => { - var s = Set.of('A').remove('A'); + const s = Set.of('A').remove('A'); expect(s).toBe(Set()); }); it('unions multiple sets', () => { - var s = Set.of('A', 'B', 'C').union(Set.of('C', 'D', 'E'), Set.of('D', 'B', 'F')); - expect(s).is(Set.of('A','B','C','D','E','F')); + const s = Set.of('A', 'B', 'C').union( + Set.of('C', 'D', 'E'), + Set.of('D', 'B', 'F') + ); + expect(s).toEqual(Set.of('A', 'B', 'C', 'D', 'E', 'F')); }); it('intersects multiple sets', () => { - var s = Set.of('A', 'B', 'C').intersect(Set.of('B', 'C', 'D'), Set.of('A', 'C', 'E')); - expect(s).is(Set.of('C')); + const s = Set.of('A', 'B', 'C').intersect( + Set.of('B', 'C', 'D'), + Set.of('A', 'C', 'E') + ); + expect(s).toEqual(Set.of('C')); }); it('diffs multiple sets', () => { - var s = Set.of('A', 'B', 'C').subtract(Set.of('C', 'D', 'E'), Set.of('D', 'B', 'F')); - expect(s).is(Set.of('A')); + const s = Set.of('A', 'B', 'C').subtract( + Set.of('C', 'D', 'E'), + Set.of('D', 'B', 'F') + ); + expect(s).toEqual(Set.of('A')); }); it('expresses value equality with set sequences', () => { - var s1 = Set.of('A', 'B', 'C'); + const s1 = Set.of('A', 'B', 'C'); expect(s1.equals(null)).toBe(false); - var s2 = Set.of('C', 'B', 'A'); + const s2 = Set.of('C', 'B', 'A'); expect(s1 === s2).toBe(false); expect(is(s1, s2)).toBe(true); expect(s1.equals(s2)).toBe(true); // Map and Set are not the same (keyed vs unkeyed) - var v1 = Map({ A: 'A', C: 'C', B: 'B' }); + const v1 = Map({ A: 'A', C: 'C', B: 'B' }); expect(is(s1, v1)).toBe(false); }); it('can use union in a withMutation', () => { - var js = Set().withMutations(set => { - set.union([ 'a' ]); - set.add('b'); - }).toJS(); + const js = Set() + .withMutations((set) => { + set.union(['a']); + set.add('b'); + }) + .toJS(); expect(js).toEqual(['a', 'b']); }); it('can determine if an array is a subset', () => { - var s = Set.of('A', 'B', 'C'); + const s = Set.of('A', 'B', 'C'); expect(s.isSuperset(['B', 'C'])).toBe(true); expect(s.isSuperset(['B', 'C', 'D'])).toBe(false); }); describe('accepts Symbol as entry #579', () => { - if (typeof Symbol !== 'function') { - Symbol = function(key) { - return { key: key, __proto__: Symbol }; - }; - Symbol.toString = function() { - return 'Symbol(' + (this.key || '') + ')'; - } - } - it('operates on small number of symbols, preserving set uniqueness', () => { - var a = Symbol(); - var b = Symbol(); - var c = Symbol(); + const a = Symbol(); + + const b = Symbol(); - var symbolSet = Set([ a, b, c, a, b, c, a, b, c, a, b, c ]); + const c = Symbol(); + + const symbolSet = Set([a, b, c, a, b, c, a, b, c, a, b, c]); expect(symbolSet.size).toBe(3); expect(symbolSet.has(b)).toBe(true); expect(symbolSet.get(c)).toEqual(c); }); it('operates on a large number of symbols, maintaining obj uniqueness', () => { - var manySymbols = [ - Symbol('a'), Symbol('b'), Symbol('c'), - Symbol('a'), Symbol('b'), Symbol('c'), - Symbol('a'), Symbol('b'), Symbol('c'), - Symbol('a'), Symbol('b'), Symbol('c'), + const manySymbols = [ + Symbol('a'), + Symbol('b'), + Symbol('c'), + Symbol('a'), + Symbol('b'), + Symbol('c'), + Symbol('a'), + Symbol('b'), + Symbol('c'), + Symbol('a'), + Symbol('b'), + Symbol('c'), ]; - var symbolSet = Set(manySymbols); + const symbolSet = Set(manySymbols); expect(symbolSet.size).toBe(12); expect(symbolSet.has(manySymbols[10])).toBe(true); expect(symbolSet.get(manySymbols[10])).toEqual(manySymbols[10]); }); - }); it('can use intersect after add or union in a withMutation', () => { - var set = Set(['a', 'd']).withMutations(set => { - set.add('b'); - set.union(['c']); - set.intersect(['b', 'c', 'd']); + const set = Set(['a', 'd']).withMutations((s) => { + s.add('b'); + s.union(['c']); + s.intersect(['b', 'c', 'd']); }); expect(set.toArray()).toEqual(['c', 'd', 'b']); }); + it('can count entries that satisfy a predicate', () => { + const set = Set([1, 2, 3, 4, 5]); + expect(set.size).toEqual(5); + expect(set.count()).toEqual(5); + expect(set.count((x) => x % 2 === 0)).toEqual(2); + expect(set.count(() => true)).toEqual(5); + }); + + describe('"size" should correctly reflect the number of elements in a Set', () => { + describe('deduplicating custom classes that invoke fromJS() as part of equality check', () => { + class Entity { + entityId: string; + + entityKey: string; + + constructor(entityId: string, entityKey: string) { + this.entityId = entityId; + this.entityKey = entityKey; + } + + asImmutable() { + return fromJS({ + entityId: this.entityId, + entityKey: this.entityKey, + }); + } + + valueOf() { + return this.asImmutable().toString(); + } + } + it('with mutations', () => { + const testSet = Set().withMutations((mutableSet) => { + mutableSet.add(new Entity('hello', 'world')); + mutableSet.add(new Entity('testing', 'immutable')); + mutableSet.add(new Entity('hello', 'world')); + }); + expect(testSet.size).toEqual(2); + }); + it('without mutations', () => { + const testSet0 = Set(); + const testSet1 = testSet0.add(new Entity('hello', 'world')); + const testSet2 = testSet1.add(new Entity('testing', 'immutable')); + const testSet3 = testSet2.add(new Entity('hello', 'world')); + expect(testSet0.size).toEqual(0); + expect(testSet1.size).toEqual(1); + expect(testSet2.size).toEqual(2); + expect(testSet3.size).toEqual(2); + }); + }); + }); }); diff --git a/__tests__/Stack.ts b/__tests__/Stack.ts index f2702fd3f5..f3fc3d9326 100644 --- a/__tests__/Stack.ts +++ b/__tests__/Stack.ts @@ -1,103 +1,99 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Seq, Stack } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Seq, Stack } from 'immutable'; +import fc from 'fast-check'; function arrayOfSize(s) { - var a = new Array(s); - for (var ii = 0; ii < s; ii++) { + const a = new Array(s); + for (let ii = 0; ii < s; ii++) { a[ii] = ii; } return a; } describe('Stack', () => { - it('constructor provides initial values', () => { - var s = Stack.of('a', 'b', 'c'); + const s = Stack.of('a', 'b', 'c'); expect(s.get(0)).toBe('a'); expect(s.get(1)).toBe('b'); expect(s.get(2)).toBe('c'); }); it('toArray provides a JS array', () => { - var s = Stack.of('a', 'b', 'c'); + const s = Stack.of('a', 'b', 'c'); expect(s.toArray()).toEqual(['a', 'b', 'c']); }); it('accepts a JS array', () => { - var s = Stack(['a', 'b', 'c']); + const s = Stack(['a', 'b', 'c']); expect(s.toArray()).toEqual(['a', 'b', 'c']); }); it('accepts a Seq', () => { - var seq = Seq(['a', 'b', 'c']); - var s = Stack(seq); + const seq = Seq(['a', 'b', 'c']); + const s = Stack(seq); expect(s.toArray()).toEqual(['a', 'b', 'c']); }); it('accepts a keyed Seq', () => { - var seq = Seq({a:null, b:null, c:null}).flip(); - var s = Stack(seq); - expect(s.toArray()).toEqual([[null,'a'], [null,'b'], [null,'c']]); + const seq = Seq({ a: null, b: null, c: null }).flip(); + const s = Stack(seq); + expect(s.toArray()).toEqual([ + [null, 'a'], + [null, 'b'], + [null, 'c'], + ]); // Explicit values - var s2 = Stack(seq.valueSeq()); + const s2 = Stack(seq.valueSeq()); expect(s2.toArray()).toEqual(['a', 'b', 'c']); // toStack() does this for you. - var s3 = seq.toStack(); + const s3 = seq.toStack(); expect(s3.toArray()).toEqual(['a', 'b', 'c']); }); it('pushing creates a new instance', () => { - var s0 = Stack.of('a'); - var s1 = s0.push('A'); + const s0 = Stack.of('a'); + const s1 = s0.push('A'); expect(s0.get(0)).toBe('a'); expect(s1.get(0)).toBe('A'); }); it('get helpers make for easier to read code', () => { - var s = Stack.of('a', 'b', 'c'); + const s = Stack.of('a', 'b', 'c'); expect(s.first()).toBe('a'); expect(s.last()).toBe('c'); expect(s.peek()).toBe('a'); }); it('slice helpers make for easier to read code', () => { - var s = Stack.of('a', 'b', 'c'); + const s = Stack.of('a', 'b', 'c'); expect(s.rest().toArray()).toEqual(['b', 'c']); }); it('iterable in reverse order', () => { - var s = Stack.of('a', 'b', 'c'); + const s = Stack.of('a', 'b', 'c'); expect(s.size).toBe(3); - var forEachResults = []; + const forEachResults: Array<[number, string, string | undefined]> = []; s.forEach((val, i) => forEachResults.push([i, val, s.get(i)])); expect(forEachResults).toEqual([ - [0,'a','a'], - [1,'b','b'], - [2,'c','c'], + [0, 'a', 'a'], + [1, 'b', 'b'], + [2, 'c', 'c'], ]); // map will cause reverse iterate - expect(s.map(val => val + val).toArray()).toEqual([ - 'aa', - 'bb', - 'cc', - ]); + expect(s.map((val) => val + val).toArray()).toEqual(['aa', 'bb', 'cc']); - var iteratorResults = []; - var iterator = s.entries(); - var step; + let iteratorResults: Array<[number, string]> = []; + let iterator = s.entries(); + let step: IteratorResult<[number, string]>; while (!(step = iterator.next()).done) { iteratorResults.push(step.value); } expect(iteratorResults).toEqual([ - [0,'a'], - [1,'b'], - [2,'c'], + [0, 'a'], + [1, 'b'], + [2, 'c'], ]); iteratorResults = []; @@ -106,89 +102,121 @@ describe('Stack', () => { iteratorResults.push(step.value); } expect(iteratorResults).toEqual([ - [0,'c'], - [1,'b'], - [2,'a'], + [0, 'c'], + [1, 'b'], + [2, 'a'], ]); }); it('map is called in reverse order but with correct indices', () => { - var s = Stack(['a', 'b', 'c']); - var s2 = s.map((v, i, c) => v + i + c.get(i)); - expect(s2.toArray()).toEqual(['a0a','b1b','c2c']); + const s = Stack(['a', 'b', 'c']); + const s2 = s.map((v, i, c) => v + i + c.get(i)); + expect(s2.toArray()).toEqual(['a0a', 'b1b', 'c2c']); - var mappedSeq = s.toSeq().map((v, i, c) => v + i + c.get(i)) - var s3 = Stack(mappedSeq); - expect(s3.toArray()).toEqual(['a0a','b1b','c2c']); + const mappedSeq = s.toSeq().map((v, i, c) => v + i + c.get(i)); + const s3 = Stack(mappedSeq); + expect(s3.toArray()).toEqual(['a0a', 'b1b', 'c2c']); }); it('push inserts at lowest index', () => { - var s0 = Stack.of('a', 'b', 'c'); - var s1 = s0.push('d', 'e', 'f'); + const s0 = Stack.of('a', 'b', 'c'); + const s1 = s0.push('d', 'e', 'f'); expect(s0.size).toBe(3); expect(s1.size).toBe(6); expect(s1.toArray()).toEqual(['d', 'e', 'f', 'a', 'b', 'c']); }); it('pop removes the lowest index, decrementing size', () => { - var s = Stack.of('a', 'b', 'c').pop(); + const s = Stack.of('a', 'b', 'c').pop(); expect(s.peek()).toBe('b'); - expect(s.toArray()).toEqual([ 'b', 'c' ]); + expect(s.toArray()).toEqual(['b', 'c']); }); - check.it('shift removes the lowest index, just like array', {maxSize: 2000}, - [gen.posInt], len => { - var a = arrayOfSize(len); - var s = Stack(a); - - while (a.length) { + it('shift removes the lowest index, just like array', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + const a = arrayOfSize(len); + let s = Stack(a); + + while (a.length) { + expect(s.size).toBe(a.length); + expect(s.toArray()).toEqual(a); + s = s.shift(); + a.shift(); + } expect(s.size).toBe(a.length); expect(s.toArray()).toEqual(a); - s = s.shift(); - a.shift(); - } - expect(s.size).toBe(a.length); - expect(s.toArray()).toEqual(a); - } - ); - - check.it('unshift adds the next lowest index, just like array', {maxSize: 2000}, - [gen.posInt], len => { - var a = []; - var s = Stack(); + }) + ); + }); - for (var ii = 0; ii < len; ii++) { + it('unshift adds the next lowest index, just like array', () => { + fc.assert( + fc.property(fc.nat(100), (len) => { + const a: Array = []; + let s = Stack(); + + for (let ii = 0; ii < len; ii++) { + expect(s.size).toBe(a.length); + expect(s.toArray()).toEqual(a); + s = s.unshift(ii); + a.unshift(ii); + } expect(s.size).toBe(a.length); expect(s.toArray()).toEqual(a); - s = s.unshift(ii); - a.unshift(ii); - } - expect(s.size).toBe(a.length); - expect(s.toArray()).toEqual(a); - } - ); + }) + ); + }); - check.it('unshifts multiple values to the front', {maxSize: 2000}, - [gen.posInt, gen.posInt], (size1: Number, size2: Number) => { - var a1 = arrayOfSize(size1); - var a2 = arrayOfSize(size2); + it('unshifts multiple values to the front', () => { + fc.assert( + fc.property(fc.nat(100), fc.nat(100), (size1: number, size2: number) => { + const a1 = arrayOfSize(size1); + const a2 = arrayOfSize(size2); - var s1 = Stack(a1); - var s3 = s1.unshift.apply(s1, a2); + const s1 = Stack(a1); + const s3 = s1.unshift.apply(s1, a2); - var a3 = a1.slice(); - a3.unshift.apply(a3, a2); + const a3 = a1.slice(); + a3.unshift.apply(a3, a2); - expect(s3.size).toEqual(a3.length); - expect(s3.toArray()).toEqual(a3); - } - ); + expect(s3.size).toEqual(a3.length); + expect(s3.toArray()).toEqual(a3); + }) + ); + }); it('finds values using indexOf', () => { - var s = Stack.of('a', 'b', 'c', 'b', 'a'); + const s = Stack.of('a', 'b', 'c', 'b', 'a'); expect(s.indexOf('b')).toBe(1); expect(s.indexOf('c')).toBe(2); expect(s.indexOf('d')).toBe(-1); }); + it('pushes on all items in an iter', () => { + const abc = Stack(['a', 'b', 'c']); + const xyz = Stack(['x', 'y', 'z']); + const xyzSeq = Seq(['x', 'y', 'z']); + + // Push all to the front of the Stack so first item ends up first. + expect(abc.pushAll(xyz).toArray()).toEqual(['x', 'y', 'z', 'a', 'b', 'c']); + expect(abc.pushAll(xyzSeq).toArray()).toEqual([ + 'x', + 'y', + 'z', + 'a', + 'b', + 'c', + ]); + + // Pushes Seq contents into Stack + expect(Stack().pushAll(xyzSeq)).not.toBe(xyzSeq); + expect(Stack().pushAll(xyzSeq).toArray()).toEqual(['x', 'y', 'z']); + + // Pushing a Stack onto an empty Stack returns === Stack + expect(Stack().pushAll(xyz)).toBe(xyz); + + // Pushing an empty Stack onto a Stack return === Stack + expect(abc.pushAll(Stack())).toBe(abc); + }); }); diff --git a/__tests__/__snapshots__/Record.ts.snap b/__tests__/__snapshots__/Record.ts.snap new file mode 100644 index 0000000000..46daf60171 --- /dev/null +++ b/__tests__/__snapshots__/Record.ts.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Record does not accept a Record as constructor 1`] = `"Can not call \`Record\` with an immutable Record as default values. Use a plain javascript object instead."`; + +exports[`Record does not accept a non object as constructor 1`] = `"Can not call \`Record\` with a non-object as default values. Use a plain javascript object instead."`; + +exports[`Record does not accept an immutable object that is not a Record as constructor 1`] = `"Can not call \`Record\` with an immutable Collection as default values. Use a plain javascript object instead."`; diff --git a/__tests__/concat.ts b/__tests__/concat.ts index 35772ca70e..35710a7c49 100644 --- a/__tests__/concat.ts +++ b/__tests__/concat.ts @@ -1,154 +1,222 @@ -/// - -import { Seq, Set, List, is } from '../'; - -declare function expect(val: any): ExpectWithIs; - -interface ExpectWithIs extends Expect { - is(expected: any): void; - not: ExpectWithIs; -} - -jasmine.addMatchers({ - is: function() { - return { - compare: function(actual, expected) { - var passed = is(actual, expected); - return { - pass: passed, - message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected - }; - } - }; - } -}); +import { describe, expect, it } from '@jest/globals'; +import { List, Seq, Set } from 'immutable'; describe('concat', () => { - it('concats two sequences', () => { - var a = Seq.of(1,2,3); - var b = Seq.of(4,5,6); - expect(a.concat(b)).is(Seq.of(1,2,3,4,5,6)) + const a = Seq([1, 2, 3]); + const b = Seq([4, 5, 6]); expect(a.concat(b).size).toBe(6); - expect(a.concat(b).toArray()).toEqual([1,2,3,4,5,6]); - }) + expect(a.concat(b).toArray()).toEqual([1, 2, 3, 4, 5, 6]); + }); it('concats two object sequences', () => { - var a = Seq({a:1,b:2,c:3}); - var b = Seq({d:4,e:5,f:6}); + const a = Seq({ a: 1, b: 2, c: 3 }); + const b = Seq({ d: 4, e: 5, f: 6 }); expect(a.size).toBe(3); expect(a.concat(b).size).toBe(6); - expect(a.concat(b).toObject()).toEqual({a:1,b:2,c:3,d:4,e:5,f:6}); - }) + expect(a.concat(b).toObject()).toEqual({ + a: 1, + b: 2, + c: 3, + d: 4, + e: 5, + f: 6, + }); + }); it('concats objects to keyed seq', () => { - var a = Seq({a:1,b:2,c:3}); - var b = {d:4,e:5,f:6}; - expect(a.concat(b).toObject()).toEqual({a:1,b:2,c:3,d:4,e:5,f:6}); - }) + const a = Seq({ a: 1, b: 2, c: 3 }); + const b = { d: 4, e: 5, f: 6 }; + expect(a.concat(b).toObject()).toEqual({ + a: 1, + b: 2, + c: 3, + d: 4, + e: 5, + f: 6, + }); + }); it('doesnt concat raw arrays to keyed seq', () => { - var a = Seq({a:1,b:2,c:3}); - var b = [4,5,6]; + const a = Seq({ a: 1, b: 2, c: 3 }); + const b = [4, 5, 6]; expect(() => { + // @ts-expect-error -- test that runtime does throw a.concat(b).toJS(); }).toThrow('Expected [K, V] tuple: 4'); - }) + }); it('concats arrays to indexed seq', () => { - var a = Seq.of(1,2,3); - var b = [4,5,6]; + const a = Seq([1, 2, 3]); + const b = [4, 5, 6]; expect(a.concat(b).size).toBe(6); - expect(a.concat(b).toArray()).toEqual([1,2,3,4,5,6]); - }) + expect(a.concat(b).toArray()).toEqual([1, 2, 3, 4, 5, 6]); + }); it('concats values', () => { - var a = Seq.of(1,2,3); - expect(a.concat(4,5,6).size).toBe(6); - expect(a.concat(4,5,6).toArray()).toEqual([1,2,3,4,5,6]); - }) + const a = Seq([1, 2, 3]); + expect(a.concat(4, 5, 6).size).toBe(6); + expect(a.concat(4, 5, 6).toArray()).toEqual([1, 2, 3, 4, 5, 6]); + }); it('doesnt concat objects to indexed seq', () => { - var a = Seq.of(0,1,2,3); - var b = {4:4}; - var i = a.concat(b); + const a = Seq([0, 1, 2, 3]); + const b = { 4: 4 }; + const i = a.concat(b); expect(i.size).toBe(5); expect(i.get(4)).toBe(b); - expect(i.toArray()).toEqual([0,1,2,3,{4:4}]); - }) + expect(i.toArray()).toEqual([0, 1, 2, 3, { 4: 4 }]); + }); it('concats multiple arguments', () => { - var a = Seq.of(1,2,3); - var b = [4,5,6]; - var c = [7,8,9]; + const a = Seq([1, 2, 3]); + const b = [4, 5, 6]; + const c = [7, 8, 9]; expect(a.concat(b, c).size).toBe(9); - expect(a.concat(b, c).toArray()).toEqual([1,2,3,4,5,6,7,8,9]); - }) + expect(a.concat(b, c).toArray()).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9]); + }); it('can concat itself!', () => { - var a = Seq.of(1,2,3); + const a = Seq([1, 2, 3]); expect(a.concat(a, a).size).toBe(9); - expect(a.concat(a, a).toArray()).toEqual([1,2,3,1,2,3,1,2,3]); - }) + expect(a.concat(a, a).toArray()).toEqual([1, 2, 3, 1, 2, 3, 1, 2, 3]); + }); it('returns itself when concat does nothing', () => { - var a = Seq.of(1,2,3); - var b = Seq(); + const a = Seq([1, 2, 3]); + const b = Seq(); expect(a.concat()).toBe(a); expect(a.concat(b)).toBe(a); expect(b.concat(b)).toBe(b); - }) + }); it('returns non-empty item when concat does nothing', () => { - var a = Seq.of(1,2,3); - var b = Seq(); + const a = Seq([1, 2, 3]); + const b = Seq(); expect(a.concat(b)).toBe(a); expect(b.concat(a)).toBe(a); expect(b.concat(b, b, b, a, b, b)).toBe(a); - }) + }); it('always returns the same type', () => { - var a = Set.of(1,2,3); - var b = List(); + const a = Set([1, 2, 3]); + const b = List(); expect(b.concat(a)).not.toBe(a); expect(List.isList(b.concat(a))).toBe(true); - expect(b.concat(a)).is(List.of(1,2,3)); - }) + expect(b.concat(a)).toEqual(List([1, 2, 3])); + }); it('iterates repeated keys', () => { - var a = Seq({a:1,b:2,c:3}); - expect(a.concat(a, a).toObject()).toEqual({a:1,b:2,c:3}); - expect(a.concat(a, a).toArray()).toEqual([1,2,3,1,2,3,1,2,3]); - expect(a.concat(a, a).keySeq().toArray()).toEqual(['a','b','c','a','b','c','a','b','c']); - }) + const a = Seq({ a: 1, b: 2, c: 3 }); + expect(a.concat(a, a).toObject()).toEqual({ a: 1, b: 2, c: 3 }); + expect(a.concat(a, a).valueSeq().toArray()).toEqual([ + 1, 2, 3, 1, 2, 3, 1, 2, 3, + ]); + expect(a.concat(a, a).keySeq().toArray()).toEqual([ + 'a', + 'b', + 'c', + 'a', + 'b', + 'c', + 'a', + 'b', + 'c', + ]); + expect(a.concat(a, a).toArray()).toEqual([ + ['a', 1], + ['b', 2], + ['c', 3], + ['a', 1], + ['b', 2], + ['c', 3], + ['a', 1], + ['b', 2], + ['c', 3], + ]); + }); it('lazily reverses un-indexed sequences', () => { - var a = Seq({a:1,b:2,c:3}); - var b = Seq({d:4,e:5,f:6}); - expect(a.concat(b).reverse().keySeq().toArray()).toEqual(['f','e','d','c','b','a']); - }) + const a = Seq({ a: 1, b: 2, c: 3 }); + const b = Seq({ d: 4, e: 5, f: 6 }); + expect(a.concat(b).reverse().keySeq().toArray()).toEqual([ + 'f', + 'e', + 'd', + 'c', + 'b', + 'a', + ]); + }); it('lazily reverses indexed sequences', () => { - var a = Seq([1,2,3]); + const a = Seq([1, 2, 3]); expect(a.concat(a, a).reverse().size).toBe(9); - expect(a.concat(a, a).reverse().toArray()).toEqual([3,2,1,3,2,1,3,2,1]); - }) + expect(a.concat(a, a).reverse().toArray()).toEqual([ + 3, 2, 1, 3, 2, 1, 3, 2, 1, + ]); + }); it('lazily reverses indexed sequences with unknown size, maintaining indicies', () => { - var a = Seq([1,2,3]).filter(x=>true); + const a = Seq([1, 2, 3]).filter(() => true); expect(a.size).toBe(undefined); // Note: lazy filter does not know what size in O(1). expect(a.concat(a, a).toKeyedSeq().reverse().size).toBe(undefined); - expect(a.concat(a, a).toKeyedSeq().reverse().entrySeq().toArray()).toEqual( - [[8,3],[7,2],[6,1],[5,3],[4,2],[3,1],[2,3],[1,2],[0,1]] - ); - }) + expect(a.concat(a, a).toKeyedSeq().reverse().toArray()).toEqual([ + [8, 3], + [7, 2], + [6, 1], + [5, 3], + [4, 2], + [3, 1], + [2, 3], + [1, 2], + [0, 1], + ]); + }); it('counts from the end of the indexed sequence on negative index', () => { - var i = List.of(9, 5, 3, 1).map(x => - x); + const i = List.of(9, 5, 3, 1).map((x) => -x); expect(i.get(0)).toBe(-9); expect(i.get(-1)).toBe(-1); expect(i.get(-4)).toBe(-9); expect(i.get(-5, 888)).toBe(888); - }) - -}) + }); + + it('should iterate on many concatenated sequences', () => { + let meta = Seq(); + + for (let i = 0; i < 10000; ++i) { + meta = meta.concat(i) as Seq; // TODO fix typing + } + + expect(meta.toList().size).toBe(10000); + }); + + it('should handle iterator on many concatenated sequences', () => { + const nbLoops = 10000; + let meta = Seq(); + for (let i = 1; i < nbLoops; i++) { + meta = meta.concat(i) as Seq; // TODO fix typing + } + const it = meta[Symbol.iterator](); + let done = false; + let i = 0; + while (!done) { + const result = it.next(); + i++; + done = !!result.done; + } + expect(i).toBe(nbLoops); + }); + + it('should iterate on reverse order on concatenated sequences', () => { + let meta = Seq([1]); + meta = meta.concat(42); + const it = meta.reverse()[Symbol.iterator](); + const result = it.next(); + expect(result).toEqual({ + done: false, + value: 42, + }); + }); +}); diff --git a/__tests__/count.ts b/__tests__/count.ts index 2f6223c058..488e8d8b5d 100644 --- a/__tests__/count.ts +++ b/__tests__/count.ts @@ -1,87 +1,80 @@ -/// - -import { Seq, Range } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Range, Seq } from 'immutable'; describe('count', () => { - it('counts sequences with known lengths', () => { - expect(Seq.of(1,2,3,4,5).size).toBe(5); - expect(Seq.of(1,2,3,4,5).count()).toBe(5); - }) + expect(Seq([1, 2, 3, 4, 5]).size).toBe(5); + expect(Seq([1, 2, 3, 4, 5]).count()).toBe(5); + }); it('counts sequences with unknown lengths, resulting in a cached size', () => { - var seq = Seq.of(1,2,3,4,5,6).filter(x => x % 2 === 0); + const seq = Seq([1, 2, 3, 4, 5, 6]).filter((x) => x % 2 === 0); expect(seq.size).toBe(undefined); expect(seq.count()).toBe(3); expect(seq.size).toBe(3); - }) + }); it('counts sequences with a specific predicate', () => { - var seq = Seq.of(1,2,3,4,5,6); + const seq = Seq([1, 2, 3, 4, 5, 6]); expect(seq.size).toBe(6); - expect(seq.count(x => x > 3)).toBe(3); - }) + expect(seq.count((x) => x > 3)).toBe(3); + }); describe('countBy', () => { - it('counts by keyed sequence', () => { - var grouped = Seq({a:1,b:2,c:3,d:4}).countBy(x => x % 2); - expect(grouped.toJS()).toEqual({1:2, 0:2}); + const grouped = Seq({ a: 1, b: 2, c: 3, d: 4 }).countBy((x) => x % 2); + expect(grouped.toJS()).toEqual({ 1: 2, 0: 2 }); expect(grouped.get(1)).toEqual(2); - }) + }); it('counts by indexed sequence', () => { expect( - Seq.of(1,2,3,4,5,6).countBy(x => x % 2).toJS() - ).toEqual( - {1:3, 0:3} - ); - }) + Seq([1, 2, 3, 4, 5, 6]) + .countBy((x) => x % 2) + .toJS() + ).toEqual({ 1: 3, 0: 3 }); + }); it('counts by specific keys', () => { expect( - Seq.of(1,2,3,4,5,6).countBy(x => x % 2 ? 'odd' : 'even').toJS() - ).toEqual( - {odd:3, even:3} - ); - }) - - }) + Seq([1, 2, 3, 4, 5, 6]) + .countBy((x) => (x % 2 ? 'odd' : 'even')) + .toJS() + ).toEqual({ odd: 3, even: 3 }); + }); + }); describe('isEmpty', () => { - it('is O(1) on sequences with known lengths', () => { - expect(Seq.of(1,2,3,4,5).size).toBe(5); - expect(Seq.of(1,2,3,4,5).isEmpty()).toBe(false); + expect(Seq([1, 2, 3, 4, 5]).size).toBe(5); + expect(Seq([1, 2, 3, 4, 5]).isEmpty()).toBe(false); expect(Seq().size).toBe(0); expect(Seq().isEmpty()).toBe(true); - }) + }); it('lazily evaluates Seq with unknown length', () => { - var seq = Seq.of(1,2,3,4,5,6).filter(x => x % 2 === 0); + let seq = Seq([1, 2, 3, 4, 5, 6]).filter((x) => x % 2 === 0); expect(seq.size).toBe(undefined); expect(seq.isEmpty()).toBe(false); expect(seq.size).toBe(undefined); - var seq = Seq.of(1,2,3,4,5,6).filter(x => x > 10); + seq = Seq([1, 2, 3, 4, 5, 6]).filter((x) => x > 10); expect(seq.size).toBe(undefined); expect(seq.isEmpty()).toBe(true); expect(seq.size).toBe(undefined); - }) + }); it('with infinitely long sequences of known length', () => { - var seq = Range(); + const seq = Range(0, Infinity); expect(seq.size).toBe(Infinity); expect(seq.isEmpty()).toBe(false); - }) + }); it('with infinitely long sequences of unknown length', () => { - var seq = Range().filter(x => x % 2 === 0); + const seq = Range(0, Infinity).filter((x) => x % 2 === 0); expect(seq.size).toBe(undefined); expect(seq.isEmpty()).toBe(false); expect(seq.size).toBe(undefined); - }) - - }) - -}) + }); + }); +}); diff --git a/__tests__/find.ts b/__tests__/find.ts index 37a374dac4..2f6f186690 100644 --- a/__tests__/find.ts +++ b/__tests__/find.ts @@ -1,28 +1,25 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { List, Range, Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Seq } from 'immutable'; describe('find', () => { - it('find returns notSetValue when match is not found', () => { - expect(Seq.of(1,2,3,4,5,6).find(function () { - return false; - }, null, 9)).toEqual(9); - }) + expect(Seq([1, 2, 3, 4, 5, 6]).find(() => false, null, 9)).toEqual(9); + }); it('findEntry returns notSetValue when match is not found', () => { - expect(Seq.of(1,2,3,4,5,6).findEntry(function () { - return false; - }, null, 9)).toEqual(9); - }) + expect( + Seq([1, 2, 3, 4, 5, 6]).findEntry( + () => false, - it('findLastEntry returns notSetValue when match is not found', () => { - expect(Seq.of(1,2,3,4,5,6).findLastEntry(function () { - return false; - }, null, 9)).toEqual(9); - }) + null, + 9 + ) + ).toEqual(9); + }); -}) + it('findLastEntry returns notSetValue when match is not found', () => { + expect(Seq([1, 2, 3, 4, 5, 6]).findLastEntry(() => false, null, 9)).toEqual( + 9 + ); + }); +}); diff --git a/__tests__/flatten.ts b/__tests__/flatten.ts index ce506887dc..0d5cea91e8 100644 --- a/__tests__/flatten.ts +++ b/__tests__/flatten.ts @@ -1,139 +1,143 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Iterable, Seq, Range, List, fromJS } from '../'; - -type SeqType = number | number[] | Iterable; +import { describe, expect, it } from '@jest/globals'; +import { Collection, fromJS, List, Range, Seq } from 'immutable'; describe('flatten', () => { - it('flattens sequences one level deep', () => { - var nested = fromJS([[1,2],[3,4],[5,6]]); - var flat = nested.flatten(); - expect(flat.toJS()).toEqual([1,2,3,4,5,6]); - }) + const nested = fromJS([ + [1, 2], + [3, 4], + [5, 6], + ]); + const flat = nested.flatten(); + expect(flat.toJS()).toEqual([1, 2, 3, 4, 5, 6]); + }); it('flattening a List returns a List', () => { - var nested = fromJS([[1],2,3,[4,5,6]]); - var flat = nested.flatten(); - expect(flat.toString()).toEqual("List [ 1, 2, 3, 4, 5, 6 ]"); - }) + const nested = fromJS([[1], 2, 3, [4, 5, 6]]); + const flat = nested.flatten(); + expect(flat.toString()).toEqual('List [ 1, 2, 3, 4, 5, 6 ]'); + }); it('gives the correct iteration count', () => { - var nested = fromJS([[1,2,3],[4,5,6]]); - var flat = nested.flatten(); - expect(flat.forEach(x => x < 4)).toEqual(4); - }) + const nested = fromJS([ + [1, 2, 3], + [4, 5, 6], + ]); + const flat = nested.flatten(); + // @ts-expect-error -- `flatten` return type should be improved + expect(flat.forEach((x: number) => x < 4)).toEqual(4); + }); + + type SeqType = number | Array | Collection; it('flattens only Sequences (not sequenceables)', () => { - var nested = Seq.of(Range(1,3),[3,4],List.of(5,6,7),8); - var flat = nested.flatten(); - expect(flat.toJS()).toEqual([1,2,[3,4],5,6,7,8]); - }) + const nested = Seq([Range(1, 3), [3, 4], List([5, 6, 7]), 8]); + const flat = nested.flatten(); + expect(flat.toJS()).toEqual([1, 2, [3, 4], 5, 6, 7, 8]); + }); it('can be reversed', () => { - var nested = Seq.of(Range(1,3),[3,4],List.of(5,6,7),8); - var flat = nested.flatten(); - var reversed = flat.reverse(); - expect(reversed.toJS()).toEqual([8,7,6,5,[3,4],2,1]); - }) + const nested = Seq([Range(1, 3), [3, 4], List([5, 6, 7]), 8]); + const flat = nested.flatten(); + const reversed = flat.reverse(); + expect(reversed.toJS()).toEqual([8, 7, 6, 5, [3, 4], 2, 1]); + }); it('can flatten at various levels of depth', () => { - var deeplyNested = fromJS( + const deeplyNested = fromJS([ [ [ - [ - [ 'A', 'B' ], - [ 'A', 'B' ], - ], - [ - [ 'A', 'B' ], - [ 'A', 'B' ], - ], + ['A', 'B'], + ['A', 'B'], ], [ - [ - [ 'A', 'B' ], - [ 'A', 'B' ], - ], - [ - [ 'A', 'B' ], - [ 'A', 'B' ], - ] - ] - ] - ); - - // deeply flatten - expect(deeplyNested.flatten().toJS()).toEqual( - ['A','B','A','B','A','B','A','B','A','B','A','B','A','B','A','B'] - ); - - // shallow flatten - expect(deeplyNested.flatten(true).toJS()).toEqual( - [ - [ - [ 'A', 'B' ], - [ 'A', 'B' ], + ['A', 'B'], + ['A', 'B'], ], + ], + [ [ - [ 'A', 'B' ], - [ 'A', 'B' ], + ['A', 'B'], + ['A', 'B'], ], [ - [ 'A', 'B' ], - [ 'A', 'B' ], + ['A', 'B'], + ['A', 'B'], ], - [ - [ 'A', 'B' ], - [ 'A', 'B' ], - ] - ] - ); + ], + ]); - // flatten two levels - expect(deeplyNested.flatten(2).toJS()).toEqual( + // deeply flatten + expect(deeplyNested.flatten().toJS()).toEqual([ + 'A', + 'B', + 'A', + 'B', + 'A', + 'B', + 'A', + 'B', + 'A', + 'B', + 'A', + 'B', + 'A', + 'B', + 'A', + 'B', + ]); + + // shallow flatten + expect(deeplyNested.flatten(true).toJS()).toEqual([ + [ + ['A', 'B'], + ['A', 'B'], + ], + [ + ['A', 'B'], + ['A', 'B'], + ], + [ + ['A', 'B'], + ['A', 'B'], + ], [ - [ 'A', 'B' ], - [ 'A', 'B' ], - [ 'A', 'B' ], - [ 'A', 'B' ], - [ 'A', 'B' ], - [ 'A', 'B' ], - [ 'A', 'B' ], - [ 'A', 'B' ] - ] - ); + ['A', 'B'], + ['A', 'B'], + ], + ]); + + // flatten two levels + expect(deeplyNested.flatten(2).toJS()).toEqual([ + ['A', 'B'], + ['A', 'B'], + ['A', 'B'], + ['A', 'B'], + ['A', 'B'], + ['A', 'B'], + ['A', 'B'], + ['A', 'B'], + ]); }); describe('flatMap', () => { - it('first maps, then shallow flattens', () => { - var numbers = Range(97, 100); - var letters = numbers.flatMap(v => fromJS([ - String.fromCharCode(v), - String.fromCharCode(v).toUpperCase(), - ])); - expect(letters.toJS()).toEqual( - ['a','A','b','B','c','C'] - ) + const numbers = Range(97, 100); + const letters = numbers.flatMap((v) => + fromJS([String.fromCharCode(v), String.fromCharCode(v).toUpperCase()]) + ); + expect(letters.toJS()).toEqual(['a', 'A', 'b', 'B', 'c', 'C']); }); it('maps to sequenceables, not only Sequences.', () => { - var numbers = Range(97, 100); - // the map function returns an Array, rather than an Iterable. - // Array is sequenceable, so this works just fine. - var letters = numbers.flatMap(v => [ + const numbers = Range(97, 100); + // the map function returns an Array, rather than a Collection. + // Array is iterable, so this works just fine. + const letters = numbers.flatMap((v) => [ String.fromCharCode(v), - String.fromCharCode(v).toUpperCase() + String.fromCharCode(v).toUpperCase(), ]); - expect(letters.toJS()).toEqual( - ['a','A','b','B','c','C'] - ) + expect(letters.toJS()).toEqual(['a', 'A', 'b', 'B', 'c', 'C']); }); - }); - }); diff --git a/__tests__/fromJS.ts b/__tests__/fromJS.ts new file mode 100644 index 0000000000..90f70228e2 --- /dev/null +++ b/__tests__/fromJS.ts @@ -0,0 +1,81 @@ +import { describe, expect, it } from '@jest/globals'; +import { runInNewContext } from 'vm'; +import { List, Map, Set, isCollection, fromJS } from 'immutable'; + +describe('fromJS', () => { + it('convert Array to Immutable.List', () => { + const list = fromJS([1, 2, 3]); + expect(List.isList(list)).toBe(true); + expect(list.count()).toBe(3); + }); + + it('convert plain Object to Immutable.Map', () => { + const map = fromJS({ a: 'A', b: 'B', c: 'C' }); + expect(Map.isMap(map)).toBe(true); + expect(map.count()).toBe(3); + }); + + it('convert JS (global) Set to Immutable.Set', () => { + const set = fromJS(new global.Set([1, 2, 3])); + expect(Set.isSet(set)).toBe(true); + expect(set.count()).toBe(3); + }); + + it('convert JS (global) Map to Immutable.Map', () => { + const map = fromJS( + new global.Map([ + ['a', 'A'], + ['b', 'B'], + ['c', 'C'], + ]) + ); + expect(Map.isMap(map)).toBe(true); + expect(map.count()).toBe(3); + }); + + it('convert iterable to Immutable collection', () => { + function* values() { + yield 1; + yield 2; + yield 3; + } + const result = fromJS(values()); + expect(List.isList(result)).toBe(true); + expect(result.count()).toBe(3); + }); + + it('does not convert existing Immutable collections', () => { + const orderedSet = Set(['a', 'b', 'c']); + expect(fromJS(orderedSet)).toBe(orderedSet); + }); + + it('does not convert strings', () => { + expect(fromJS('abc')).toBe('abc'); + }); + + it('does not convert non-plain Objects', () => { + class Test {} + const result = fromJS(new Test()); + expect(isCollection(result)).toBe(false); + expect(result instanceof Test).toBe(true); + }); + + it('is iterable outside of a vm', () => { + expect(isCollection(fromJS({}))).toBe(true); + }); + + // eslint-disable-next-line jest/expect-expect + it('is iterable inside of a vm', () => { + runInNewContext( + ` + expect(isCollection(fromJS({}))).toBe(true); + `, + { + expect, + isCollection, + fromJS, + }, + {} + ); + }); +}); diff --git a/__tests__/functional/get.ts b/__tests__/functional/get.ts new file mode 100644 index 0000000000..901724f1c3 --- /dev/null +++ b/__tests__/functional/get.ts @@ -0,0 +1,37 @@ +import { describe, expect, it } from '@jest/globals'; +import { get, Map, List, Range } from 'immutable'; + +describe('get', () => { + it('for immutable structure', () => { + expect(get(Range(0, 100), 20)).toBe(20); + expect(get(List(['dog', 'frog', 'cat']), 1)).toBe('frog'); + expect(get(List(['dog', 'frog', 'cat']), 20)).toBeUndefined(); + expect(get(List(['dog', 'frog', 'cat']), 20, 'ifNotSet')).toBe('ifNotSet'); + + expect(get(Map({ x: 123, y: 456 }), 'x')).toBe(123); + }); + + it('for Array', () => { + expect(get(['dog', 'frog', 'cat'], 1)).toBe('frog'); + expect(get(['dog', 'frog', 'cat'], 20)).toBeUndefined(); + expect(get(['dog', 'frog', 'cat'], 20, 'ifNotSet')).toBe('ifNotSet'); + }); + + it('for plain objects', () => { + expect(get({ x: 123, y: 456 }, 'x')).toBe(123); + expect(get({ x: 123, y: 456 }, 'z', 'ifNotSet')).toBe('ifNotSet'); + + expect( + get( + { + x: 'xx', + y: 'yy', + get: function (key: string) { + return `${this[key].toUpperCase()}`; + }, + }, + 'x' + ) + ).toBe('XX'); + }); +}); diff --git a/__tests__/functional/has.ts b/__tests__/functional/has.ts new file mode 100644 index 0000000000..3d4f550dec --- /dev/null +++ b/__tests__/functional/has.ts @@ -0,0 +1,21 @@ +import { describe, expect, it } from '@jest/globals'; +import { has, Map, List, Range } from 'immutable'; + +describe('has', () => { + it('for immutable structure', () => { + expect(has(Range(0, 100), 20)).toBe(true); + expect(has(List(['dog', 'frog', 'cat']), 1)).toBe(true); + expect(has(List(['dog', 'frog', 'cat']), 20)).toBe(false); + + expect(has(Map({ x: 123, y: 456 }), 'x')).toBe(true); + }); + it('for Array', () => { + expect(has(['dog', 'frog', 'cat'], 1)).toBe(true); + expect(has(['dog', 'frog', 'cat'], 20)).toBe(false); + }); + + it('for plain objects', () => { + expect(has({ x: 123, y: 456 }, 'x')).toBe(true); + expect(has({ x: 123, y: 456 }, 'z')).toBe(false); + }); +}); diff --git a/__tests__/functional/remove.ts b/__tests__/functional/remove.ts new file mode 100644 index 0000000000..10674c695b --- /dev/null +++ b/__tests__/functional/remove.ts @@ -0,0 +1,19 @@ +import { describe, expect, it } from '@jest/globals'; +import { remove, List, Map } from 'immutable'; + +describe('remove', () => { + it('for immutable structure', () => { + expect(remove(List(['dog', 'frog', 'cat']), 1)).toEqual( + List(['dog', 'cat']) + ); + expect(remove(Map({ x: 123, y: 456 }), 'x')).toEqual(Map({ y: 456 })); + }); + + it('for Array', () => { + expect(remove(['dog', 'frog', 'cat'], 1)).toEqual(['dog', 'cat']); + }); + + it('for plain objects', () => { + expect(remove({ x: 123, y: 456 }, 'x')).toEqual({ y: 456 }); + }); +}); diff --git a/__tests__/functional/set.ts b/__tests__/functional/set.ts new file mode 100644 index 0000000000..154009880a --- /dev/null +++ b/__tests__/functional/set.ts @@ -0,0 +1,42 @@ +import { describe, expect, it } from '@jest/globals'; +import { set } from 'immutable'; + +describe('set', () => { + it('for immutable structure', () => { + const originalArray = ['dog', 'frog', 'cat']; + expect(set(originalArray, 1, 'cow')).toEqual(['dog', 'cow', 'cat']); + expect(set(originalArray, 4, 'cow')).toEqual([ + 'dog', + 'frog', + 'cat', + undefined, + 'cow', + ]); + expect(originalArray).toEqual(['dog', 'frog', 'cat']); + + const originalObject = { x: 123, y: 456 }; + expect(set(originalObject, 'x', 789)).toEqual({ x: 789, y: 456 }); + expect(set(originalObject, 'z', 789)).toEqual({ x: 123, y: 456, z: 789 }); + expect(originalObject).toEqual({ x: 123, y: 456 }); + }); + + it('for Array', () => { + const originalArray = ['dog', 'frog', 'cat']; + expect(set(originalArray, 1, 'cow')).toEqual(['dog', 'cow', 'cat']); + expect(set(originalArray, 4, 'cow')).toEqual([ + 'dog', + 'frog', + 'cat', + undefined, + 'cow', + ]); + expect(originalArray).toEqual(['dog', 'frog', 'cat']); + }); + + it('for plain objects', () => { + const originalObject = { x: 123, y: 456 }; + expect(set(originalObject, 'x', 789)).toEqual({ x: 789, y: 456 }); + expect(set(originalObject, 'z', 789)).toEqual({ x: 123, y: 456, z: 789 }); + expect(originalObject).toEqual({ x: 123, y: 456 }); + }); +}); diff --git a/__tests__/functional/update.ts b/__tests__/functional/update.ts new file mode 100644 index 0000000000..0ed9042e85 --- /dev/null +++ b/__tests__/functional/update.ts @@ -0,0 +1,40 @@ +import { describe, expect, it } from '@jest/globals'; +import { update } from 'immutable'; + +describe('update', () => { + it('for immutable structure', () => { + const originalArray = ['dog', 'frog', 'cat']; + expect(update(originalArray, 1, (val) => val?.toUpperCase())).toEqual([ + 'dog', + 'FROG', + 'cat', + ]); + expect(originalArray).toEqual(['dog', 'frog', 'cat']); + + const originalObject = { x: 123, y: 456 }; + expect(update(originalObject, 'x', (val) => val * 6)).toEqual({ + x: 738, + y: 456, + }); + expect(originalObject).toEqual({ x: 123, y: 456 }); + }); + + it('for Array', () => { + const originalArray = ['dog', 'frog', 'cat']; + expect(update(originalArray, 1, (val) => val?.toUpperCase())).toEqual([ + 'dog', + 'FROG', + 'cat', + ]); + expect(originalArray).toEqual(['dog', 'frog', 'cat']); + }); + + it('for plain objects', () => { + const originalObject = { x: 123, y: 456 }; + expect(update(originalObject, 'x', (val) => val * 6)).toEqual({ + x: 738, + y: 456, + }); + expect(originalObject).toEqual({ x: 123, y: 456 }); + }); +}); diff --git a/__tests__/get.ts b/__tests__/get.ts index 33defbd6ad..7853ad30ca 100644 --- a/__tests__/get.ts +++ b/__tests__/get.ts @@ -1,52 +1,49 @@ -/// - -import { Range } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Range } from 'immutable'; describe('get', () => { - it('gets any index', () => { - var seq = Range(0, 100); + const seq = Range(0, 100); expect(seq.get(20)).toBe(20); }); it('gets first', () => { - var seq = Range(0, 100); + const seq = Range(0, 100); expect(seq.first()).toBe(0); }); it('gets last', () => { - var seq = Range(0, 100); + const seq = Range(0, 100); expect(seq.last()).toBe(99); }); it('gets any index after reversing', () => { - var seq = Range(0, 100).reverse(); + const seq = Range(0, 100).reverse(); expect(seq.get(20)).toBe(79); }); it('gets first after reversing', () => { - var seq = Range(0, 100).reverse(); + const seq = Range(0, 100).reverse(); expect(seq.first()).toBe(99); }); it('gets last after reversing', () => { - var seq = Range(0, 100).reverse(); + const seq = Range(0, 100).reverse(); expect(seq.last()).toBe(0); }); it('gets any index when size is unknown', () => { - var seq = Range(0, 100).filter(x => x % 2 === 1); + const seq = Range(0, 100).filter((x) => x % 2 === 1); expect(seq.get(20)).toBe(41); }); it('gets first when size is unknown', () => { - var seq = Range(0, 100).filter(x => x % 2 === 1); + const seq = Range(0, 100).filter((x) => x % 2 === 1); expect(seq.first()).toBe(1); }); it('gets last when size is unknown', () => { - var seq = Range(0, 100).filter(x => x % 2 === 1); + const seq = Range(0, 100).filter((x) => x % 2 === 1); expect(seq.last()).toBe(99); // Note: this is O(N) }); - }); diff --git a/__tests__/getIn.ts b/__tests__/getIn.ts new file mode 100644 index 0000000000..57074034c6 --- /dev/null +++ b/__tests__/getIn.ts @@ -0,0 +1,97 @@ +import { describe, expect, it } from '@jest/globals'; +import { fromJS, getIn, List, Map } from 'immutable'; + +describe('getIn', () => { + it('deep get', () => { + const m = fromJS({ a: { b: { c: 10 } } }); + expect(m.getIn(['a', 'b', 'c'])).toEqual(10); + expect(getIn(m, ['a', 'b', 'c'])).toEqual(10); + }); + + it('deep get with list as keyPath', () => { + const m = fromJS({ a: { b: { c: 10 } } }); + expect(m.getIn(fromJS(['a', 'b', 'c']))).toEqual(10); + expect(getIn(m, fromJS(['a', 'b', 'c']))).toEqual(10); + }); + + it('deep get throws without list or array-like', () => { + // @ts-expect-error -- test that runtime does throw + expect(() => Map().getIn(undefined)).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: undefined' + ); + // @ts-expect-error -- test that runtime does throw + expect(() => Map().getIn({ a: 1, b: 2 })).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: [object Object]' + ); + // TODO: should expect error + expect(() => Map().getIn('abc')).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: abc' + ); + // TODO: should expect error + expect(() => getIn(Map(), 'abc')).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: abc' + ); + }); + + it('deep get returns not found if path does not match', () => { + const m = fromJS({ a: { b: { c: 10 } } }); + expect(m.getIn(['a', 'b', 'z'])).toEqual(undefined); + expect(m.getIn(['a', 'b', 'z'], 123)).toEqual(123); + expect(m.getIn(['a', 'y', 'z'])).toEqual(undefined); + expect(m.getIn(['a', 'y', 'z'], 123)).toEqual(123); + expect(getIn(m, ['a', 'y', 'z'])).toEqual(undefined); + expect(getIn(m, ['a', 'y', 'z'], 123)).toEqual(123); + }); + + it('does not use notSetValue when path does exist but value is nullable', () => { + const m = fromJS({ a: { b: { c: null, d: undefined } } }); + expect(m.getIn(['a', 'b', 'c'])).toEqual(null); + expect(m.getIn(['a', 'b', 'd'])).toEqual(undefined); + expect(m.getIn(['a', 'b', 'c'], 123)).toEqual(null); + expect(m.getIn(['a', 'b', 'd'], 123)).toEqual(undefined); + expect(getIn(m, ['a', 'b', 'c'], 123)).toEqual(null); + expect(getIn(m, ['a', 'b', 'd'], 123)).toEqual(undefined); + }); + + it('deep get returns not found if path encounters non-data-structure', () => { + const m = fromJS({ a: { b: { c: null, d: undefined } } }); + expect(m.getIn(['a', 'b', 'c', 'x'])).toEqual(undefined); + expect(m.getIn(['a', 'b', 'c', 'x'], 123)).toEqual(123); + expect(m.getIn(['a', 'b', 'd', 'x'])).toEqual(undefined); + expect(m.getIn(['a', 'b', 'd', 'x'], 123)).toEqual(123); + expect(getIn(m, ['a', 'b', 'd', 'x'])).toEqual(undefined); + expect(getIn(m, ['a', 'b', 'd', 'x'], 123)).toEqual(123); + + expect(getIn('a', ['length'])).toEqual(undefined); + expect(getIn(new Date(), ['getDate'])).toEqual(undefined); + }); + + it('gets in nested plain Objects and Arrays', () => { + const m = List([{ key: ['item'] }]); + expect(m.getIn([0, 'key', 0])).toEqual('item'); + }); + + it('deep get returns not found if non-existing path in nested plain Object', () => { + const deep = Map({ + key: { regular: 'jsobj' }, + list: List([Map({ num: 10 })]), + }); + expect(deep.getIn(['key', 'foo', 'item'])).toBe(undefined); + expect(deep.getIn(['key', 'foo', 'item'], 'notSet')).toBe('notSet'); + expect(deep.getIn(['list', 0, 'num', 'badKey'])).toBe(undefined); + expect(deep.getIn(['list', 0, 'num', 'badKey'], 'notSet')).toBe('notSet'); + }); + + it('gets in plain Objects and Arrays', () => { + const m = [{ key: ['item'] }]; + expect(getIn(m, [0, 'key', 0])).toEqual('item'); + }); + + it('deep get returns not found if non-existing path in plain Object', () => { + const deep = { key: { regular: 'jsobj' }, list: [{ num: 10 }] }; + expect(getIn(deep, ['key', 'foo', 'item'])).toBe(undefined); + expect(getIn(deep, ['key', 'foo', 'item'], 'notSet')).toBe('notSet'); + expect(getIn(deep, ['list', 0, 'num', 'badKey'])).toBe(undefined); + expect(getIn(deep, ['list', 0, 'num', 'badKey'], 'notSet')).toBe('notSet'); + }); +}); diff --git a/__tests__/groupBy.ts b/__tests__/groupBy.ts index daa2462885..bfaba132df 100644 --- a/__tests__/groupBy.ts +++ b/__tests__/groupBy.ts @@ -1,64 +1,107 @@ -/// - -import { Iterable, Seq, Map } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { + Collection, + Map, + Seq, + isOrdered, + OrderedMap, + List, + OrderedSet, + Set, + Stack, +} from 'immutable'; describe('groupBy', () => { + it.each` + constructor | constructorIsOrdered | isObject + ${Collection} | ${true} | ${false} + ${List} | ${true} | ${false} + ${Seq} | ${true} | ${false} + ${Set} | ${false} | ${false} + ${Stack} | ${true} | ${false} + ${OrderedSet} | ${true} | ${false} + ${Map} | ${false} | ${true} + ${OrderedMap} | ${true} | ${true} + `( + 'groupBy returns ordered or unordered of the base type is ordered or not: $constructor.name', + ({ constructor, constructorIsOrdered, isObject }) => { + const iterableConstructor = ['a', 'b', 'a', 'c']; + const objectConstructor = { a: 1, b: 2, c: 3, d: 1 }; + + const col = constructor( + isObject ? objectConstructor : iterableConstructor + ); + + const grouped = col.groupBy((v) => v); + + // all groupBy should be instance of Map + expect(grouped).toBeInstanceOf(Map); + + // ordered objects should be instance of OrderedMap + expect(isOrdered(col)).toBe(constructorIsOrdered); + expect(isOrdered(grouped)).toBe(constructorIsOrdered); + if (constructorIsOrdered) { + // eslint-disable-next-line jest/no-conditional-expect + expect(grouped).toBeInstanceOf(OrderedMap); + } else { + // eslint-disable-next-line jest/no-conditional-expect + expect(grouped).not.toBeInstanceOf(OrderedMap); + } + } + ); it('groups keyed sequence', () => { - var grouped = Seq({a:1,b:2,c:3,d:4}).groupBy(x => x % 2); - expect(grouped.toJS()).toEqual({1:{a:1,c:3}, 0:{b:2,d:4}}); + const grouped = Seq({ a: 1, b: 2, c: 3, d: 4 }).groupBy((x) => x % 2); + expect(grouped.toJS()).toEqual({ 1: { a: 1, c: 3 }, 0: { b: 2, d: 4 } }); // Each group should be a keyed sequence, not an indexed sequence - expect(grouped.get(1).toArray()).toEqual([1, 3]); - }) + const firstGroup = grouped.get(1); + expect(firstGroup && firstGroup.toArray()).toEqual([ + ['a', 1], + ['c', 3], + ]); + }); it('groups indexed sequence', () => { - expect( - Seq.of(1,2,3,4,5,6).groupBy(x => x % 2).toJS() - ).toEqual( - {1:[1,3,5], 0:[2,4,6]} - ); - }) + const group = Seq([1, 2, 3, 4, 5, 6]).groupBy((x) => x % 2); + + expect(group.toJS()).toEqual({ 1: [1, 3, 5], 0: [2, 4, 6] }); + }); it('groups to keys', () => { - expect( - Seq.of(1,2,3,4,5,6).groupBy(x => x % 2 ? 'odd' : 'even').toJS() - ).toEqual( - {odd:[1,3,5], even:[2,4,6]} + const group = Seq([1, 2, 3, 4, 5, 6]).groupBy((x) => + x % 2 ? 'odd' : 'even' ); - }) + expect(group.toJS()).toEqual({ odd: [1, 3, 5], even: [2, 4, 6] }); + }); - it('groups indexed sequences, maintaining indicies when keyed sequences', () => { - expect( - Seq.of(1,2,3,4,5,6).groupBy(x => x % 2).toJS() - ).toEqual( - {1:[1,3,5], 0:[2,4,6]} + it('allows `undefined` as a key', () => { + const group = Seq([1, 2, 3, 4, 5, 6]).groupBy((x) => + x % 2 ? undefined : 'even' ); - expect( - Seq.of(1,2,3,4,5,6).toKeyedSeq().groupBy(x => x % 2).toJS() - ).toEqual( - {1:{0:1, 2:3, 4:5}, 0:{1:2, 3:4, 5:6}} - ); - }) + expect(group.toJS()).toEqual({ undefined: [1, 3, 5], even: [2, 4, 6] }); + }); - it('has groups that can be mapped', () => { - expect( - Seq.of(1,2,3,4,5,6).groupBy(x => x % 2).map(group => group.map(value => value * 10)).toJS() - ).toEqual( - {1:[10,30,50], 0:[20,40,60]} - ); - }) + it('groups indexed sequences, maintaining indicies when keyed sequences', () => { + const group = Seq([1, 2, 3, 4, 5, 6]).groupBy((x) => x % 2); - it('returns an ordered map from an ordered collection', () => { - var seq = Seq.of('Z','Y','X','Z','Y','X'); - expect(Iterable.isOrdered(seq)).toBe(true); - var seqGroups = seq.groupBy(x => x); - expect(Iterable.isOrdered(seqGroups)).toBe(true); + expect(group.toJS()).toEqual({ 1: [1, 3, 5], 0: [2, 4, 6] }); - var map = Map({ x: 1, y: 2 }); - expect(Iterable.isOrdered(map)).toBe(false); - var mapGroups = map.groupBy(x => x); - expect(Iterable.isOrdered(mapGroups)).toBe(false); - }) + const keyedGroup = Seq([1, 2, 3, 4, 5, 6]) + .toKeyedSeq() + .groupBy((x) => x % 2); + + expect(keyedGroup.toJS()).toEqual({ + 1: { 0: 1, 2: 3, 4: 5 }, + 0: { 1: 2, 3: 4, 5: 6 }, + }); + }); + + it('has groups that can be mapped', () => { + const mappedGroup = Seq([1, 2, 3, 4, 5, 6]) + .groupBy((x) => x % 2) + .map((group) => group.map((value) => value * 10)); -}) + expect(mappedGroup.toJS()).toEqual({ 1: [10, 30, 50], 0: [20, 40, 60] }); + }); +}); diff --git a/__tests__/hasIn.ts b/__tests__/hasIn.ts new file mode 100644 index 0000000000..da2baa0a89 --- /dev/null +++ b/__tests__/hasIn.ts @@ -0,0 +1,63 @@ +import { describe, expect, it } from '@jest/globals'; +import { fromJS, hasIn, List, Map } from 'immutable'; + +describe('hasIn', () => { + it('deep has', () => { + const m = fromJS({ a: { b: { c: 10, d: undefined } } }); + expect(m.hasIn(['a', 'b', 'c'])).toEqual(true); + expect(m.hasIn(['a', 'b', 'd'])).toEqual(true); + expect(m.hasIn(['a', 'b', 'z'])).toEqual(false); + expect(m.hasIn(['a', 'y', 'z'])).toEqual(false); + expect(hasIn(m, ['a', 'b', 'c'])).toEqual(true); + expect(hasIn(m, ['a', 'b', 'z'])).toEqual(false); + }); + + it('deep has with list as keyPath', () => { + const m = fromJS({ a: { b: { c: 10 } } }); + expect(m.hasIn(fromJS(['a', 'b', 'c']))).toEqual(true); + expect(m.hasIn(fromJS(['a', 'b', 'z']))).toEqual(false); + expect(m.hasIn(fromJS(['a', 'y', 'z']))).toEqual(false); + expect(hasIn(m, fromJS(['a', 'b', 'c']))).toEqual(true); + expect(hasIn(m, fromJS(['a', 'y', 'z']))).toEqual(false); + }); + + it('deep has throws without list or array-like', () => { + // @ts-expect-error -- test that runtime does throw + expect(() => Map().hasIn(undefined)).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: undefined' + ); + // @ts-expect-error -- test that runtime does throw + expect(() => Map().hasIn({ a: 1, b: 2 })).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: [object Object]' + ); + // TODO: should expect error + expect(() => Map().hasIn('abc')).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: abc' + ); + // TODO: should expect error + expect(() => hasIn(Map(), 'abc')).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: abc' + ); + }); + + it('deep has does not throw if non-readable path', () => { + const deep = Map({ + key: { regular: 'jsobj' }, + list: List([Map({ num: 10 })]), + }); + expect(deep.hasIn(['key', 'foo', 'item'])).toBe(false); + expect(deep.hasIn(['list', 0, 'num', 'badKey'])).toBe(false); + expect(hasIn(deep, ['key', 'foo', 'item'])).toBe(false); + expect(hasIn(deep, ['list', 0, 'num', 'badKey'])).toBe(false); + }); + + it('deep has in plain Object and Array', () => { + const m = { a: { b: { c: [10, undefined], d: undefined } } }; + expect(hasIn(m, ['a', 'b', 'c', 0])).toEqual(true); + expect(hasIn(m, ['a', 'b', 'c', 1])).toEqual(true); + expect(hasIn(m, ['a', 'b', 'c', 2])).toEqual(false); + expect(hasIn(m, ['a', 'b', 'd'])).toEqual(true); + expect(hasIn(m, ['a', 'b', 'z'])).toEqual(false); + expect(hasIn(m, ['a', 'b', 'z'])).toEqual(false); + }); +}); diff --git a/__tests__/hash.ts b/__tests__/hash.ts new file mode 100644 index 0000000000..168ded87f1 --- /dev/null +++ b/__tests__/hash.ts @@ -0,0 +1,56 @@ +import { describe, expect, it } from '@jest/globals'; +import { hash } from 'immutable'; +import fc from 'fast-check'; + +describe('hash', () => { + it('stable hash of well known values', () => { + expect(hash(true)).toBe(0x42108421); + expect(hash(false)).toBe(0x42108420); + expect(hash(0)).toBe(0); + expect(hash(null)).toBe(0x42108422); + expect(hash(undefined)).toBe(0x42108423); + expect(hash('a')).toBe(97); + expect(hash('immutable-js')).toBe(510203252); + expect(hash(123)).toBe(123); + }); + + it('generates different hashes for decimal values', () => { + expect(hash(123.456)).toBe(884763256); + expect(hash(123.4567)).toBe(887769707); + }); + + it('generates different hashes for different objects', () => { + const objA = {}; + const objB = {}; + expect(hash(objA)).toBe(hash(objA)); + expect(hash(objA)).not.toBe(hash(objB)); + }); + + it('generates different hashes for different symbols', () => { + const symA = Symbol(); + + const symB = Symbol(); + expect(hash(symA)).toBe(hash(symA)); + expect(hash(symA)).not.toBe(hash(symB)); + }); + + it('generates different hashes for different functions', () => { + const funA = () => {}; + const funB = () => {}; + expect(hash(funA)).toBe(hash(funA)); + expect(hash(funA)).not.toBe(hash(funB)); + }); + + const genValue = fc.oneof(fc.string(), fc.integer()); + + it('generates unsigned 31-bit integers', () => { + fc.assert( + fc.property(genValue, (value) => { + const hashVal = hash(value); + expect(Number.isInteger(hashVal)).toBe(true); + expect(hashVal).toBeGreaterThan(-(2 ** 31)); + expect(hashVal).toBeLessThan(2 ** 31); + }) + ); + }); +}); diff --git a/__tests__/interpose.ts b/__tests__/interpose.ts index c9dacab513..a3698628af 100644 --- a/__tests__/interpose.ts +++ b/__tests__/interpose.ts @@ -1,21 +1,17 @@ -/// - -import { Range } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Range } from 'immutable'; describe('interpose', () => { - it('separates with a value', () => { - var range = Range(10, 15); - var interposed = range.interpose(0); - expect(interposed.toArray()).toEqual( - [ 10, 0, 11, 0, 12, 0, 13, 0, 14 ] - ); - }) + const range = Range(10, 15); + const interposed = range.interpose(0); + expect(interposed.toArray()).toEqual([10, 0, 11, 0, 12, 0, 13, 0, 14]); + }); it('can be iterated', () => { - var range = Range(10, 15); - var interposed = range.interpose(0); - var values = interposed.values(); + const range = Range(10, 15); + const interposed = range.interpose(0); + const values = interposed.values(); expect(values.next()).toEqual({ value: 10, done: false }); expect(values.next()).toEqual({ value: 0, done: false }); expect(values.next()).toEqual({ value: 11, done: false }); @@ -26,6 +22,5 @@ describe('interpose', () => { expect(values.next()).toEqual({ value: 0, done: false }); expect(values.next()).toEqual({ value: 14, done: false }); expect(values.next()).toEqual({ value: undefined, done: true }); - }) - -}) + }); +}); diff --git a/__tests__/issues.ts b/__tests__/issues.ts new file mode 100644 index 0000000000..e283378cfc --- /dev/null +++ b/__tests__/issues.ts @@ -0,0 +1,185 @@ +import { describe, expect, it } from '@jest/globals'; +import { + fromJS, + List, + Map, + OrderedMap, + OrderedSet, + Record, + Seq, + Set, +} from 'immutable'; + +describe('Issue #1175', () => { + it('invalid hashCode() response should not infinitly recurse', () => { + class BadHash { + equals() { + return false; + } + + hashCode() { + return 2 ** 32; + } + } + + const set = Set([new BadHash()]); + expect(set.size).toEqual(1); + }); +}); + +describe('Issue #1188', () => { + it('Removing items from OrderedSet should return OrderedSet', () => { + const orderedSet = OrderedSet(['one', 'two', 'three']); + const emptyOrderedSet = orderedSet.subtract(['two', 'three', 'one']); + expect(OrderedSet.isOrderedSet(emptyOrderedSet)).toBe(true); + }); +}); + +describe('Issue #1220 : Seq.rest() throws an exception when invoked on a single item sequence', () => { + it('should be iterable', () => { + // Helper for this test + const ITERATOR_SYMBOL = + (typeof Symbol === 'function' && Symbol.iterator) || '@@iterator'; + + const r = Seq([1]).rest(); + const i = r[ITERATOR_SYMBOL](); + expect(i.next()).toEqual({ value: undefined, done: true }); + }); +}); + +describe('Issue #1245', () => { + it('should return empty collection after takeLast(0)', () => { + const size = List(['a', 'b', 'c']).takeLast(0).size; + expect(size).toEqual(0); + }); +}); + +describe('Issue #1262', () => { + it('Set.subtract should accept an array', () => { + const MyType = Record({ val: 1 }); + const set1 = Set([ + MyType({ val: 1 }), + MyType({ val: 2 }), + MyType({ val: 3 }), + ]); + const set2 = set1.subtract([MyType({ val: 2 })]); + const set3 = set1.subtract(List([MyType({ val: 2 })])); + expect(set2).toEqual(set3); + }); +}); + +describe('Issue #1287', () => { + it('should skip all items in OrderedMap when skipping Infinity', () => { + const size = OrderedMap([['a', 1]]).skip(Infinity).size; + expect(size).toEqual(0); + }); +}); + +describe('Issue #1247', () => { + it('Records should not be considered altered after creation', () => { + const R = Record({ a: 1 }); + const r = new R(); + expect(r.wasAltered()).toBe(false); + }); +}); + +describe('Issue #1252', () => { + it('should be toString-able even if it contains a value which is not', () => { + const prototypelessObj = Object.create(null); + const list = List([prototypelessObj]); + expect(list.toString()).toBe('List [ {} ]'); + }); +}); + +describe('Issue #1293', () => { + it('merge() should not deeply coerce values', () => { + type StateObject = { foo: string | { qux: string }; biz?: string }; + const State = Record({ foo: 'bar', biz: 'baz' }); + const deepObject = { qux: 'quux' }; + + const firstState = State({ foo: deepObject }); + const secondState = State().merge({ foo: deepObject }); + + expect(secondState).toEqual(firstState); + }); +}); + +describe('Issue #1643', () => { + [ + ['a string', 'test'], + ['a number', 5], + ['null', null], + ['undefined', undefined], + ['a boolean', true], + ['an object', {}], + ['an array', []], + ['a function', () => null], + ].forEach(([label, value]) => { + class MyClass { + valueOf() { + return value; + } + } + + it(`Collection#hashCode() should handle objects that return ${label} for valueOf`, () => { + const set = Set().add(new MyClass()); + expect(() => set.hashCode()).not.toThrow(); + }); + }); +}); + +describe('Issue #1785', () => { + it('merge() should not return undefined', () => { + const emptyRecord = Record({})(); + + expect(emptyRecord.merge({ id: 1 })).toBe(emptyRecord); + }); +}); + +describe('Issue #1475', () => { + it('complex case should return first value on mergeDeep when types are incompatible', () => { + const a = fromJS({ + ch: [ + { + code: 8, + }, + ], + }) as Map; + const b = fromJS({ + ch: { + code: 8, + }, + }); + expect(a.mergeDeep(b).equals(b)).toBe(true); + }); + + it('simple case should return first value on mergeDeep when types are incompatible', () => { + const a = fromJS({ + ch: [], + }) as Map; + const b = fromJS({ + ch: { code: 8 }, + }); + expect(a.merge(b).equals(b)).toBe(true); + }); +}); + +describe('Issue #1719', () => { + it('mergeDeep() should overwrite when types conflict', () => { + const objWithObj = fromJS({ + items: { + '1': { + id: '1', + }, + }, + }) as Map; + const objWithArray = fromJS({ + items: [ + { + id: '1', + }, + ], + }); + expect(objWithObj.mergeDeep(objWithArray).equals(objWithArray)).toBe(true); + }); +}); diff --git a/__tests__/join.ts b/__tests__/join.ts index 147559c26f..4d6d472835 100644 --- a/__tests__/join.ts +++ b/__tests__/join.ts @@ -1,32 +1,52 @@ -/// - -import jasmineCheck = require('jasmine-check'); -jasmineCheck.install(); - -import { Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { Seq } from 'immutable'; +import fc from 'fast-check'; describe('join', () => { - it('string-joins sequences with commas by default', () => { - expect(Seq.of(1,2,3,4,5).join()).toBe('1,2,3,4,5'); - }) + expect(Seq([1, 2, 3, 4, 5]).join()).toBe('1,2,3,4,5'); + }); it('string-joins sequences with any string', () => { - expect(Seq.of(1,2,3,4,5).join('foo')).toBe('1foo2foo3foo4foo5'); - }) + expect(Seq([1, 2, 3, 4, 5]).join('foo')).toBe('1foo2foo3foo4foo5'); + }); it('string-joins sequences with empty string', () => { - expect(Seq.of(1,2,3,4,5).join('')).toBe('12345'); - }) + expect(Seq([1, 2, 3, 4, 5]).join('')).toBe('12345'); + }); it('joins sparse-sequences like Array.join', () => { - var a = [1,,2,,3,,4,,5,,,]; + const a = [ + 1, + undefined, + 2, + undefined, + 3, + undefined, + 4, + undefined, + 5, + undefined, + undefined, + ]; expect(Seq(a).join()).toBe(a.join()); - }) - - check.it('behaves the same as Array.join', - [gen.array(gen.primitive), gen.primitive], (array, joiner) => { - expect(Seq(array).join(joiner)).toBe(array.join(joiner)); - }) - -}) + }); + + const genPrimitive = fc.oneof( + fc.string(), + fc.integer(), + fc.boolean(), + fc.constant(null), + fc.constant(undefined), + fc.constant(NaN) + ); + + it('behaves the same as Array.join', () => { + fc.assert( + fc.property(fc.array(genPrimitive), genPrimitive, (array, joiner) => { + // @ts-expect-error unexpected values for typescript joiner, but valid at runtime despite the unexpected errors + expect(Seq(array).join(joiner)).toBe(array.join(joiner)); + }) + ); + }); +}); diff --git a/__tests__/merge.ts b/__tests__/merge.ts index 64c7b6f5c5..14e934b4c0 100644 --- a/__tests__/merge.ts +++ b/__tests__/merge.ts @@ -1,147 +1,349 @@ -/// - -import { List, Map, fromJS, is } from '../'; - -declare function expect(val: any): ExpectWithIs; - -interface ExpectWithIs extends Expect { - is(expected: any): void; - not: ExpectWithIs; -} - -jasmine.addMatchers({ - is: function() { - return { - compare: function(actual, expected) { - var passed = is(actual, expected); - return { - pass: passed, - message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected - }; - } - }; - } -}); +import { describe, expect, it } from '@jest/globals'; +import { + fromJS, + List, + Map, + merge, + mergeDeep, + mergeDeepWith, + Record, + Set, +} from 'immutable'; describe('merge', () => { it('merges two maps', () => { - var m1 = Map({a:1,b:2,c:3}); - var m2 = Map({d:10,b:20,e:30}); - expect(m1.merge(m2)).is(Map({a:1,b:20,c:3,d:10,e:30})); - }) + const m1 = Map({ a: 1, b: 2, c: 3 }); + const m2 = Map({ d: 10, b: 20, e: 30 }); + expect(m1.merge(m2)).toEqual(Map({ a: 1, b: 20, c: 3, d: 10, e: 30 })); + }); it('can merge in an explicitly undefined value', () => { - var m1 = Map({a:1,b:2}); - var m2 = Map({a:undefined}); - expect(m1.merge(m2)).is(Map({a:undefined,b:2})); - }) + const m1 = Map({ a: 1, b: 2 }); + const m2 = Map({ a: undefined }); + expect(m1.merge(m2)).toEqual(Map({ a: undefined, b: 2 })); + }); it('merges two maps with a merge function', () => { - var m1 = Map({a:1,b:2,c:3}); - var m2 = Map({d:10,b:20,e:30}); - expect(m1.mergeWith((a, b) => a + b, m2)).is(Map({a:1,b:22,c:3,d:10,e:30})); - }) + const m1 = Map({ a: 1, b: 2, c: 3 }); + const m2 = Map({ d: 10, b: 20, e: 30 }); + expect(m1.mergeWith((a: number, b: number) => a + b, m2)).toEqual( + Map({ a: 1, b: 22, c: 3, d: 10, e: 30 }) + ); + }); + + it('throws typeError without merge function', () => { + const m1 = Map({ a: 1, b: 2, c: 3 }); + const m2 = Map({ d: 10, b: 20, e: 30 }); + // @ts-expect-error -- test that runtime does throw + expect(() => m1.mergeWith(1, m2)).toThrow(TypeError); + }); it('provides key as the third argument of merge function', () => { - var m1 = Map({id:'temp', b:2, c:3}); - var m2 = Map({id:10, b:20, e:30}); - var add = (a, b) => a + b + const m1 = Map({ id: 'temp', b: 2, c: 3 }); + const m2 = Map({ id: 10, b: 20, e: 30 }); + const add = (a: number, b: number) => a + b; expect( - m1.mergeWith((a, b, key) => key !== 'id' ? add(a, b) : b, m2) - ).is(Map({id:10,b:22,c:3,e:30})); - }) + // @ts-expect-error -- it's difficult to type `a` not as `string | number` + m1.mergeWith((a, b, key) => (key !== 'id' ? add(a, b) : b), m2) + ).toEqual(Map({ id: 10, b: 22, c: 3, e: 30 })); + }); it('deep merges two maps', () => { - var m1 = fromJS({a:{b:{c:1,d:2}}}); - var m2 = fromJS({a:{b:{c:10,e:20},f:30},g:40}); - expect(m1.mergeDeep(m2)).is(fromJS({a:{b:{c:10,d:2,e:20},f:30},g:40})); - }) - - it('deep merge uses is() for return-self optimization', () => { - var date1 = new Date(1234567890000); - var date2 = new Date(1234567890000); - var m = Map().setIn(['a', 'b', 'c'], date1); - var m2 = m.mergeDeep({a:{b:{c: date2 }}}); - expect(m2 === m).toBe(true); - }) + const m1 = fromJS({ a: { b: { c: 1, d: 2 } } }); + const m2 = fromJS({ a: { b: { c: 10, e: 20 }, f: 30 }, g: 40 }); + expect(m1.mergeDeep(m2)).toEqual( + fromJS({ a: { b: { c: 10, d: 2, e: 20 }, f: 30 }, g: 40 }) + ); + }); + + it('merge uses === for return-self optimization', () => { + const date1 = new Date(1234567890000); + // Value equal, but different reference. + const date2 = new Date(1234567890000); + const m = Map().set('a', date1); + expect(m.merge({ a: date2 })).not.toBe(m); + expect(m.merge({ a: date1 })).toBe(m); + }); + + it('deep merge uses === for return-self optimization', () => { + const date1 = new Date(1234567890000); + // Value equal, but different reference. + const date2 = new Date(1234567890000); + const m = Map().setIn(['a', 'b', 'c'], date1); + expect(m.mergeDeep({ a: { b: { c: date2 } } })).not.toBe(m); + expect(m.mergeDeep({ a: { b: { c: date1 } } })).toBe(m); + }); it('deep merges raw JS', () => { - var m1 = fromJS({a:{b:{c:1,d:2}}}); - var js = {a:{b:{c:10,e:20},f:30},g:40}; - expect(m1.mergeDeep(js)).is(fromJS({a:{b:{c:10,d:2,e:20},f:30},g:40})); - }) + const m1 = fromJS({ a: { b: { c: 1, d: 2 } } }); + const js = { a: { b: { c: 10, e: 20 }, f: 30 }, g: 40 }; + expect(m1.mergeDeep(js)).toEqual( + fromJS({ a: { b: { c: 10, d: 2, e: 20 }, f: 30 }, g: 40 }) + ); + }); it('deep merges raw JS with a merge function', () => { - var m1 = fromJS({a:{b:{c:1,d:2}}}); - var js = {a:{b:{c:10,e:20},f:30},g:40}; - expect( - m1.mergeDeepWith((a, b) => a + b, js) - ).is(fromJS( - {a:{b:{c:11,d:2,e:20},f:30},g:40} - )); - }) + const m1 = fromJS({ a: { b: { c: 1, d: 2 } } }); + const js = { a: { b: { c: 10, e: 20 }, f: 30 }, g: 40 }; + // @ts-expect-error type of `mergeDeepWith` is too lazy for now + expect(m1.mergeDeepWith((a: number, b: number) => a + b, js)).toEqual( + fromJS({ a: { b: { c: 11, d: 2, e: 20 }, f: 30 }, g: 40 }) + ); + }); + + it('deep merges raw JS into raw JS with a merge function', () => { + const js1 = { a: { b: { c: 1, d: 2 } } }; + const js2 = { a: { b: { c: 10, e: 20 }, f: 30 }, g: 40 }; + // @ts-expect-error type of `mergeDeepWith` is too lazy for now + expect(mergeDeepWith((a: number, b: number) => a + b, js1, js2)).toEqual({ + a: { b: { c: 11, d: 2, e: 20 }, f: 30 }, + g: 40, + }); + }); + + it('deep merges collections into raw JS with a merge function', () => { + const js = { a: { b: { c: 1, d: 2 } } }; + const m = fromJS({ a: { b: { c: 10, e: 20 }, f: 30 }, g: 40 }); + // @ts-expect-error type of `mergeDeepWith` is too lazy for now + expect(mergeDeepWith((a: number, b: number) => a + b, js, m)).toEqual({ + a: { b: { c: 11, d: 2, e: 20 }, f: 30 }, + g: 40, + }); + }); it('returns self when a deep merges is a no-op', () => { - var m1 = fromJS({a:{b:{c:1,d:2}}}); - expect( - m1.mergeDeep({a:{b:{c:1}}}) - ).toBe(m1); - }) + const m1 = fromJS({ a: { b: { c: 1, d: 2 } } }); + expect(m1.mergeDeep({ a: { b: { c: 1 } } })).toBe(m1); + }); it('returns arg when a deep merges is a no-op', () => { - var m1 = fromJS({a:{b:{c:1,d:2}}}); - expect( - Map().mergeDeep(m1) - ).toBe(m1); - }) + const m1 = fromJS({ a: { b: { c: 1, d: 2 } } }); + expect(Map().mergeDeep(m1)).toBe(m1); + }); + + it('returns self when a deep merges is a no-op on raw JS', () => { + const m1 = { a: { b: { c: 1, d: 2 } } }; + expect(mergeDeep(m1, { a: { b: { c: 1 } } })).toBe(m1); + }); it('can overwrite existing maps', () => { expect( - fromJS({ a: { x: 1, y: 1 }, b: { x: 2, y: 2 } }) - .merge({ a: null, b: { x: 10 } }) - .toJS() - ).toEqual( - { a: null, b: { x: 10 } } - ); + fromJS({ a: { x: 1, y: 1 }, b: { x: 2, y: 2 } }).merge({ + a: null, + b: Map({ x: 10 }), + }) + ).toEqual(fromJS({ a: null, b: { x: 10 } })); expect( - fromJS({ a: { x: 1, y: 1 }, b: { x: 2, y: 2 } }) - .mergeDeep({ a: null, b: { x: 10 } }) - .toJS() - ).toEqual( - { a: null, b: { x: 10, y: 2 } } - ); - }) + fromJS({ a: { x: 1, y: 1 }, b: { x: 2, y: 2 } }).mergeDeep({ + a: null, + b: { x: 10 }, + }) + ).toEqual(fromJS({ a: null, b: { x: 10, y: 2 } })); + }); it('can overwrite existing maps with objects', () => { - var m1 = fromJS({ a: { x: 1, y: 1 } }); // deep conversion. - var m2 = Map({ a: { z: 10 } }); // shallow conversion to Map. + const m1 = fromJS({ a: { x: 1, y: 1 } }); // deep conversion. + const m2 = Map({ a: { z: 10 } }); // shallow conversion to Map. - // raw object simply replaces map. - expect(m1.merge(m2).get('a')).toEqual({z: 10}) // raw object. - expect(m1.mergeDeep(m2).get('a')).toEqual({z: 10}) // raw object. - }) + // Raw object simply replaces map. + expect(m1.merge(m2).get('a')).toEqual({ z: 10 }); // raw object. + // However, mergeDeep will merge that value into the inner Map. + expect(m1.mergeDeep(m2).get('a')).toEqual(Map({ x: 1, y: 1, z: 10 })); + }); - it('merges map entries with Vector values', () => { - expect( - fromJS({a:[1]}).merge({b:[2]}) - ).is(fromJS( - {a:[1], b:[2]} - )); - expect( - fromJS({a:[1]}).mergeDeep({b:[2]}) - ).is(fromJS( - {a:[1], b:[2]} - )); - }) + it('merges map entries with List and Set values', () => { + const initial = Map({ + a: Map({ x: 10, y: 20 }), + b: List([1, 2, 3]), + c: Set([1, 2, 3]), + }); + const additions = Map({ + a: Map({ y: 50, z: 100 }), + b: List([4, 5, 6]), + c: Set([4, 5, 6]), + }); + expect(initial.mergeDeep(additions)).toEqual( + Map({ + a: Map({ x: 10, y: 50, z: 100 }), + b: List([1, 2, 3, 4, 5, 6]), + c: Set([1, 2, 3, 4, 5, 6]), + }) + ); + }); + + it('merges map entries with new values', () => { + const initial = Map({ a: List([1]) }); + + // Note: merge and mergeDeep do not deeply coerce values, they only merge + // with what's there prior. + expect(initial.merge({ b: [2] })).toEqual(Map({ a: List([1]), b: [2] })); + expect(initial.mergeDeep({ b: [2] })).toEqual( + fromJS(Map({ a: List([1]), b: [2] })) + ); + }); it('maintains JS values inside immutable collections', () => { - var m1 = fromJS({a:{b:[{imm:'map'}]}}); - var m2 = m1.mergeDeep( - Map({a: Map({b: List.of( {plain:'obj'} )})}) + const m1 = fromJS({ a: { b: { imm: 'map' } } }); + const m2 = m1.mergeDeep(Map({ a: Map({ b: { plain: 'obj' } }) })); + + expect(m1.getIn(['a', 'b'])).toEqual(Map([['imm', 'map']])); + // However mergeDeep will merge that value into the inner Map + expect(m2.getIn(['a', 'b'])).toEqual(Map({ imm: 'map', plain: 'obj' })); + }); + + it('merges plain Objects', () => { + expect(merge({ x: 1, y: 1 }, { y: 2, z: 2 }, Map({ z: 3, q: 3 }))).toEqual({ + x: 1, + y: 2, + z: 3, + q: 3, + }); + }); + + it('merges plain Arrays', () => { + expect(merge([1, 2], [3, 4], List([5, 6]))).toEqual([1, 2, 3, 4, 5, 6]); + }); + + it('merging plain Array returns self after no-op', () => { + const a = [1, 2, 3]; + expect(merge(a, [], [])).toBe(a); + }); + + it('merges records with a size property set to 0', () => { + const Sizable = Record({ size: 0 }); + expect(Sizable().merge({ size: 123 }).size).toBe(123); + }); + + it('mergeDeep merges partial conflicts', () => { + const a = fromJS({ + ch: [ + { + code: 8, + }, + ], + banana: 'good', + }) as Map; + const b = fromJS({ + ch: { + code: 8, + }, + apple: 'anti-doctor', + }); + expect( + a.mergeDeep(b).equals( + fromJS({ + ch: { + code: 8, + }, + apple: 'anti-doctor', + banana: 'good', + }) + ) + ).toBe(true); + }); + + const map = { type: 'Map', value: Map({ b: 5, c: 9 }) }; + const object = { type: 'object', value: { b: 7, d: 12 } }; + const RecordFactory = Record({ a: 1, b: 2 }); + const record = { type: 'Record', value: RecordFactory({ b: 3 }) }; + const list = { type: 'List', value: List(['5']) }; + const array = { type: 'array', value: ['9'] }; + const set = { type: 'Set', value: Set('3') }; + + const incompatibleTypes = [ + [map, list], + [map, array], + [map, set], + [object, list], + [object, array], + [object, set], + [record, list], + [record, array], + [record, set], + [list, set], + ]; + + for (const [ + { type: type1, value: value1 }, + { type: type2, value: value2 }, + ] of incompatibleTypes) { + it(`mergeDeep and Map#mergeDeep replaces ${type1} and ${type2} with each other`, () => { + const aObject = { a: value1 }; + const bObject = { a: value2 }; + expect(mergeDeep(aObject, bObject)).toEqual(bObject); + expect(mergeDeep(bObject, aObject)).toEqual(aObject); + + const aMap = Map({ a: value1 }); + const bMap = Map({ a: value2 }); + expect(aMap.mergeDeep(bMap).equals(bMap)).toBe(true); + expect(bMap.mergeDeep(aMap).equals(aMap)).toBe(true); + }); + } + + const compatibleTypesAndResult = [ + [map, object, Map({ b: 7, c: 9, d: 12 })], + [map, record, Map({ a: 1, b: 3, c: 9 })], + [object, map, { b: 5, c: 9, d: 12 }], + [object, record, { a: 1, b: 3, d: 12 }], + [record, map, RecordFactory({ b: 5 })], + [record, object, RecordFactory({ b: 7 })], + [list, array, List(['5', '9'])], + [array, list, ['9', '5']], + [map, { type: 'Map', value: Map({ b: 7 }) }, Map({ b: 7, c: 9 })], + [object, { type: 'object', value: { d: 3 } }, { b: 7, d: 3 }], + [ + record, + { type: 'Record', value: RecordFactory({ a: 3 }) }, + RecordFactory({ a: 3, b: 2 }), + ], + [list, { type: 'List', value: List(['12']) }, List(['5', '12'])], + [array, { type: 'array', value: ['3'] }, ['9', '3']], + [set, { type: 'Set', value: Set(['3', '5']) }, Set(['3', '5'])], + ] as const; + + for (const [ + { type: type1, value: value1 }, + { type: type2, value: value2 }, + result, + ] of compatibleTypesAndResult) { + it(`mergeDeep and Map#mergeDeep merges ${type1} and ${type2}`, () => { + const aObject = { a: value1 }; + const bObject = { a: value2 }; + expect(mergeDeep(aObject, bObject)).toEqual({ a: result }); + + const aMap = Map({ a: value1 }); + const bMap = Map({ a: value2 }); + expect(aMap.mergeDeep(bMap)).toEqual(Map({ a: result })); + }); + } + + it('Map#mergeDeep replaces nested List with Map and Map with List', () => { + const a = Map({ a: List([Map({ x: 1 })]) }); + const b = Map({ a: Map([[0, Map({ y: 2 })]]) }); + expect(a.mergeDeep(b).equals(b)).toBe(true); + expect(b.mergeDeep(a).equals(a)).toBe(true); + }); + + it('functional mergeDeep replaces nested array with Map', () => { + const a = { a: [{ x: 1 }] }; + const b = Map({ a: Map([[0, Map({ y: 2 })]]) }); + expect(mergeDeep(a, b)).toEqual({ a: Map([[0, Map({ y: 2 })]]) }); + }); + + it('works with an empty Record', () => { + class MyRecord extends Record({ a: 1 }) {} + + const myRecord = new MyRecord(); + expect(merge(myRecord, { a: 4 })).toEqual( + new MyRecord({ + a: 4, + }) ); - expect(m1.getIn(['a', 'b', 0])).is(Map([['imm', 'map']])); - expect(m2.getIn(['a', 'b', 0])).toEqual({plain: 'obj'}); - }) + class MyEmptyRecord extends Record({}) {} -}) + const myEmptyRecord = new MyEmptyRecord(); + // merging with an empty record should return the same empty record instance + expect(merge(myEmptyRecord, { a: 4 })).toBe(myEmptyRecord); + }); +}); diff --git a/__tests__/minmax.ts b/__tests__/minmax.ts index 25e6e90250..9a4c7a3c59 100644 --- a/__tests__/minmax.ts +++ b/__tests__/minmax.ts @@ -1,124 +1,126 @@ -/// +import { describe, expect, it } from '@jest/globals'; +import { is, Seq } from 'immutable'; +import fc from 'fast-check'; -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Seq, is } from '../'; - -var genHeterogeneousishArray = gen.oneOf([ - gen.array(gen.oneOf([gen.string, gen.undefined])), - gen.array(gen.oneOf([gen.int, gen.NaN])) -]); +const genHeterogeneousishArray = fc.oneof( + fc.sparseArray(fc.string()), + fc.array(fc.oneof(fc.integer(), fc.constant(NaN))) +); describe('max', () => { - it('returns max in a sequence', () => { - expect(Seq([1,9,2,8,3,7,4,6,5]).max()).toBe(9); + expect(Seq([1, 9, 2, 8, 3, 7, 4, 6, 5]).max()).toBe(9); }); it('accepts a comparator', () => { - expect(Seq([1,9,2,8,3,7,4,6,5]).max((a, b) => b - a)).toBe(1); + expect(Seq([1, 9, 2, 8, 3, 7, 4, 6, 5]).max((a, b) => b - a)).toBe(1); }); it('by a mapper', () => { - var family = Seq([ + const family = Seq([ { name: 'Oakley', age: 7 }, { name: 'Dakota', age: 7 }, { name: 'Casey', age: 34 }, { name: 'Avery', age: 34 }, - ]) - expect(family.maxBy(p => p.age).name).toBe('Casey'); + ]); + expect(family.maxBy((p) => p.age)).toBe(family.get(2)); }); it('by a mapper and a comparator', () => { - var family = Seq([ + const family = Seq([ { name: 'Oakley', age: 7 }, { name: 'Dakota', age: 7 }, { name: 'Casey', age: 34 }, { name: 'Avery', age: 34 }, - ]) - expect(family.maxBy(p => p.age, (a, b) => b - a).name).toBe('Oakley'); + ]); + expect( + family.maxBy( + (p) => p.age, + (a, b) => b - a + ) + ).toBe(family.get(0)); }); it('surfaces NaN, null, and undefined', () => { - expect( - is(NaN, Seq.of(1, 2, 3, 4, 5, NaN).max()) - ).toBe(true); - expect( - is(NaN, Seq.of(NaN, 1, 2, 3, 4, 5).max()) - ).toBe(true); - expect( - is(null, Seq.of('A', 'B', 'C', 'D', null).max()) - ).toBe(true); - expect( - is(null, Seq.of(null, 'A', 'B', 'C', 'D').max()) - ).toBe(true); + expect(is(NaN, Seq([1, 2, 3, 4, 5, NaN]).max())).toBe(true); + expect(is(NaN, Seq([NaN, 1, 2, 3, 4, 5]).max())).toBe(true); + expect(is(null, Seq(['A', 'B', 'C', 'D', null]).max())).toBe(true); + expect(is(null, Seq([null, 'A', 'B', 'C', 'D']).max())).toBe(true); }); it('null treated as 0 in default iterator', () => { - expect( - is(2, Seq.of(-1, -2, null, 1, 2).max()) - ).toBe(true); + expect(is(2, Seq([-1, -2, null, 1, 2]).max())).toBe(true); }); - check.it('is not dependent on order', [genHeterogeneousishArray], vals => { - expect( - is( - Seq(shuffle(vals.slice())).max(), - Seq(vals).max() - ) - ).toEqual(true); + it('is not dependent on order', () => { + fc.assert( + fc.property(genHeterogeneousishArray, (vals) => { + expect( + is( + Seq(shuffle(vals.slice())).max(), + Seq(vals).max() + ) + ).toEqual(true); + }) + ); }); - }); describe('min', () => { - it('returns min in a sequence', () => { - expect(Seq([1,9,2,8,3,7,4,6,5]).min()).toBe(1); + expect(Seq([1, 9, 2, 8, 3, 7, 4, 6, 5]).min()).toBe(1); }); it('accepts a comparator', () => { - expect(Seq([1,9,2,8,3,7,4,6,5]).min((a, b) => b - a)).toBe(9); + expect(Seq([1, 9, 2, 8, 3, 7, 4, 6, 5]).min((a, b) => b - a)).toBe(9); }); it('by a mapper', () => { - var family = Seq([ + const family = Seq([ { name: 'Oakley', age: 7 }, { name: 'Dakota', age: 7 }, { name: 'Casey', age: 34 }, { name: 'Avery', age: 34 }, - ]) - expect(family.minBy(p => p.age).name).toBe('Oakley'); + ]); + expect(family.minBy((p) => p.age)).toBe(family.get(0)); }); it('by a mapper and a comparator', () => { - var family = Seq([ + const family = Seq([ { name: 'Oakley', age: 7 }, { name: 'Dakota', age: 7 }, { name: 'Casey', age: 34 }, { name: 'Avery', age: 34 }, - ]) - expect(family.minBy(p => p.age, (a, b) => b - a).name).toBe('Casey'); - }); - - check.it('is not dependent on order', [genHeterogeneousishArray], vals => { + ]); expect( - is( - Seq(shuffle(vals.slice())).min(), - Seq(vals).min() + family.minBy( + (p) => p.age, + (a, b) => b - a ) - ).toEqual(true); + ).toBe(family.get(2)); }); + it('is not dependent on order', () => { + fc.assert( + fc.property(genHeterogeneousishArray, (vals) => { + expect( + is( + Seq(shuffle(vals.slice())).min(), + Seq(vals).min() + ) + ).toEqual(true); + }) + ); + }); }); -function shuffle(array) { - var m = array.length, t, i; +function shuffle>(array: A): A { + let m = array.length; + let t; + let i; // While there remain elements to shuffle… while (m) { - // Pick a remaining element… i = Math.floor(Math.random() * m--); diff --git a/__tests__/partition.ts b/__tests__/partition.ts new file mode 100644 index 0000000000..0a59b3d8ec --- /dev/null +++ b/__tests__/partition.ts @@ -0,0 +1,102 @@ +import { beforeEach, describe, expect, it, jest } from '@jest/globals'; +import { + isAssociative, + isIndexed, + isKeyed, + isList, + isMap, + isSeq, + isSet, + List, + Map as IMap, + Seq, + Set as ISet, +} from 'immutable'; + +describe('partition', () => { + let isOdd: jest.Mock<(x: number) => number>; + + beforeEach(() => { + isOdd = jest.fn((x) => x % 2); + }); + + it('partitions keyed sequence', () => { + const parts = Seq({ a: 1, b: 2, c: 3, d: 4 }).partition(isOdd); + expect(isKeyed(parts[0])).toBe(true); + expect(isSeq(parts[0])).toBe(true); + expect(parts.map((part) => part.toJS())).toEqual([ + { b: 2, d: 4 }, + { a: 1, c: 3 }, + ]); + expect(isOdd.mock.calls.length).toBe(4); + + // Each group should be a keyed sequence, not an indexed sequence + const trueGroup = parts[1]; + expect(trueGroup && trueGroup.toArray()).toEqual([ + ['a', 1], + ['c', 3], + ]); + }); + + it('partitions indexed sequence', () => { + const parts = Seq([1, 2, 3, 4, 5, 6]).partition(isOdd); + expect(isIndexed(parts[0])).toBe(true); + expect(isSeq(parts[0])).toBe(true); + expect(parts.map((part) => part.toJS())).toEqual([ + [2, 4, 6], + [1, 3, 5], + ]); + expect(isOdd.mock.calls.length).toBe(6); + }); + + it('partitions set sequence', () => { + const parts = Seq.Set([1, 2, 3, 4, 5, 6]).partition(isOdd); + expect(isAssociative(parts[0])).toBe(false); + expect(isSeq(parts[0])).toBe(true); + expect(parts.map((part) => part.toJS())).toEqual([ + [2, 4, 6], + [1, 3, 5], + ]); + expect(isOdd.mock.calls.length).toBe(6); + }); + + it('partitions keyed collection', () => { + const parts = IMap({ a: 1, b: 2, c: 3, d: 4 }).partition(isOdd); + expect(isMap(parts[0])).toBe(true); + expect(isSeq(parts[0])).toBe(false); + expect(parts.map((part) => part.toJS())).toEqual([ + { b: 2, d: 4 }, + { a: 1, c: 3 }, + ]); + expect(isOdd.mock.calls.length).toBe(4); + + // Each group should be a keyed collection, not an indexed collection + const trueGroup = parts[1]; + expect(trueGroup && trueGroup.toArray()).toEqual([ + ['a', 1], + ['c', 3], + ]); + }); + + it('partitions indexed collection', () => { + const parts = List([1, 2, 3, 4, 5, 6]).partition(isOdd); + expect(isList(parts[0])).toBe(true); + expect(isSeq(parts[0])).toBe(false); + expect(parts.map((part) => part.toJS())).toEqual([ + [2, 4, 6], + [1, 3, 5], + ]); + expect(isOdd.mock.calls.length).toBe(6); + }); + + it('partitions set collection', () => { + const parts = ISet([1, 2, 3, 4, 5, 6]).partition(isOdd); + expect(isSet(parts[0])).toBe(true); + expect(isSeq(parts[0])).toBe(false); + expect(parts.map((part) => part.toJS().sort())).toEqual([ + [2, 4, 6], + [1, 3, 5], + ]); + expect(isOdd.mock.calls.length).toBe(6); + }); +}); diff --git a/__tests__/slice.ts b/__tests__/slice.ts index ec12fa9bb7..07b763ff58 100644 --- a/__tests__/slice.ts +++ b/__tests__/slice.ts @@ -1,174 +1,299 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { List, Range, Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { List, Range, Seq } from 'immutable'; +import fc from 'fast-check'; describe('slice', () => { - it('slices a sequence', () => { - expect(Seq.of(1,2,3,4,5,6).slice(2).toArray()).toEqual([3,4,5,6]); - expect(Seq.of(1,2,3,4,5,6).slice(2, 4).toArray()).toEqual([3,4]); - expect(Seq.of(1,2,3,4,5,6).slice(-3, -1).toArray()).toEqual([4,5]); - expect(Seq.of(1,2,3,4,5,6).slice(-1).toArray()).toEqual([6]); - expect(Seq.of(1,2,3,4,5,6).slice(0, -1).toArray()).toEqual([1,2,3,4,5]); - }) + expect(Seq([1, 2, 3, 4, 5, 6]).slice(2).toArray()).toEqual([3, 4, 5, 6]); + expect(Seq([1, 2, 3, 4, 5, 6]).slice(2, 4).toArray()).toEqual([3, 4]); + expect(Seq([1, 2, 3, 4, 5, 6]).slice(-3, -1).toArray()).toEqual([4, 5]); + expect(Seq([1, 2, 3, 4, 5, 6]).slice(-1).toArray()).toEqual([6]); + expect(Seq([1, 2, 3, 4, 5, 6]).slice(0, -1).toArray()).toEqual([ + 1, 2, 3, 4, 5, + ]); + }); it('creates an immutable stable sequence', () => { - var seq = Seq.of(1,2,3,4,5,6); - var sliced = seq.slice(2, -2); + const seq = Seq([1, 2, 3, 4, 5, 6]); + const sliced = seq.slice(2, -2); expect(sliced.toArray()).toEqual([3, 4]); expect(sliced.toArray()).toEqual([3, 4]); expect(sliced.toArray()).toEqual([3, 4]); - }) + }); it('slices a sparse indexed sequence', () => { - expect(Seq([1,,2,,3,,4,,5,,6]).slice(1).toArray()).toEqual([,2,,3,,4,,5,,6]); - expect(Seq([1,,2,,3,,4,,5,,6]).slice(2).toArray()).toEqual([2,,3,,4,,5,,6]); - expect(Seq([1,,2,,3,,4,,5,,6]).slice(3, -3).toArray()).toEqual([,3,,4,,]); // one trailing hole. - }) + expect( + Seq([ + 1, + undefined, + 2, + undefined, + 3, + undefined, + 4, + undefined, + 5, + undefined, + 6, + ]) + .slice(1) + .toArray() + ).toEqual([ + undefined, + 2, + undefined, + 3, + undefined, + 4, + undefined, + 5, + undefined, + 6, + ]); + expect( + Seq([ + 1, + undefined, + 2, + undefined, + 3, + undefined, + 4, + undefined, + 5, + undefined, + 6, + ]) + .slice(2) + .toArray() + ).toEqual([2, undefined, 3, undefined, 4, undefined, 5, undefined, 6]); + expect( + Seq([ + 1, + undefined, + 2, + undefined, + 3, + undefined, + 4, + undefined, + 5, + undefined, + 6, + ]) + .slice(3, -3) + .toArray() + ).toEqual([undefined, 3, undefined, 4, undefined]); // one trailing hole. + }); it('can maintain indices for an keyed indexed sequence', () => { - expect(Seq.of(1,2,3,4,5,6).toKeyedSeq().slice(2).entrySeq().toArray()).toEqual([ - [2,3], - [3,4], - [4,5], - [5,6], + expect( + Seq([1, 2, 3, 4, 5, 6]).toKeyedSeq().slice(2).entrySeq().toArray() + ).toEqual([ + [2, 3], + [3, 4], + [4, 5], + [5, 6], ]); - expect(Seq.of(1,2,3,4,5,6).toKeyedSeq().slice(2, 4).entrySeq().toArray()).toEqual([ - [2,3], - [3,4], + expect( + Seq([1, 2, 3, 4, 5, 6]).toKeyedSeq().slice(2, 4).entrySeq().toArray() + ).toEqual([ + [2, 3], + [3, 4], ]); - }) + }); it('slices an unindexed sequence', () => { - expect(Seq({a:1,b:2,c:3}).slice(1).toObject()).toEqual({b:2,c:3}); - expect(Seq({a:1,b:2,c:3}).slice(1, 2).toObject()).toEqual({b:2}); - expect(Seq({a:1,b:2,c:3}).slice(0, 2).toObject()).toEqual({a:1,b:2}); - expect(Seq({a:1,b:2,c:3}).slice(-1).toObject()).toEqual({c:3}); - expect(Seq({a:1,b:2,c:3}).slice(1, -1).toObject()).toEqual({b:2}); - }) + expect(Seq({ a: 1, b: 2, c: 3 }).slice(1).toObject()).toEqual({ + b: 2, + c: 3, + }); + expect(Seq({ a: 1, b: 2, c: 3 }).slice(1, 2).toObject()).toEqual({ b: 2 }); + expect(Seq({ a: 1, b: 2, c: 3 }).slice(0, 2).toObject()).toEqual({ + a: 1, + b: 2, + }); + expect(Seq({ a: 1, b: 2, c: 3 }).slice(-1).toObject()).toEqual({ c: 3 }); + expect(Seq({ a: 1, b: 2, c: 3 }).slice(1, -1).toObject()).toEqual({ b: 2 }); + }); it('is reversable', () => { - expect(Seq.of(1,2,3,4,5,6).slice(2).reverse().toArray()).toEqual([6,5,4,3]); - expect(Seq.of(1,2,3,4,5,6).slice(2, 4).reverse().toArray()).toEqual([4,3]); - expect(Seq.of(1,2,3,4,5,6).toKeyedSeq().slice(2).reverse().entrySeq().toArray()).toEqual([ - [5,6], - [4,5], - [3,4], - [2,3], + expect(Seq([1, 2, 3, 4, 5, 6]).slice(2).reverse().toArray()).toEqual([ + 6, 5, 4, 3, ]); - expect(Seq.of(1,2,3,4,5,6).toKeyedSeq().slice(2, 4).reverse().entrySeq().toArray()).toEqual([ - [3,4], - [2,3], + expect(Seq([1, 2, 3, 4, 5, 6]).slice(2, 4).reverse().toArray()).toEqual([ + 4, 3, ]); - }) + expect( + Seq([1, 2, 3, 4, 5, 6]) + .toKeyedSeq() + .slice(2) + .reverse() + .entrySeq() + .toArray() + ).toEqual([ + [5, 6], + [4, 5], + [3, 4], + [2, 3], + ]); + expect( + Seq([1, 2, 3, 4, 5, 6]) + .toKeyedSeq() + .slice(2, 4) + .reverse() + .entrySeq() + .toArray() + ).toEqual([ + [3, 4], + [2, 3], + ]); + }); it('slices a list', () => { - expect(List.of(1,2,3,4,5,6).slice(2).toArray()).toEqual([3,4,5,6]); - expect(List.of(1,2,3,4,5,6).slice(2, 4).toArray()).toEqual([3,4]); - }) + expect(List([1, 2, 3, 4, 5, 6]).slice(2).toArray()).toEqual([3, 4, 5, 6]); + expect(List([1, 2, 3, 4, 5, 6]).slice(2, 4).toArray()).toEqual([3, 4]); + }); it('returns self for whole slices', () => { - var s = Seq.of(1,2,3); + const s = Seq([1, 2, 3]); expect(s.slice(0)).toBe(s); expect(s.slice(0, 3)).toBe(s); expect(s.slice(-4, 4)).toBe(s); - var v = List.of(1,2,3); + const v = List([1, 2, 3]); expect(v.slice(-4, 4)).toBe(v); expect(v.slice(-3)).toBe(v); expect(v.slice(-4, 4).toList()).toBe(v); - }) + }); it('creates a sliced list in O(log32(n))', () => { - expect(List.of(1,2,3,4,5).slice(-3, -1).toList().toArray()).toEqual([3,4]); - }) + expect(List([1, 2, 3, 4, 5]).slice(-3, -1).toList().toArray()).toEqual([ + 3, 4, + ]); + }); it('has the same behavior as array slice in known edge cases', () => { - var a = Range(0, 33).toArray(); - var v = List(a); + const a = Range(0, 33).toArray(); + const v = List(a); expect(v.slice(31).toList().toArray()).toEqual(a.slice(31)); - }) + }); it('does not slice by floating-point numbers', () => { - var seq = Seq([0,1,2,3,4,5]); - var sliced = seq.slice(0, 2.6); + const seq = Seq([0, 1, 2, 3, 4, 5]); + const sliced = seq.slice(0, 2.6); expect(sliced.size).toEqual(2); expect(sliced.toArray()).toEqual([0, 1]); - }) + }); it('can create an iterator', () => { - var seq = Seq([0,1,2,3,4,5]); - var iterFront = seq.slice(0,2).values(); - expect(iterFront.next()).toEqual({value: 0, done: false}); - expect(iterFront.next()).toEqual({value: 1, done: false}); - expect(iterFront.next()).toEqual({value: undefined, done: true}); - - var iterMiddle = seq.slice(2,4).values(); - expect(iterMiddle.next()).toEqual({value: 2, done: false}); - expect(iterMiddle.next()).toEqual({value: 3, done: false}); - expect(iterMiddle.next()).toEqual({value: undefined, done: true}); - - var iterTail = seq.slice(4,123456).values(); - expect(iterTail.next()).toEqual({value: 4, done: false}); - expect(iterTail.next()).toEqual({value: 5, done: false}); - expect(iterTail.next()).toEqual({value: undefined, done: true}); - }) - - check.it('works like Array.prototype.slice', - [gen.int, gen.array(gen.oneOf([gen.int, gen.undefined]), 0, 3)], - (valuesLen, args) => { - var a = Range(0, valuesLen).toArray(); - var v = List(a); - var slicedV = v.slice.apply(v, args); - var slicedA = a.slice.apply(a, args); - expect(slicedV.toArray()).toEqual(slicedA); - }) - - check.it('works like Array.prototype.slice on sparse array input', - [gen.array(gen.array([gen.posInt, gen.int])), - gen.array(gen.oneOf([gen.int, gen.undefined]), 0, 3)], - (entries, args) => { - var a = []; - entries.forEach(entry => a[entry[0]] = entry[1]); - var s = Seq(a); - var slicedS = s.slice.apply(s, args); - var slicedA = a.slice.apply(a, args); - expect(slicedS.toArray()).toEqual(slicedA); - }) + const seq = Seq([0, 1, 2, 3, 4, 5]); + const iterFront = seq.slice(0, 2).values(); + expect(iterFront.next()).toEqual({ value: 0, done: false }); + expect(iterFront.next()).toEqual({ value: 1, done: false }); + expect(iterFront.next()).toEqual({ value: undefined, done: true }); - describe('take', () => { + const iterMiddle = seq.slice(2, 4).values(); + expect(iterMiddle.next()).toEqual({ value: 2, done: false }); + expect(iterMiddle.next()).toEqual({ value: 3, done: false }); + expect(iterMiddle.next()).toEqual({ value: undefined, done: true }); + + const iterTail = seq.slice(4, 123456).values(); + expect(iterTail.next()).toEqual({ value: 4, done: false }); + expect(iterTail.next()).toEqual({ value: 5, done: false }); + expect(iterTail.next()).toEqual({ value: undefined, done: true }); + }); - check.it('takes the first n from a list', [gen.int, gen.posInt], (len, num) => { - var a = Range(0, len).toArray(); - var v = List(a); - expect(v.take(num).toArray()).toEqual(a.slice(0, num)); - }) + it('stops the entries iterator when the sequence has an undefined end', () => { + let seq = Seq([0, 1, 2, 3, 4, 5]); + // flatMap is lazy and thus the resulting sequence has no size. + seq = seq.flatMap((a) => [a]); + expect(seq.size).toEqual(undefined); + + const iterFront = seq.slice(0, 2).entries(); + expect(iterFront.next()).toEqual({ value: [0, 0], done: false }); + expect(iterFront.next()).toEqual({ value: [1, 1], done: false }); + expect(iterFront.next()).toEqual({ value: undefined, done: true }); + + const iterMiddle = seq.slice(2, 4).entries(); + expect(iterMiddle.next()).toEqual({ value: [0, 2], done: false }); + expect(iterMiddle.next()).toEqual({ value: [1, 3], done: false }); + expect(iterMiddle.next()).toEqual({ value: undefined, done: true }); + + const iterTail = seq.slice(4, 123456).entries(); + expect(iterTail.next()).toEqual({ value: [0, 4], done: false }); + expect(iterTail.next()).toEqual({ value: [1, 5], done: false }); + expect(iterTail.next()).toEqual({ value: undefined, done: true }); + }); + + it('works like Array.prototype.slice', () => { + fc.assert( + fc.property( + fc.integer({ min: -1000, max: 1000 }), + fc.sparseArray(fc.integer({ min: -1000, max: 1000 }), { maxLength: 3 }), + (valuesLen, args) => { + const a = Range(0, valuesLen).toArray(); + const v = List(a); + const slicedV = v.slice.apply(v, args); + const slicedA = a.slice.apply(a, args); + expect(slicedV.toArray()).toEqual(slicedA); + } + ) + ); + }); + + it('works like Array.prototype.slice on sparse array input', () => { + fc.assert( + fc.property( + fc.array(fc.tuple(fc.nat(1000), fc.integer({ min: -1000, max: 1000 }))), + fc.sparseArray(fc.integer({ min: -1000, max: 1000 }), { maxLength: 3 }), + (entries, args) => { + const a: Array = []; + entries.forEach((entry) => (a[entry[0]] = entry[1])); + const s = Seq(a); + const slicedS = s.slice.apply(s, args); + const slicedA = a.slice.apply(a, args); + expect(slicedS.toArray()).toEqual(slicedA); + } + ) + ); + }); + + describe('take', () => { + it('takes the first n from a list', () => { + fc.assert( + fc.property( + fc.integer({ min: -1000, max: 1000 }), + fc.nat(1000), + (len, num) => { + const a = Range(0, len).toArray(); + const v = List(a); + expect(v.take(num).toArray()).toEqual(a.slice(0, num)); + } + ) + ); + }); it('creates an immutable stable sequence', () => { - var seq = Seq.of(1,2,3,4,5,6); - var sliced = seq.take(3); + const seq = Seq([1, 2, 3, 4, 5, 6]); + const sliced = seq.take(3); expect(sliced.toArray()).toEqual([1, 2, 3]); expect(sliced.toArray()).toEqual([1, 2, 3]); expect(sliced.toArray()).toEqual([1, 2, 3]); - }) + }); it('converts to array with correct length', () => { - var seq = Seq.of(1,2,3,4,5,6); - var s1 = seq.take(3); - var s2 = seq.take(10); - var sn = seq.take(Infinity); - var s3 = seq.filter((v) => v < 4).take(10); - var s4 = seq.filter((v) => v < 4).take(2); + const seq = Seq([1, 2, 3, 4, 5, 6]); + const s1 = seq.take(3); + const s2 = seq.take(10); + const sn = seq.take(Infinity); + const s3 = seq.filter((v) => v < 4).take(10); + const s4 = seq.filter((v) => v < 4).take(2); expect(s1.toArray().length).toEqual(3); expect(s2.toArray().length).toEqual(6); expect(sn.toArray().length).toEqual(6); expect(s3.toArray().length).toEqual(3); expect(s4.toArray().length).toEqual(2); - }) - - }) - -}) + }); + }); +}); diff --git a/__tests__/sort.ts b/__tests__/sort.ts index f1506d2b92..0a5afbf9ad 100644 --- a/__tests__/sort.ts +++ b/__tests__/sort.ts @@ -1,43 +1,78 @@ -/// - -import { Seq, List, OrderedMap, Range } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { List, OrderedMap, Range, Seq } from 'immutable'; describe('sort', () => { - it('sorts a sequence', () => { - expect(Seq.of(4,5,6,3,2,1).sort().toArray()).toEqual([1,2,3,4,5,6]); - }) + expect(Seq([4, 5, 6, 3, 2, 1]).sort().toArray()).toEqual([ + 1, 2, 3, 4, 5, 6, + ]); + }); it('sorts a list', () => { - expect(List.of(4,5,6,3,2,1).sort().toArray()).toEqual([1,2,3,4,5,6]); - }) + expect(List([4, 5, 6, 3, 2, 1]).sort().toArray()).toEqual([ + 1, 2, 3, 4, 5, 6, + ]); + }); it('sorts undefined values last', () => { - expect(List.of(4,undefined,5,6,3,undefined,2,1).sort().toArray()).toEqual([1,2,3,4,5,6,undefined,undefined]); - }) + expect( + List([4, undefined, 5, 6, 3, undefined, 2, 1]).sort().toArray() + ).toEqual([1, 2, 3, 4, 5, 6, undefined, undefined]); + }); it('sorts a keyed sequence', () => { - expect(Seq({z:1,y:2,x:3,c:3,b:2,a:1}).sort().entrySeq().toArray()) - .toEqual([['z', 1],['a', 1],['y', 2],['b', 2],['x', 3],['c', 3]]); - }) + expect( + Seq({ z: 1, y: 2, x: 3, c: 3, b: 2, a: 1 }).sort().entrySeq().toArray() + ).toEqual([ + ['z', 1], + ['a', 1], + ['y', 2], + ['b', 2], + ['x', 3], + ['c', 3], + ]); + }); it('sorts an OrderedMap', () => { - expect(OrderedMap({z:1,y:2,x:3,c:3,b:2,a:1}).sort().entrySeq().toArray()) - .toEqual([['z', 1],['a', 1],['y', 2],['b', 2],['x', 3],['c', 3]]); - }) + expect( + OrderedMap({ z: 1, y: 2, x: 3, c: 3, b: 2, a: 1 }) + .sort() + .entrySeq() + .toArray() + ).toEqual([ + ['z', 1], + ['a', 1], + ['y', 2], + ['b', 2], + ['x', 3], + ['c', 3], + ]); + }); it('accepts a sort function', () => { - expect(Seq.of(4,5,6,3,2,1).sort((a, b) => b - a).toArray()).toEqual([6,5,4,3,2,1]); - }) + expect( + Seq([4, 5, 6, 3, 2, 1]) + .sort((a, b) => b - a) + .toArray() + ).toEqual([6, 5, 4, 3, 2, 1]); + }); it('sorts by using a mapper', () => { - expect(Range(1,10).sortBy(v => v % 3).toArray()) - .toEqual([3,6,9,1,4,7,2,5,8]); - }) + expect( + Range(1, 10) + .sortBy((v) => v % 3) + .toArray() + ).toEqual([3, 6, 9, 1, 4, 7, 2, 5, 8]); + }); it('sorts by using a mapper and a sort function', () => { - expect(Range(1,10).sortBy(v => v % 3, (a: number, b: number) => b - a).toArray()) - .toEqual([2,5,8,1,4,7,3,6,9]); - }) - -}) + expect( + Range(1, 10) + .sortBy( + (v) => v % 3, + (a: number, b: number) => b - a + ) + .toArray() + ).toEqual([2, 5, 8, 1, 4, 7, 3, 6, 9]); + }); +}); diff --git a/__tests__/splice.ts b/__tests__/splice.ts index 0824f44888..cb90281016 100644 --- a/__tests__/splice.ts +++ b/__tests__/splice.ts @@ -1,42 +1,65 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { List, Range, Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { List, Range, Seq } from 'immutable'; +import fc from 'fast-check'; describe('splice', () => { - it('splices a sequence only removing elements', () => { - expect(Seq.of(1,2,3).splice(0,1).toArray()).toEqual([2,3]); - expect(Seq.of(1,2,3).splice(1,1).toArray()).toEqual([1,3]); - expect(Seq.of(1,2,3).splice(2,1).toArray()).toEqual([1,2]); - expect(Seq.of(1,2,3).splice(3,1).toArray()).toEqual([1,2,3]); - }) + expect(Seq([1, 2, 3]).splice(0, 1).toArray()).toEqual([2, 3]); + expect(Seq([1, 2, 3]).splice(1, 1).toArray()).toEqual([1, 3]); + expect(Seq([1, 2, 3]).splice(2, 1).toArray()).toEqual([1, 2]); + expect(Seq([1, 2, 3]).splice(3, 1).toArray()).toEqual([1, 2, 3]); + }); it('splices a list only removing elements', () => { - expect(List.of(1,2,3).splice(0,1).toArray()).toEqual([2,3]); - expect(List.of(1,2,3).splice(1,1).toArray()).toEqual([1,3]); - expect(List.of(1,2,3).splice(2,1).toArray()).toEqual([1,2]); - expect(List.of(1,2,3).splice(3,1).toArray()).toEqual([1,2,3]); - }) + expect(List([1, 2, 3]).splice(0, 1).toArray()).toEqual([2, 3]); + expect(List([1, 2, 3]).splice(1, 1).toArray()).toEqual([1, 3]); + expect(List([1, 2, 3]).splice(2, 1).toArray()).toEqual([1, 2]); + expect(List([1, 2, 3]).splice(3, 1).toArray()).toEqual([1, 2, 3]); + }); + + it('splicing by infinity', () => { + const l = List(['a', 'b', 'c', 'd']); + expect(l.splice(2, Infinity, 'x').toArray()).toEqual(['a', 'b', 'x']); + expect(l.splice(Infinity, 2, 'x').toArray()).toEqual([ + 'a', + 'b', + 'c', + 'd', + 'x', + ]); + + const s = List(['a', 'b', 'c', 'd']); + expect(s.splice(2, Infinity, 'x').toArray()).toEqual(['a', 'b', 'x']); + expect(s.splice(Infinity, 2, 'x').toArray()).toEqual([ + 'a', + 'b', + 'c', + 'd', + 'x', + ]); + }); it('has the same behavior as array splice in known edge cases', () => { - // arbitary numbers that sum to 31 - var a = Range(0, 49).toArray(); - var v = List(a); + // arbitrary numbers that sum to 31 + const a = Range(0, 49).toArray(); + const v = List(a); a.splice(-18, 0, 0); expect(v.splice(-18, 0, 0).toList().toArray()).toEqual(a); - }) - - check.it('has the same behavior as array splice', - [gen.array(gen.int), gen.array(gen.oneOf([gen.int, gen.undefined]))], - (values, args) => { - var v = List(values); - var a = values.slice(); // clone - var splicedV = v.splice.apply(v, args); // persistent - a.splice.apply(a, args); // mutative - expect(splicedV.toArray()).toEqual(a); - }) + }); -}) + it('has the same behavior as array splice', () => { + fc.assert( + fc.property( + fc.array(fc.integer()), + fc.array(fc.sparseArray(fc.integer())), + (values, args) => { + const v = List(values); + const a = values.slice(); // clone + const splicedV = v.splice.apply(v, args); // persistent + a.splice.apply(a, args); // mutative + expect(splicedV.toArray()).toEqual(a); + } + ) + ); + }); +}); diff --git a/__tests__/transformerProtocol.ts b/__tests__/transformerProtocol.ts new file mode 100644 index 0000000000..c3cedb3577 --- /dev/null +++ b/__tests__/transformerProtocol.ts @@ -0,0 +1,101 @@ +import { describe, expect, it } from '@jest/globals'; +import * as t from 'transducers-js'; +import { List, Map, Set, Stack } from 'immutable'; + +describe('Transformer Protocol', () => { + it('transduces Stack without initial values', () => { + const s = Stack.of(1, 2, 3, 4); + const xform = t.comp( + t.filter((x) => x % 2 === 0), + t.map((x) => x + 1) + ); + const s2 = t.transduce(xform, Stack(), s); + expect(s.toArray()).toEqual([1, 2, 3, 4]); + expect(s2.toArray()).toEqual([5, 3]); + }); + + it('transduces Stack with initial values', () => { + const v1 = Stack.of(1, 2, 3); + const v2 = Stack.of(4, 5, 6, 7); + const xform = t.comp( + t.filter((x) => x % 2 === 0), + t.map((x) => x + 1) + ); + const r = t.transduce(xform, Stack(), v1, v2); + expect(v1.toArray()).toEqual([1, 2, 3]); + expect(v2.toArray()).toEqual([4, 5, 6, 7]); + expect(r.toArray()).toEqual([7, 5, 1, 2, 3]); + }); + + it('transduces List without initial values', () => { + const v = List.of(1, 2, 3, 4); + const xform = t.comp( + t.filter((x) => x % 2 === 0), + t.map((x) => x + 1) + ); + const r = t.transduce(xform, List(), v); + expect(v.toArray()).toEqual([1, 2, 3, 4]); + expect(r.toArray()).toEqual([3, 5]); + }); + + it('transduces List with initial values', () => { + const v1 = List.of(1, 2, 3); + const v2 = List.of(4, 5, 6, 7); + const xform = t.comp( + t.filter((x) => x % 2 === 0), + t.map((x) => x + 1) + ); + const r = t.transduce(xform, List(), v1, v2); + expect(v1.toArray()).toEqual([1, 2, 3]); + expect(v2.toArray()).toEqual([4, 5, 6, 7]); + expect(r.toArray()).toEqual([1, 2, 3, 5, 7]); + }); + + it('transduces Map without initial values', () => { + const m1 = Map({ a: 1, b: 2, c: 3, d: 4 }); + const xform = t.comp( + t.filter(([_k, v]) => v % 2 === 0), + t.map(([k, v]) => [k, v * 2]) + ); + const m2 = t.transduce(xform, Map(), m1); + expect(m1.toObject()).toEqual({ a: 1, b: 2, c: 3, d: 4 }); + expect(m2.toObject()).toEqual({ b: 4, d: 8 }); + }); + + it('transduces Map with initial values', () => { + const m1 = Map({ a: 1, b: 2, c: 3 }); + const m2 = Map({ a: 4, b: 5 }); + const xform = t.comp( + t.filter(([_k, v]) => v % 2 === 0), + t.map(([k, v]) => [k, v * 2]) + ); + const m3 = t.transduce(xform, Map(), m1, m2); + expect(m1.toObject()).toEqual({ a: 1, b: 2, c: 3 }); + expect(m2.toObject()).toEqual({ a: 4, b: 5 }); + expect(m3.toObject()).toEqual({ a: 8, b: 2, c: 3 }); + }); + + it('transduces Set without initial values', () => { + const s1 = Set.of(1, 2, 3, 4); + const xform = t.comp( + t.filter((x) => x % 2 === 0), + t.map((x) => x + 1) + ); + const s2 = t.transduce(xform, Set(), s1); + expect(s1.toArray()).toEqual([1, 2, 3, 4]); + expect(s2.toArray()).toEqual([3, 5]); + }); + + it('transduces Set with initial values', () => { + const s1 = Set.of(1, 2, 3, 4); + const s2 = Set.of(2, 3, 4, 5, 6); + const xform = t.comp( + t.filter((x) => x % 2 === 0), + t.map((x) => x + 1) + ); + const s3 = t.transduce(xform, Set(), s1, s2); + expect(s1.toArray()).toEqual([1, 2, 3, 4]); + expect(s2.toArray()).toEqual([2, 3, 4, 5, 6]); + expect(s3.toArray()).toEqual([1, 2, 3, 4, 5, 7]); + }); +}); diff --git a/__tests__/ts-utils.ts b/__tests__/ts-utils.ts new file mode 100644 index 0000000000..d4cc759e68 --- /dev/null +++ b/__tests__/ts-utils.ts @@ -0,0 +1,7 @@ +import { expect } from '@jest/globals'; + +export function expectToBeDefined( + arg: T +): asserts arg is Exclude { + expect(arg).toBeDefined(); +} diff --git a/__tests__/tsconfig.json b/__tests__/tsconfig.json new file mode 100644 index 0000000000..78742cd9bd --- /dev/null +++ b/__tests__/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "noEmit": true, + // TODO: add additional strictness + "strictNullChecks": true, + "strictFunctionTypes": true, + "target": "esnext", + "moduleResolution": "node", + "skipLibCheck": true, + "paths": { + "immutable": ["../type-definitions/immutable.d.ts"] + } + } +} diff --git a/__tests__/updateIn.ts b/__tests__/updateIn.ts index 29ee7eda8f..1ca054f979 100644 --- a/__tests__/updateIn.ts +++ b/__tests__/updateIn.ts @@ -1,297 +1,457 @@ -/// - -import { Map, Set, fromJS } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { + fromJS, + List, + Map, + MapOf, + removeIn, + Seq, + Set, + setIn, + updateIn, +} from 'immutable'; describe('updateIn', () => { + it('deep edit', () => { + const m = fromJS({ a: { b: { c: 10 } } }); + expect( + // @ts-expect-error -- type of fromJS may return a MapOf in the future, to help `updateIn` to work, `updateIn` should copy the comportment of `getIn` + m.updateIn(['a', 'b', 'c'], (value: number) => value * 2).toJS() + ).toEqual({ + a: { b: { c: 20 } }, + }); + }); - it('deep get', () => { - var m = fromJS({a: {b: {c: 10}}}); - expect(m.getIn(['a', 'b', 'c'])).toEqual(10); - }) + it('deep edit with list as keyPath', () => { + const m = fromJS({ a: { b: { c: 10 } } }); + expect( + // @ts-expect-error -- type of fromJS may return a MapOf in the future, to help `updateIn` to work, `updateIn` should copy the comportment of `getIn` + m.updateIn(fromJS(['a', 'b', 'c']), (value: number) => value * 2).toJS() + ).toEqual({ a: { b: { c: 20 } } }); + }); - it('deep get with list as keyPath', () => { - var m = fromJS({a: {b: {c: 10}}}); - expect(m.getIn(fromJS(['a', 'b', 'c']))).toEqual(10); - }) + it('deep edit in raw JS', () => { + const m = { a: { b: { c: [10] } } }; + expect( + updateIn(m, ['a', 'b', 'c', 0], (value: number) => value * 2) + ).toEqual({ + a: { b: { c: [20] } }, + }); + }); - it('deep get throws without list or array-like', () => { - // need to cast these as TypeScript first prevents us from such clownery. - expect(() => - Map().getIn(undefined) - ).toThrow('Expected iterable or array-like: undefined'); - expect(() => - Map().getIn({ a: 1, b: 2 }) - ).toThrow('Expected iterable or array-like: [object Object]'); - }) + it('deep edit throws without list or array-like', () => { + // @ts-expect-error -- test that runtime does throw + expect(() => Map().updateIn(undefined, (x) => x)).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: undefined' + ); + // @ts-expect-error -- test that runtime does th + expect(() => Map().updateIn({ a: 1, b: 2 }, (x) => x)).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: [object Object]' + ); + expect(() => Map().updateIn('abc', (x) => x)).toThrow( + 'Invalid keyPath: expected Ordered Collection or Array: abc' + ); + }); - it('deep has throws without list or array-like', () => { - // need to cast these as TypeScript first prevents us from such clownery. - expect(() => - Map().hasIn(undefined) - ).toThrow('Expected iterable or array-like: undefined'); - expect(() => - Map().hasIn({ a: 1, b: 2 }) - ).toThrow('Expected iterable or array-like: [object Object]'); - }) + it('deep edit throws if non-editable path', () => { + const deep = Map({ key: Set([List(['item'])]) }); + expect(() => deep.updateIn(['key', 'foo', 'item'], () => 'newval')).toThrow( + 'Cannot update immutable value without .set() method: Set { List [ "item" ] }' + ); - it('deep get returns not found if path does not match', () => { - var m = fromJS({a: {b: {c: 10}}}); - expect(m.getIn(['a', 'b', 'z'])).toEqual(undefined); - expect(m.getIn(['a', 'b', 'c', 'd'])).toEqual(undefined); - }) + const deepSeq = Map({ key: Seq([List(['item'])]) }); + expect(() => + deepSeq.updateIn(['key', 'foo', 'item'], () => 'newval') + ).toThrow( + 'Cannot update immutable value without .set() method: Seq [ List [ "item" ] ]' + ); - it('deep edit', () => { - var m = fromJS({a: {b: {c: 10}}}); - expect( - m.updateIn(['a', 'b', 'c'], value => value * 2).toJS() - ).toEqual( - {a: {b: {c: 20}}} + const nonObj = Map({ key: 123 }); + expect(() => nonObj.updateIn(['key', 'foo'], () => 'newval')).toThrow( + 'Cannot update within non-data-structure value in path ["key"]: 123' ); - }) + }); - it('deep edit with list as keyPath', () => { - var m = fromJS({a: {b: {c: 10}}}); + it('handle ArrayLike objects that are nor Array not immutable Collection', () => { + class CustomArrayLike implements ArrayLike { + readonly length: number; + [n: number]: T; + + constructor(...values: Array) { + this.length = values.length; + + for (let i = 0; i < values.length; i++) { + this[i] = values[i]; + } + } + + // Define other methods if needed, but do not include the `slice` method + // For example, you can define a method to set values + set(index: number, value: T): void { + if (index < 0 || index >= this.length) { + throw new RangeError('Index out of bounds'); + } + + this[index] = value; + } + + // Define a method to get values + get(index: number): T { + if (index < 0 || index >= this.length) { + throw new RangeError('Index out of bounds'); + } + + return this[index]; + } + } + + // create an ArrayLike + const customArray = new CustomArrayLike(10, 20); + + // code that works perfectly expect( - m.updateIn(fromJS(['a', 'b', 'c']), value => value * 2).toJS() - ).toEqual( - {a: {b: {c: 20}}} - ); - }) + updateIn({ 10: { 20: 'a' } }, customArray, (v) => + // @ts-expect-error -- `updateIn` keypath type should be `OrderedCollection | ArrayLike; + typeof v === 'string' ? v.toUpperCase() : v + ) + ).toEqual({ 10: { 20: 'A' } }); - it('deep edit throws without list or array-like', () => { - // need to cast these as TypeScript first prevents us from such clownery. - expect(() => - Map().updateIn(undefined, x => x) - ).toThrow('Expected iterable or array-like: undefined'); expect(() => - Map().updateIn({ a: 1, b: 2 }, x => x) - ).toThrow('Expected iterable or array-like: [object Object]'); - }) + updateIn({ 10: 'a' }, customArray, (v) => + // @ts-expect-error -- `updateIn` keypath type should be `OrderedCollection | ArrayLike; + typeof v === 'string' ? v.toUpperCase() : v + ) + ).toThrow('Cannot update within non-data-structure value in path [10]: a'); + }); it('identity with notSetValue is still identity', () => { - var m = Map({a: {b: {c: 10}}}); - expect( - m.updateIn(['x'], 100, id => id) - ).toEqual( - m - ); - }) + const m = Map({ a: { b: { c: 10 } } }); + expect(m.updateIn(['x'], 100, (id) => id)).toEqual(m); + }); it('shallow remove', () => { - var m = Map({a: 123}); - expect( - m.updateIn([], map => undefined) - ).toEqual( - undefined - ); - }) + const m = Map({ a: 123 }); + expect(m.updateIn([], () => undefined)).toEqual(undefined); + }); it('deep remove', () => { - var m = fromJS({a: {b: {c: 10}}}); + const m = fromJS({ a: { b: { c: 10 } } }); expect( - m.updateIn(['a', 'b'], map => map.remove('c')).toJS() - ).toEqual( - {a: {b: {}}} - ); - }) + m + // @ts-expect-error -- type of fromJS may return a MapOf in the future, to help `updateIn` to work, `updateIn` should copy the comportment of `getIn` + .updateIn(['a', 'b'], (map: MapOf<{ c: number }>) => map.remove('c')) + .toJS() + ).toEqual({ + a: { b: {} }, + }); + }); it('deep set', () => { - var m = fromJS({a: {b: {c: 10}}}); + const m = fromJS({ a: { b: { c: 10 } } }); expect( - m.updateIn(['a', 'b'], map => map.set('d', 20)).toJS() - ).toEqual( - {a: {b: {c: 10, d: 20}}} - ); - }) + m + // @ts-expect-error -- type of fromJS may return a MapOf in the future, to help `updateIn` to work, `updateIn` should copy the comportment of `getIn` + .updateIn(['a', 'b'], (map: MapOf<{ c: number }>) => map.set('d', 20)) + .toJS() + ).toEqual({ + a: { b: { c: 10, d: 20 } }, + }); + }); it('deep push', () => { - var m = fromJS({a: {b: [1,2,3]}}); + const m = fromJS({ a: { b: [1, 2, 3] } }); expect( - m.updateIn(['a', 'b'], list => list.push(4)).toJS() - ).toEqual( - {a: {b: [1,2,3,4]}} - ); - }) + // @ts-expect-error -- type of fromJS may return a MapOf in the future, to help `updateIn` to work, `updateIn` should copy the comportment of `getIn` + m.updateIn(['a', 'b'], (list: List) => list.push(4)).toJS() + ).toEqual({ + a: { b: [1, 2, 3, 4] }, + }); + }); it('deep map', () => { - var m = fromJS({a: {b: [1,2,3]}}); + const m = fromJS({ a: { b: [1, 2, 3] } }); expect( - m.updateIn(['a', 'b'], list => list.map(value => value * 10)).toJS() - ).toEqual( - {a: {b: [10, 20, 30]}} - ); - }) + m + // @ts-expect-error -- type of fromJS may return a MapOf in the future, to help `updateIn` to work, `updateIn` should copy the comportment of `getIn` + .updateIn(['a', 'b'], (list: List) => + list.map((value) => value * 10) + ) + .toJS() + ).toEqual({ a: { b: [10, 20, 30] } }); + }); it('creates new maps if path contains gaps', () => { - var m = fromJS({a: {b: {c: 10}}}); + const m = fromJS({ a: { b: { c: 10 } } }); expect( - m.updateIn(['a', 'z'], Map(), map => map.set('d', 20)).toJS() - ).toEqual( - {a: {b: {c: 10}, z: {d: 20}}} - ); - }) + m + .updateIn( + ['a', 'q', 'z'], + Map(), + // @ts-expect-error -- updateIn should handle the `notSetValue` parameter + (map: Map) => map.set('d', 20) + ) + .toJS() + ).toEqual({ a: { b: { c: 10 }, q: { z: { d: 20 } } } }); + }); + + it('creates new objects if path contains gaps within raw JS', () => { + const m = { a: { b: { c: 10 } } }; + expect( + updateIn( + m, + ['a', 'b', 'z'], + Map(), + (map: Map) => map.set('d', 20) + ) + ).toEqual({ a: { b: { c: 10, z: Map({ d: 20 }) } } }); + }); it('throws if path cannot be set', () => { - var m = fromJS({a: {b: {c: 10}}}); + const m = fromJS({ a: { b: { c: 10 } } }); expect(() => { - m.updateIn(['a', 'b', 'c', 'd'], v => 20).toJS() - }).toThrow(); - }) + m.updateIn(['a', 'b', 'c', 'd'], () => 20).toJS(); + }).toThrow( + 'Cannot update within non-data-structure value in path ["a","b","c"]: 10' + ); + }); it('update with notSetValue when non-existing key', () => { - var m = Map({a: {b: {c: 10}}}); - expect( - m.updateIn(['x'], 100, map => map + 1).toJS() - ).toEqual( - {a: {b: {c: 10}}, x: 101} - ); - }) + const m = Map({ a: { b: { c: 10 } } }); + // @ts-expect-error -- updateIn should handle the `notSetValue` parameter + expect(m.updateIn(['x'], 100, (map: number) => map + 1).toJS()).toEqual({ + a: { b: { c: 10 } }, + x: 101, + }); + }); + + it('update with notSetValue when non-existing key in raw JS', () => { + const m = { a: { b: { c: 10 } } }; + expect(updateIn(m, ['x'], 100, (map: number) => map + 1)).toEqual({ + a: { b: { c: 10 } }, + x: 101, + }); + }); it('updates self for empty path', () => { - var m = fromJS({a: 1, b: 2, c: 3}); - expect( - m.updateIn([], map => map.set('b', 20)).toJS() - ).toEqual( - {a: 1, b: 20, c: 3} - ) - }) + const m = fromJS({ a: 1, b: 2, c: 3 }); + // @ts-expect-error -- type of fromJS may return a MapOf in the future, to help `updateIn` to work, `updateIn` should copy the comportment of `getIn` + expect(m.updateIn([], (map: typeof m) => map.set('b', 20)).toJS()).toEqual({ + a: 1, + b: 20, + c: 3, + }); + }); it('does not perform edit when new value is the same as old value', () => { - var m = fromJS({a: {b: {c: 10}}}); - var m2 = m.updateIn(['a', 'b', 'c'], id => id); + const m = fromJS({ a: { b: { c: 10 } } }); + const m2 = m.updateIn(['a', 'b', 'c'], (id) => id); + expect(m2).toBe(m); + }); + + it('does not perform edit when new value is the same as old value in raw JS', () => { + const m = { a: { b: { c: 10 } } }; + const m2 = updateIn(m, ['a', 'b', 'c'], (id) => id); expect(m2).toBe(m); - }) + }); it('does not perform edit when notSetValue is what you return from updater', () => { - var m = Map(); - var spiedOnID; - var m2 = m.updateIn(['a', 'b', 'c'], Set(), id => (spiedOnID = id)); + const m = Map(); + let spiedOnID; + const m2 = m.updateIn(['a', 'b', 'c'], Set(), (id) => (spiedOnID = id)); expect(m2).toBe(m); expect(spiedOnID).toBe(Set()); - }) + }); it('provides default notSetValue of undefined', () => { - var m = Map(); - var spiedOnID; - var m2 = m.updateIn(['a', 'b', 'c'], id => (spiedOnID = id)); + const m = Map(); + let spiedOnID; + const m2 = m.updateIn(['a', 'b', 'c'], (id) => (spiedOnID = id)); expect(m2).toBe(m); expect(spiedOnID).toBe(undefined); - }) + }); describe('setIn', () => { - it('provides shorthand for updateIn to set a single value', () => { - var m = Map().setIn(['a','b','c'], 'X'); - expect(m.toJS()).toEqual({a:{b:{c:'X'}}}); - }) + const m = Map().setIn(['a', 'b', 'c'], 'X'); + expect(m).toEqual(fromJS({ a: { b: { c: 'X' } } })); + }); it('accepts a list as a keyPath', () => { - var m = Map().setIn(fromJS(['a','b','c']), 'X'); - expect(m.toJS()).toEqual({a:{b:{c:'X'}}}); - }) + const m = Map().setIn(fromJS(['a', 'b', 'c']), 'X'); + expect(m).toEqual(fromJS({ a: { b: { c: 'X' } } })); + }); it('returns value when setting empty path', () => { - var m = Map(); - expect(m.setIn([], 'X')).toBe('X') - }) + const m = Map(); + expect(m.setIn([], 'X')).toBe('X'); + }); it('can setIn undefined', () => { - var m = Map().setIn(['a','b','c'], undefined); - expect(m.toJS()).toEqual({a:{b:{c:undefined}}}); + const m = Map().setIn(['a', 'b', 'c'], undefined); + expect(m).toEqual(Map({ a: Map({ b: Map({ c: undefined }) }) })); }); - }) + it('returns self for a no-op', () => { + const m = fromJS({ a: { b: { c: 123 } } }); + expect(m.setIn(['a', 'b', 'c'], 123)).toBe(m); + }); - describe('removeIn', () => { + it('provides shorthand for updateIn to set a single value in raw JS', () => { + const m = setIn({}, ['a', 'b', 'c'], 'X'); + expect(m).toEqual({ a: { b: { c: 'X' } } }); + }); + + it('accepts a list as a keyPath in raw JS', () => { + const m = setIn({}, fromJS(['a', 'b', 'c']), 'X'); + expect(m).toEqual({ a: { b: { c: 'X' } } }); + }); + + it('returns value when setting empty path in raw JS', () => { + expect(setIn({}, [], 'X')).toBe('X'); + }); + + it('can setIn undefined in raw JS', () => { + const m = setIn({}, ['a', 'b', 'c'], undefined); + expect(m).toEqual({ a: { b: { c: undefined } } }); + }); + it('returns self for a no-op in raw JS', () => { + const m = { a: { b: { c: 123 } } }; + expect(setIn(m, ['a', 'b', 'c'], 123)).toBe(m); + }); + }); + + describe('removeIn', () => { it('provides shorthand for updateIn to remove a single value', () => { - var m = fromJS({a:{b:{c:'X', d:'Y'}}}); - expect(m.removeIn(['a','b','c']).toJS()).toEqual({a:{b:{d:'Y'}}}); - }) + const m = fromJS({ a: { b: { c: 'X', d: 'Y' } } }) as Map< + string, + unknown + >; + expect(m.removeIn(['a', 'b', 'c']).toJS()).toEqual({ + a: { b: { d: 'Y' } }, + }); + }); it('accepts a list as a keyPath', () => { - var m = fromJS({a:{b:{c:'X', d:'Y'}}}); - expect(m.removeIn(fromJS(['a','b','c'])).toJS()).toEqual({a:{b:{d:'Y'}}}); - }) + const m = fromJS({ a: { b: { c: 'X', d: 'Y' } } }) as Map< + string, + unknown + >; + expect(m.removeIn(fromJS(['a', 'b', 'c'])).toJS()).toEqual({ + a: { b: { d: 'Y' } }, + }); + }); it('does not create empty maps for an unset path', () => { - var m = Map(); - expect(m.removeIn(['a','b','c']).toJS()).toEqual({}); - }) + const m = Map(); + expect(m.removeIn(['a', 'b', 'c']).toJS()).toEqual({}); + }); it('removes itself when removing empty path', () => { - var m = Map(); - expect(m.removeIn([])).toBe(undefined) - }) + const m = Map(); + expect(m.removeIn([])).toBe(undefined); + }); - }) + it('removes values from a Set', () => { + const m = Map({ set: Set([1, 2, 3]) }); + const m2 = m.removeIn(['set', 2]); + expect(m2.toJS()).toEqual({ set: [1, 3] }); + }); - describe('mergeIn', () => { + it('returns undefined when removing an empty path in raw JS', () => { + expect(removeIn({}, [])).toBe(undefined); + }); + + it('can removeIn in raw JS', () => { + const m = removeIn({ a: { b: { c: 123 } } }, ['a', 'b', 'c']); + expect(m).toEqual({ a: { b: { c: undefined } } }); + }); + + it('returns self for a no-op in raw JS', () => { + const m = { a: { b: { c: 123 } } }; + expect(removeIn(m, ['a', 'b', 'd'])).toBe(m); + }); + }); + describe('mergeIn', () => { it('provides shorthand for updateIn to merge a nested value', () => { - var m1 = fromJS({x:{a:1,b:2,c:3}}); - var m2 = fromJS({d:10,b:20,e:30}); - expect(m1.mergeIn(['x'], m2).toJS()).toEqual( - {x: {a:1,b:20,c:3,d:10,e:30}} - ); - }) + const m1 = fromJS({ x: { a: 1, b: 2, c: 3 } }); + const m2 = fromJS({ d: 10, b: 20, e: 30 }); + expect(m1.mergeIn(['x'], m2).toJS()).toEqual({ + x: { a: 1, b: 20, c: 3, d: 10, e: 30 }, + }); + }); it('accepts a list as a keyPath', () => { - var m1 = fromJS({x:{a:1,b:2,c:3}}); - var m2 = fromJS({d:10,b:20,e:30}); - expect(m1.mergeIn(fromJS(['x']), m2).toJS()).toEqual( - {x: {a:1,b:20,c:3,d:10,e:30}} - ); - }) + const m1 = fromJS({ x: { a: 1, b: 2, c: 3 } }); + const m2 = fromJS({ d: 10, b: 20, e: 30 }); + expect(m1.mergeIn(fromJS(['x']), m2).toJS()).toEqual({ + x: { a: 1, b: 20, c: 3, d: 10, e: 30 }, + }); + }); it('does not create empty maps for a no-op merge', () => { - var m = Map(); - expect(m.mergeIn(['a','b','c'], Map()).toJS()).toEqual({}); - }) + const m = Map(); + expect(m.mergeIn(['a', 'b', 'c'], Map()).toJS()).toEqual({}); + }); it('merges into itself for empty path', () => { - var m = Map({a:1,b:2,c:3}); - expect( - m.mergeIn([], Map({d:10,b:20,e:30})).toJS() - ).toEqual( - {a:1,b:20,c:3,d:10,e:30} - ) - }) + const m = Map({ a: 1, b: 2, c: 3 }); + expect(m.mergeIn([], Map({ d: 10, b: 20, e: 30 })).toJS()).toEqual({ + a: 1, + b: 20, + c: 3, + d: 10, + e: 30, + }); + }); - }) + it('merges into plain JS Object and Array', () => { + const m = Map({ a: { x: [1, 2, 3] } }); + expect(m.mergeIn(['a', 'x'], [4, 5, 6])).toEqual( + Map({ a: { x: [1, 2, 3, 4, 5, 6] } }) + ); + }); + }); describe('mergeDeepIn', () => { - it('provides shorthand for updateIn to merge a nested value', () => { - var m1 = fromJS({x:{a:1,b:2,c:3}}); - var m2 = fromJS({d:10,b:20,e:30}); - expect(m1.mergeDeepIn(['x'], m2).toJS()).toEqual( - {x: {a:1,b:20,c:3,d:10,e:30}} - ); - }) + const m1 = fromJS({ x: { a: 1, b: 2, c: 3 } }); + const m2 = fromJS({ d: 10, b: 20, e: 30 }); + expect(m1.mergeDeepIn(['x'], m2).toJS()).toEqual({ + x: { a: 1, b: 20, c: 3, d: 10, e: 30 }, + }); + }); it('accepts a list as a keyPath', () => { - var m1 = fromJS({x:{a:1,b:2,c:3}}); - var m2 = fromJS({d:10,b:20,e:30}); - expect(m1.mergeDeepIn(fromJS(['x']), m2).toJS()).toEqual( - {x: {a:1,b:20,c:3,d:10,e:30}} - ); - }) + const m1 = fromJS({ x: { a: 1, b: 2, c: 3 } }); + const m2 = fromJS({ d: 10, b: 20, e: 30 }); + expect(m1.mergeDeepIn(fromJS(['x']), m2).toJS()).toEqual({ + x: { a: 1, b: 20, c: 3, d: 10, e: 30 }, + }); + }); it('does not create empty maps for a no-op merge', () => { - var m = Map(); - expect(m.mergeDeepIn(['a','b','c'], Map()).toJS()).toEqual({}); - }) + const m = Map(); + expect(m.mergeDeepIn(['a', 'b', 'c'], Map()).toJS()).toEqual({}); + }); it('merges into itself for empty path', () => { - var m = Map({a:1,b:2,c:3}); - expect( - m.mergeDeepIn([], Map({d:10,b:20,e:30})).toJS() - ).toEqual( - {a:1,b:20,c:3,d:10,e:30} - ) - }) - - }) + const m = Map({ a: 1, b: 2, c: 3 }); + expect(m.mergeDeepIn([], Map({ d: 10, b: 20, e: 30 })).toJS()).toEqual({ + a: 1, + b: 20, + c: 3, + d: 10, + e: 30, + }); + }); -}) + it('merges deep into plain JS Object and Array', () => { + const m = Map({ a: { x: [1, 2, 3] } }); + expect(m.mergeDeepIn(['a'], { x: [4, 5, 6] })).toEqual( + Map({ a: { x: [1, 2, 3, 4, 5, 6] } }) + ); + }); + }); +}); diff --git a/__tests__/utils.js b/__tests__/utils.js new file mode 100644 index 0000000000..1d1c6b0e44 --- /dev/null +++ b/__tests__/utils.js @@ -0,0 +1,62 @@ +/** + * @jest-environment jsdom + */ + +import { List, isPlainObject } from 'immutable'; + +describe('Utils', () => { + describe('isPlainObj()', function testFunc() { + const nonPlainCases = [ + ['Host object', document.createElement('div')], + ['bool primitive false', false], + ['bool primitive true', true], + ['falsy undefined', undefined], + ['falsy null', null], + ['Simple function', function () {}], + [ + 'Instance of other object', + (function () { + function Foo() {} + return new Foo(); + })(), + ], + ['Number primitive ', 5], + ['String primitive ', 'P'], + ['Number Object', Number(6)], + ['Immutable.List', new List()], + ['simple array', ['one']], + ['Error', Error], + ['Internal namespaces', Math], + ['Arguments', arguments], + ]; + const plainCases = [ + ['literal Object', {}], + // eslint-disable-next-line no-object-constructor + ['new Object', new Object()], + ['Object.create(null)', Object.create(null)], + ['nested object', { one: { prop: 'two' } }], + ['constructor prop', { constructor: 'prop' }], // shadows an object's constructor + ['constructor.name', { constructor: { name: 'two' } }], // shadows an object's constructor.name + [ + 'Fake toString', + { + toString: function () { + return '[object Object]'; + }, + }, + ], + ]; + + nonPlainCases.forEach(([name, value]) => { + it(`${name} returns false`, () => { + expect(isPlainObject(value)).toBe(false); + }); + }); + + plainCases.forEach(([name, value]) => { + it(`${name} returns true`, () => { + expect(isPlainObject(value)).toBe(true); + }); + }); + }); +}); diff --git a/__tests__/zip.ts b/__tests__/zip.ts index baf489bec2..4487fa1b95 100644 --- a/__tests__/zip.ts +++ b/__tests__/zip.ts @@ -1,104 +1,147 @@ -/// - -import * as jasmineCheck from 'jasmine-check'; -jasmineCheck.install(); - -import { Iterable, List, Range, Seq } from '../'; +import { describe, expect, it } from '@jest/globals'; +import { List, Range, Seq } from 'immutable'; +import fc from 'fast-check'; +import { expectToBeDefined } from './ts-utils'; describe('zip', () => { - it('zips lists into a list of tuples', () => { expect( - Seq.of(1,2,3).zip(Seq.of(4,5,6)).toArray() - ).toEqual( - [[1,4],[2,5],[3,6]] + Seq([1, 2, 3]) + .zip(Seq([4, 5, 6])) + .toArray() + ).toEqual([ + [1, 4], + [2, 5], + [3, 6], + ]); + }); + + it('zip results can be converted to JS', () => { + const l1 = List([List([1]), List([2]), List([3])]); + const l2 = List([List([4]), List([5]), List([6])]); + const zipped = l1.zip(l2); + expect(zipped).toEqual( + List([ + [List([1]), List([4])], + [List([2]), List([5])], + [List([3]), List([6])], + ]) ); + expect(zipped.toJS()).toEqual([ + [[1], [4]], + [[2], [5]], + [[3], [6]], + ]); }); it('zips with infinite lists', () => { expect( - Range().zip(Seq.of('A','B','C')).toArray() - ).toEqual( - [[0,'A'],[1,'B'],[2,'C']] - ); + Range(0, Infinity) + .zip(Seq(['A', 'B', 'C'])) + .toArray() + ).toEqual([ + [0, 'A'], + [1, 'B'], + [2, 'C'], + ]); }); it('has unknown size when zipped with unknown size', () => { - var seq = Range(0, 10); - var zipped = seq.zip(seq.filter(n => n % 2 === 0)); + const seq = Range(0, 10); + const zipped = seq.zip(seq.filter((n) => n % 2 === 0)); expect(zipped.size).toBe(undefined); expect(zipped.count()).toBe(5); - }) + }); - check.it('is always the size of the smaller sequence', - [gen.notEmpty(gen.array(gen.posInt))], (lengths) => { - var ranges = lengths.map(l => Range(0, l)); - var first = ranges.shift(); - var zipped = first.zip.apply(first, ranges); - var shortestLength = Math.min.apply(Math, lengths); - expect(zipped.size).toBe(shortestLength); + it('is always the size of the smaller sequence', () => { + fc.assert( + fc.property(fc.array(fc.nat(), { minLength: 1 }), (lengths) => { + const ranges = lengths.map((l) => Range(0, l)); + const first = ranges.shift(); + expectToBeDefined(first); + const zipped = first.zip.apply(first, ranges); + const shortestLength = Math.min.apply(Math, lengths); + expect(zipped.size).toBe(shortestLength); + }) + ); }); describe('zipWith', () => { - it('zips with a custom function', () => { expect( - Seq.of(1,2,3).zipWith( - (a, b) => a + b, - Seq.of(4,5,6) - ).toArray() - ).toEqual( - [5,7,9] - ); + Seq([1, 2, 3]) + .zipWith((a, b) => a + b, Seq([4, 5, 6])) + .toArray() + ).toEqual([5, 7, 9]); }); it('can zip to create immutable collections', () => { expect( - Seq.of(1,2,3).zipWith( - function () { return List(arguments); }, - Seq.of(4,5,6), - Seq.of(7,8,9) - ).toJS() - ).toEqual( - [[1,4,7],[2,5,8],[3,6,9]] - ); + Seq([1, 2, 3]) + .zipWith( + function () { + // eslint-disable-next-line prefer-rest-params + return List(arguments); + }, + Seq([4, 5, 6]), + Seq([7, 8, 9]) + ) + .toJS() + ).toEqual([ + [1, 4, 7], + [2, 5, 8], + [3, 6, 9], + ]); + }); + }); + + describe('zipAll', () => { + it('fills in the empty zipped values with undefined', () => { + expect( + Seq([1, 2, 3]) + .zipAll(Seq([4])) + .toArray() + ).toEqual([ + [1, 4], + [2, undefined], + [3, undefined], + ]); }); + it('is always the size of the longest sequence', () => { + fc.assert( + fc.property(fc.array(fc.nat(), { minLength: 1 }), (lengths) => { + const ranges = lengths.map((l) => Range(0, l)); + const first = ranges.shift(); + expectToBeDefined(first); + const zipped = first.zipAll.apply(first, ranges); + const longestLength = Math.max.apply(Math, lengths); + expect(zipped.size).toBe(longestLength); + }) + ); + }); }); describe('interleave', () => { - it('interleaves multiple collections', () => { expect( - Seq.of(1,2,3).interleave( - Seq.of(4,5,6), - Seq.of(7,8,9) - ).toArray() - ).toEqual( - [1,4,7,2,5,8,3,6,9] - ); + Seq([1, 2, 3]) + .interleave(Seq([4, 5, 6]), Seq([7, 8, 9])) + .toArray() + ).toEqual([1, 4, 7, 2, 5, 8, 3, 6, 9]); }); it('stops at the shortest collection', () => { - var i = Seq.of(1,2,3).interleave( - Seq.of(4,5), - Seq.of(7,8,9) - ); + const i = Seq([1, 2, 3]).interleave(Seq([4, 5]), Seq([7, 8, 9])); expect(i.size).toBe(6); - expect(i.toArray()).toEqual( - [1,4,7,2,5,8] - ); + expect(i.toArray()).toEqual([1, 4, 7, 2, 5, 8]); }); it('with infinite lists', () => { - var r: Iterable.Indexed = Range(); - var i = r.interleave(Seq.of('A','B','C')); + const r: Seq.Indexed = Range(0, Infinity); + const i = r.interleave(Seq(['A', 'B', 'C'])); expect(i.size).toBe(6); - expect(i.toArray()).toEqual( - [0,'A',1,'B',2,'C'] - ); + expect(i.toArray()).toEqual([0, 'A', 1, 'B', 2, 'C']); }); - }); - }); diff --git a/bower.json b/bower.json deleted file mode 100644 index c1a3fd8284..0000000000 --- a/bower.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "immutable", - "description": "Immutable Data Collections", - "homepage": "https://github.com/facebook/immutable-js", - "author": { - "name": "Lee Byron", - "homepage": "https://github.com/leebyron" - }, - "repository": { - "type": "git", - "url": "git://github.com/facebook/immutable-js.git" - }, - "main": "dist/immutable.js", - "typescript": { - "definition": "dist/immutable.d.ts" - }, - "ignore": [ - "**/.*", - "__tests__", - "resources", - "src", - "type-definitions", - "package.json", - "Gruntfile.js" - ], - "keywords": [ - "immutable", - "persistent", - "lazy", - "data", - "datastructure", - "functional", - "collection", - "stateless", - "sequence", - "iteration" - ], - "license": "BSD" -} diff --git a/contrib/cursor/README.md b/contrib/cursor/README.md deleted file mode 100644 index bd89fbccad..0000000000 --- a/contrib/cursor/README.md +++ /dev/null @@ -1,33 +0,0 @@ -Cursors -------- - -Cursors allow you to hold a reference to a path in a nested immutable data -structure, allowing you to pass smaller sections of a larger nested -collection to portions of your application while maintaining a central point -aware of changes to the entire data structure: an `onChange` function which is -called whenever a cursor or sub-cursor calls `update`. - -This is particularly useful when used in conjuction with component-based UI -libraries like [React](https://facebook.github.io/react/) or to simulate -"state" throughout an application while maintaining a single flow of logic. - - -```javascript -var Immutable = require('immutable'); -var Cursor = require('immutable/contrib/cursor'); - -var data = Immutable.fromJS({ a: { b: { c: 1 } } }); -var cursor = Cursor.from(data, ['a', 'b'], newData => { - data = newData; -}); - -// ... elsewhere ... - -cursor.get('c'); // 1 -cursor = cursor.update('c', x => x + 1); -cursor.get('c'); // 2 - -// ... back to data ... - -data.getIn(['a', 'b', 'c']); // 2 -``` diff --git a/contrib/cursor/__tests__/Cursor.ts.skip b/contrib/cursor/__tests__/Cursor.ts.skip deleted file mode 100644 index 8791c50392..0000000000 --- a/contrib/cursor/__tests__/Cursor.ts.skip +++ /dev/null @@ -1,393 +0,0 @@ -/// -/// -/// - -jest.autoMockOff(); - -import Immutable = require('immutable'); -import Cursor = require('immutable/contrib/cursor'); - -describe('Cursor', () => { - - beforeEach(function () { - jasmine.addMatchers({ - toValueEqual: function (expected) { - var actual = this.actual; - if (!Immutable.is(expected, this.actual)) { - this.message = 'Expected\n' + this.actual + '\nto equal\n' + expected; - return false; - } - return true; - } - }); - }); - - var json = { a: { b: { c: 1 } } }; - - it('gets from its path', () => { - var data = Immutable.fromJS(json); - var cursor = Cursor.from(data); - - expect(cursor.deref()).toBe(data); - - var deepCursor = cursor.cursor(['a', 'b']); - expect(deepCursor.deref().toJS()).toEqual(json.a.b); - expect(deepCursor.deref()).toBe(data.getIn(['a', 'b'])); - expect(deepCursor.get('c')).toBe(1); - - var leafCursor = deepCursor.cursor('c'); - expect(leafCursor.deref()).toBe(1); - - var missCursor = leafCursor.cursor('d'); - expect(missCursor.deref()).toBe(undefined); - }); - - it('gets return new cursors', () => { - var data = Immutable.fromJS(json); - var cursor = Cursor.from(data); - var deepCursor = cursor.getIn(['a', 'b']); - expect(deepCursor.deref()).toBe(data.getIn(['a', 'b'])); - }); - - it('gets return new cursors using List', () => { - var data = Immutable.fromJS(json); - var cursor = Cursor.from(data); - var deepCursor = cursor.getIn(Immutable.fromJS(['a', 'b'])); - expect(deepCursor.deref()).toBe(data.getIn(Immutable.fromJS(['a', 'b']))); - }); - - it('cursor return new cursors of correct type', () => { - var data = Immutable.fromJS({ a: [1, 2, 3] }); - var cursor = Cursor.from(data); - var deepCursor = cursor.cursor('a'); - expect(deepCursor.findIndex).toBeDefined(); - }); - - it('can be treated as a value', () => { - var data = Immutable.fromJS(json); - var cursor = Cursor.from(data, ['a', 'b']); - expect(cursor.toJS()).toEqual(json.a.b); - expect(cursor).toValueEqual(data.getIn(['a', 'b'])); - expect(cursor.size).toBe(1); - expect(cursor.get('c')).toBe(1); - }); - - it('can be value compared to a primitive', () => { - var data = Immutable.Map({ a: 'A' }); - var aCursor = Cursor.from(data, 'a'); - expect(aCursor.size).toBe(undefined); - expect(aCursor.deref()).toBe('A'); - expect(Immutable.is(aCursor, 'A')).toBe(true); - }); - - it('updates at its path', () => { - var onChange = jest.genMockFunction(); - - var data = Immutable.fromJS(json); - var aCursor = Cursor.from(data, 'a', onChange); - - var deepCursor = aCursor.cursor(['b', 'c']); - expect(deepCursor.deref()).toBe(1); - - // cursor edits return new cursors: - var newDeepCursor = deepCursor.update(x => x + 1); - expect(newDeepCursor.deref()).toBe(2); - var call1 = onChange.mock.calls[0]; - expect(call1[0]).toValueEqual(Immutable.fromJS({a:{b:{c:2}}})); - expect(call1[1]).toBe(data); - expect(call1[2]).toEqual(['a', 'b', 'c']); - - var newestDeepCursor = newDeepCursor.update(x => x + 1); - expect(newestDeepCursor.deref()).toBe(3); - var call2 = onChange.mock.calls[1]; - expect(call2[0]).toValueEqual(Immutable.fromJS({a:{b:{c:3}}})); - expect(call2[1]).toValueEqual(Immutable.fromJS({a:{b:{c:2}}})); - expect(call2[2]).toEqual(['a', 'b', 'c']); - - // meanwhile, data is still immutable: - expect(data.toJS()).toEqual(json); - - // as is the original cursor. - expect(deepCursor.deref()).toBe(1); - var otherNewDeepCursor = deepCursor.update(x => x + 10); - expect(otherNewDeepCursor.deref()).toBe(11); - var call3 = onChange.mock.calls[2]; - expect(call3[0]).toValueEqual(Immutable.fromJS({a:{b:{c:11}}})); - expect(call3[1]).toBe(data); - expect(call3[2]).toEqual(['a', 'b', 'c']); - - // and update has been called exactly thrice. - expect(onChange.mock.calls.length).toBe(3); - }); - - it('updates with the return value of onChange', () => { - var onChange = jest.genMockFunction(); - - var data = Immutable.fromJS(json); - var deepCursor = Cursor.from(data, ['a', 'b', 'c'], onChange); - - onChange.mockReturnValueOnce(undefined); - // onChange returning undefined has no effect - var newCursor = deepCursor.update(x => x + 1); - expect(newCursor.deref()).toBe(2); - var call1 = onChange.mock.calls[0]; - expect(call1[0]).toValueEqual(Immutable.fromJS({a:{b:{c:2}}})); - expect(call1[1]).toBe(data); - expect(call1[2]).toEqual(['a', 'b', 'c']); - - onChange.mockReturnValueOnce(Immutable.fromJS({a:{b:{c:11}}})); - // onChange returning something else has an effect - newCursor = newCursor.update(x => 999); - expect(newCursor.deref()).toBe(11); - var call2 = onChange.mock.calls[1]; - expect(call2[0]).toValueEqual(Immutable.fromJS({a:{b:{c:999}}})); - expect(call2[1]).toValueEqual(Immutable.fromJS({a:{b:{c:2}}})); - expect(call2[2]).toEqual(['a', 'b', 'c']); - - // and update has been called exactly twice - expect(onChange.mock.calls.length).toBe(2); - }); - - it('has map API for update shorthand', () => { - var onChange = jest.genMockFunction(); - - var data = Immutable.fromJS(json); - var aCursor = Cursor.from(data, 'a', onChange); - var bCursor = aCursor.cursor('b'); - var cCursor = bCursor.cursor('c'); - - expect(bCursor.set('c', 10).deref()).toValueEqual( - Immutable.fromJS({ c: 10 }) - ); - - var call1 = onChange.mock.calls[0]; - expect(call1[0]).toValueEqual(Immutable.fromJS({a:{b:{c:10}}})); - expect(call1[1]).toBe(data); - expect(call1[2]).toEqual(['a', 'b', 'c']); - }); - - it('creates maps as necessary', () => { - var data = Immutable.Map(); - var cursor = Cursor.from(data, ['a', 'b', 'c']); - expect(cursor.deref()).toBe(undefined); - cursor = cursor.set('d', 3); - expect(cursor.deref()).toValueEqual(Immutable.Map({d: 3})); - }); - - it('can set undefined', () => { - var data = Immutable.Map(); - var cursor = Cursor.from(data, ['a', 'b', 'c']); - expect(cursor.deref()).toBe(undefined); - cursor = cursor.set('d', undefined); - expect(cursor.toJS()).toEqual({d: undefined}); - }); - - it('has the sequence API', () => { - var data = Immutable.Map({a: 1, b: 2, c: 3}); - var cursor = Cursor.from(data); - expect(cursor.map((x: number) => x * x)).toValueEqual(Immutable.Map({a: 1, b: 4, c: 9})); - }); - - it('can push values on a List', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({a: {b: [0, 1, 2]}}); - var cursor = Cursor.from(data, ['a', 'b'], onChange); - - expect(cursor.push(3,4)).toValueEqual(Immutable.List([0, 1, 2, 3, 4])); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a: {b: [0, 1, 2, 3, 4]}})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['a', 'b']); - }); - - it('can pop values of a List', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({a: {b: [0, 1, 2]}}); - var cursor = Cursor.from(data, ['a', 'b'], onChange); - - expect(cursor.pop()).toValueEqual(Immutable.List([0, 1])); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a: {b: [0, 1]}})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['a', 'b']); - }); - - it('can unshift values on a List', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({a: {b: [0, 1, 2]}}); - var cursor = Cursor.from(data, ['a', 'b'], onChange); - - expect(cursor.unshift(-2, -1)).toValueEqual(Immutable.List([-2, -1, 0, 1, 2])); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a: {b: [-2, -1, 0, 1, 2]}})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['a', 'b']); - }); - - it('can shift values of a List', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({a: {b: [0, 1, 2]}}); - var cursor = Cursor.from(data, ['a', 'b'], onChange); - - expect(cursor.shift()).toValueEqual(Immutable.List([1, 2])); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a: {b: [1, 2]}})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['a', 'b']); - }); - - - it('returns wrapped values for sequence API', () => { - var data = Immutable.fromJS({a: {v: 1}, b: {v: 2}, c: {v: 3}}); - var onChange = jest.genMockFunction(); - var cursor = Cursor.from(data, onChange); - - var found = cursor.find(map => map.get('v') === 2); - expect(typeof found.deref).toBe('function'); // is a cursor! - found = found.set('v', 20); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a: {v: 1}, b: {v: 20}, c: {v: 3}})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['b', 'v']); - }); - - it('returns wrapped values for iteration API', () => { - var jsData = [{val: 0}, {val: 1}, {val: 2}]; - var data = Immutable.fromJS(jsData); - var cursor = Cursor.from(data); - cursor.forEach(function (c, i) { - expect(typeof c.deref).toBe('function'); // is a cursor! - expect(c.get('val')).toBe(i); - }); - }); - - it('can map over values to get subcursors', () => { - var data = Immutable.fromJS({a: {v: 1}, b: {v: 2}, c: {v: 3}}); - var cursor = Cursor.from(data); - - var mapped = cursor.map(val => { - expect(typeof val.deref).toBe('function'); // mapped values are cursors. - return val; - }).toMap(); - // Mapped is not a cursor, but it is a sequence of cursors. - expect(typeof (mapped).deref).not.toBe('function'); - expect(typeof (mapped.get('a')).deref).toBe('function'); - - // Same for indexed cursors - var data2 = Immutable.fromJS({x: [{v: 1}, {v: 2}, {v: 3}]}); - var cursor2 = Cursor.from(data2); - - var mapped2 = cursor2.get('x').map(val => { - expect(typeof val.deref).toBe('function'); // mapped values are cursors. - return val; - }).toList(); - // Mapped is not a cursor, but it is a sequence of cursors. - expect(typeof mapped2.deref).not.toBe('function'); - expect(typeof mapped2.get(0).deref).toBe('function'); - }); - - it('can have mutations apply with a single callback', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({'a': 1}); - - var c1 = Cursor.from(data, onChange); - var c2 = c1.withMutations(m => m.set('b', 2).set('c', 3).set('d', 4)); - - expect(c1.deref().toObject()).toEqual({'a': 1}); - expect(c2.deref().toObject()).toEqual({'a': 1, 'b': 2, 'c': 3, 'd': 4}); - expect(onChange.mock.calls.length).toBe(1); - }); - - it('can use withMutations on an unfulfilled cursor', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({}); - - var c1 = Cursor.from(data, ['a', 'b', 'c'], onChange); - var c2 = c1.withMutations(m => m.set('x', 1).set('y', 2).set('z', 3)); - - expect(c1.deref()).toEqual(undefined); - expect(c2.deref()).toValueEqual(Immutable.fromJS( - { x: 1, y: 2, z: 3 } - )); - expect(onChange.mock.calls.length).toBe(1); - }); - - it('maintains indexed sequences', () => { - var data = Immutable.fromJS([]); - var c = Cursor.from(data); - expect(c.toJS()).toEqual([]); - }); - - it('properly acts as an iterable', () => { - var data = Immutable.fromJS({key: {val: 1}}); - var c = Cursor.from(data).values(); - var c1 = c.next().value.get('val'); - expect(c1).toBe(1); - }); - - it('can update deeply', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({a:{b:{c:1}}}); - var c = Cursor.from(data, ['a'], onChange); - var c1 = c.updateIn(['b', 'c'], x => x * 10); - expect(c1.getIn(['b', 'c'])).toBe(10); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a:{b:{c:10}}})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['a', 'b', 'c']); - }); - - it('can set deeply', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({a:{b:{c:1}}}); - var c = Cursor.from(data, ['a'], onChange); - var c1 = c.setIn(['b', 'c'], 10); - expect(c1.getIn(['b', 'c'])).toBe(10); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a:{b:{c:10}}})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['a', 'b', 'c']); - }); - - it('can get Record value as a property', () => { - var User = Immutable.Record({ name: 'John' }); - var users = Immutable.List.of(new User()); - var data = Immutable.Map({'users': users}); - var cursor = Cursor.from(data, ['users']); - expect(cursor.first().name).toBe('John'); - }); - - it('can set value of a cursor directly', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({a:1}); - var c = Cursor.from(data, ['a'], onChange); - var c1 = c.set(2); - expect(c1.deref()).toBe(2); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a:2})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['a']); - }); - - it('can set value of a cursor to undefined directly', () => { - var onChange = jest.genMockFunction(); - var data = Immutable.fromJS({a:1}); - var c = Cursor.from(data, ['a'], onChange); - var c1 = c.set(undefined); - expect(c1.deref()).toBe(undefined); - - var call = onChange.mock.calls[0]; - expect(call[0]).toValueEqual(Immutable.fromJS({a:undefined})); - expect(call[1]).toBe(data); - expect(call[2]).toEqual(['a']); - }); - -}); diff --git a/contrib/cursor/index.d.ts b/contrib/cursor/index.d.ts deleted file mode 100644 index 0b45ab998b..0000000000 --- a/contrib/cursor/index.d.ts +++ /dev/null @@ -1,293 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - - -/** - * Cursors - * ------- - * - * Cursors allow you to hold a reference to a path in a nested immutable data - * structure, allowing you to pass smaller sections of a larger nested - * collection to portions of your application while maintaining a central point - * aware of changes to the entire data structure. - * - * This is particularly useful when used in conjuction with component-based UI - * libraries like [React](http://facebook.github.io/react/) or to simulate - * "state" throughout an application while maintaining a single flow of logic. - * - * Cursors provide a simple API for getting the value at that path - * (the equivalent of `this.getIn(keyPath)`), updating the value at that path - * (the equivalent of `this.updateIn(keyPath)`), and getting a sub-cursor - * starting from that path. - * - * When updated, a new root collection is created and provided to the `onChange` - * function provided to the first call to `Cursor(map, onChange)`. - * - * When this cursor's (or any of its sub-cursors') `update` method is called, - * the resulting new data structure will be provided to the `onChange` - * function. Use this callback to keep track of the most current value or - * update the rest of your application. - */ - -/// - -declare module __Cursor { - - export function from( - collection: Immutable.Collection, - onChange?: (newValue: any, oldValue?: any, keyPath?: Array) => any - ): Cursor; - export function from( - collection: Immutable.Collection, - keyPath: Array, - onChange?: (newValue: any, oldValue?: any, keyPath?: Array) => any - ): Cursor; - export function from( - collection: Immutable.Collection, - key: any, - onChange?: (newValue: any, oldValue?: any, keyPath?: Array) => any - ): Cursor; - - - export interface Cursor extends Immutable.Seq { - - /** - * Returns a sub-cursor following the key-path starting from this cursor. - */ - cursor(subKeyPath: Array): Cursor; - cursor(subKey: any): Cursor; - - /** - * Returns the value at the cursor, if the cursor path does not yet exist, - * returns `notSetValue`. - */ - deref(notSetValue?: any): any; - - /** - * Returns the value at the `key` in the cursor, or `notSetValue` if it - * does not exist. - * - * If the key would return a collection, a new Cursor is returned. - */ - get(key: any, notSetValue?: any): any; - - /** - * Returns the value at the `keyPath` in the cursor, or `notSetValue` if it - * does not exist. - * - * If the keyPath would return a collection, a new Cursor is returned. - */ - getIn(keyPath: Array, notSetValue?: any): any; - getIn(keyPath: Immutable.Iterable, notSetValue?: any): any; - - /** - * Sets `value` at `key` in the cursor, returning a new cursor to the same - * point in the new data. - * - * If only one parameter is provided, it is set directly as the cursor's value. - */ - set(key: any, value: any): Cursor; - set(value: any): Cursor; - - /** - * Deletes `key` from the cursor, returning a new cursor to the same - * point in the new data. - * - * Note: `delete` cannot be safely used in IE8 - * @alias remove - */ - delete(key: any): Cursor; - remove(key: any): Cursor; - - /** - * Clears the value at this cursor, returning a new cursor to the same - * point in the new data. - */ - clear(): Cursor; - - /** - * Updates the value in the data this cursor points to, triggering the - * callback for the root cursor and returning a new cursor pointing to the - * new data. - */ - update(updater: (value: any) => any): Cursor; - update(key: any, updater: (value: any) => any): Cursor; - update(key: any, notSetValue: any, updater: (value: any) => any): Cursor; - - /** - * @see `Map#merge` - */ - merge(...iterables: Immutable.Iterable[]): Cursor; - merge(...iterables: {[key: string]: any}[]): Cursor; - - /** - * @see `Map#mergeWith` - */ - mergeWith( - merger: (previous?: any, next?: any) => any, - ...iterables: Immutable.Iterable[] - ): Cursor; - mergeWith( - merger: (previous?: any, next?: any) => any, - ...iterables: {[key: string]: any}[] - ): Cursor; - - /** - * @see `Map#mergeDeep` - */ - mergeDeep(...iterables: Immutable.Iterable[]): Cursor; - mergeDeep(...iterables: {[key: string]: any}[]): Cursor; - - /** - * @see `Map#mergeDeepWith` - */ - mergeDeepWith( - merger: (previous?: any, next?: any) => any, - ...iterables: Immutable.Iterable[] - ): Cursor; - mergeDeepWith( - merger: (previous?: any, next?: any) => any, - ...iterables: {[key: string]: any}[] - ): Cursor; - - // Deep persistent changes - - /** - * Returns a new Cursor having set `value` at this `keyPath`. If any keys in - * `keyPath` do not exist, a new immutable Map will be created at that key. - */ - setIn(keyPath: Array, value: any): Cursor; - setIn(keyPath: Immutable.Iterable, value: any): Cursor; - - /** - * Returns a new Cursor with provided `values` appended - */ - push(...values: Array): Cursor; - - /** - * Returns a new Cursor with a size ones less than this Cursor, - * excluding the last index in this Cursor. - */ - pop(): Cursor; - - /** - * Returns a new Cursor with the provided `values` prepended, - * shifting other values ahead to higher indices. - */ - unshift(...values: Array): Cursor; - - /** - * Returns a new Cursor with a size ones less than this Cursor, excluding - * the first index in this Cursor, shifting all other values to a lower index. - */ - shift(): Cursor; - - /** - * Returns a new Cursor having removed the value at this `keyPath`. - * - * @alias removeIn - */ - deleteIn(keyPath: Array): Cursor; - deleteIn(keyPath: Immutable.Iterable): Cursor; - removeIn(keyPath: Array): Cursor; - removeIn(keyPath: Immutable.Iterable): Cursor; - - /** - * Returns a new Cursor having applied the `updater` to the value found at - * the keyPath. - * - * If any keys in `keyPath` do not exist, new Immutable `Map`s will - * be created at those keys. If the `keyPath` does not already contain a - * value, the `updater` function will be called with `notSetValue`, if - * provided, otherwise `undefined`. - * - * If the `updater` function returns the same value it was called with, then - * no change will occur. This is still true if `notSetValue` is provided. - */ - updateIn( - keyPath: Array, - updater: (value: any) => any - ): Cursor; - updateIn( - keyPath: Array, - notSetValue: any, - updater: (value: any) => any - ): Cursor; - updateIn( - keyPath: Immutable.Iterable, - updater: (value: any) => any - ): Cursor; - updateIn( - keyPath: Immutable.Iterable, - notSetValue: any, - updater: (value: any) => any - ): Cursor; - - /** - * A combination of `updateIn` and `merge`, returning a new Cursor, but - * performing the merge at a point arrived at by following the keyPath. - * In other words, these two lines are equivalent: - * - * x.updateIn(['a', 'b', 'c'], abc => abc.merge(y)); - * x.mergeIn(['a', 'b', 'c'], y); - * - */ - mergeIn( - keyPath: Immutable.Iterable, - ...iterables: Immutable.Iterable[] - ): Cursor; - mergeIn( - keyPath: Array, - ...iterables: Immutable.Iterable[] - ): Cursor; - mergeIn( - keyPath: Array, - ...iterables: {[key: string]: any}[] - ): Cursor; - - /** - * A combination of `updateIn` and `mergeDeep`, returning a new Cursor, but - * performing the deep merge at a point arrived at by following the keyPath. - * In other words, these two lines are equivalent: - * - * x.updateIn(['a', 'b', 'c'], abc => abc.mergeDeep(y)); - * x.mergeDeepIn(['a', 'b', 'c'], y); - * - */ - mergeDeepIn( - keyPath: Immutable.Iterable, - ...iterables: Immutable.Iterable[] - ): Cursor; - mergeDeepIn( - keyPath: Array, - ...iterables: Immutable.Iterable[] - ): Cursor; - mergeDeepIn( - keyPath: Array, - ...iterables: {[key: string]: any}[] - ): Cursor; - - // Transient changes - - /** - * Every time you call one of the above functions, a new immutable value is - * created and the callback is triggered. If you need to apply a series of - * mutations to a Cursor without triggering the callback repeatedly, - * `withMutations()` creates a temporary mutable copy of the value which - * can apply mutations in a highly performant manner. Afterwards the - * callback is triggered with the final value. - */ - withMutations(mutator: (mutable: any) => any): Cursor; - } - -} - -declare module 'immutable/contrib/cursor' { - export = __Cursor -} \ No newline at end of file diff --git a/contrib/cursor/index.js b/contrib/cursor/index.js deleted file mode 100644 index 727536719e..0000000000 --- a/contrib/cursor/index.js +++ /dev/null @@ -1,343 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -/** - * Cursor is expected to be required in a node or other CommonJS context: - * - * var Cursor = require('immutable/contrib/cursor'); - * - * If you wish to use it in the browser, please check out Browserify or WebPack! - */ - -var Immutable = require('../../'); -var Iterable = Immutable.Iterable; -var Iterator = Iterable.Iterator; -var Seq = Immutable.Seq; -var Map = Immutable.Map; -var Record = Immutable.Record; - - -function cursorFrom(rootData, keyPath, onChange) { - if (arguments.length === 1) { - keyPath = []; - } else if (typeof keyPath === 'function') { - onChange = keyPath; - keyPath = []; - } else { - keyPath = valToKeyPath(keyPath); - } - return makeCursor(rootData, keyPath, onChange); -} - - -var KeyedCursorPrototype = Object.create(Seq.Keyed.prototype); -var IndexedCursorPrototype = Object.create(Seq.Indexed.prototype); - -function KeyedCursor(rootData, keyPath, onChange, size) { - this.size = size; - this._rootData = rootData; - this._keyPath = keyPath; - this._onChange = onChange; -} -KeyedCursorPrototype.constructor = KeyedCursor; - -function IndexedCursor(rootData, keyPath, onChange, size) { - this.size = size; - this._rootData = rootData; - this._keyPath = keyPath; - this._onChange = onChange; -} -IndexedCursorPrototype.constructor = IndexedCursor; - -KeyedCursorPrototype.toString = function() { - return this.__toString('Cursor {', '}'); -} -IndexedCursorPrototype.toString = function() { - return this.__toString('Cursor [', ']'); -} - -KeyedCursorPrototype.deref = -KeyedCursorPrototype.valueOf = -IndexedCursorPrototype.deref = -IndexedCursorPrototype.valueOf = function(notSetValue) { - return this._rootData.getIn(this._keyPath, notSetValue); -} - -KeyedCursorPrototype.get = -IndexedCursorPrototype.get = function(key, notSetValue) { - return this.getIn([key], notSetValue); -} - -KeyedCursorPrototype.getIn = -IndexedCursorPrototype.getIn = function(keyPath, notSetValue) { - keyPath = listToKeyPath(keyPath); - if (keyPath.length === 0) { - return this; - } - var value = this._rootData.getIn(newKeyPath(this._keyPath, keyPath), NOT_SET); - return value === NOT_SET ? notSetValue : wrappedValue(this, keyPath, value); -} - -IndexedCursorPrototype.set = -KeyedCursorPrototype.set = function(key, value) { - if(arguments.length === 1) { - return updateCursor(this, function() { return key; }, []); - } else { - return updateCursor(this, function (m) { return m.set(key, value); }, [key]); - } -} - -IndexedCursorPrototype.push = function(/* values */) { - var args = arguments; - return updateCursor(this, function (m) { - return m.push.apply(m, args); - }); -} - -IndexedCursorPrototype.pop = function() { - return updateCursor(this, function (m) { - return m.pop(); - }); -} - -IndexedCursorPrototype.unshift = function(/* values */) { - var args = arguments; - return updateCursor(this, function (m) { - return m.unshift.apply(m, args); - }); -} - -IndexedCursorPrototype.shift = function() { - return updateCursor(this, function (m) { - return m.shift(); - }); -} - -IndexedCursorPrototype.setIn = -KeyedCursorPrototype.setIn = Map.prototype.setIn; - -KeyedCursorPrototype.remove = -KeyedCursorPrototype['delete'] = -IndexedCursorPrototype.remove = -IndexedCursorPrototype['delete'] = function(key) { - return updateCursor(this, function (m) { return m.remove(key); }, [key]); -} - -IndexedCursorPrototype.removeIn = -IndexedCursorPrototype.deleteIn = -KeyedCursorPrototype.removeIn = -KeyedCursorPrototype.deleteIn = Map.prototype.deleteIn; - -KeyedCursorPrototype.clear = -IndexedCursorPrototype.clear = function() { - return updateCursor(this, function (m) { return m.clear(); }); -} - -IndexedCursorPrototype.update = -KeyedCursorPrototype.update = function(keyOrFn, notSetValue, updater) { - return arguments.length === 1 ? - updateCursor(this, keyOrFn) : - this.updateIn([keyOrFn], notSetValue, updater); -} - -IndexedCursorPrototype.updateIn = -KeyedCursorPrototype.updateIn = function(keyPath, notSetValue, updater) { - return updateCursor(this, function (m) { - return m.updateIn(keyPath, notSetValue, updater); - }, keyPath); -} - -IndexedCursorPrototype.merge = -KeyedCursorPrototype.merge = function(/*...iters*/) { - var args = arguments; - return updateCursor(this, function (m) { - return m.merge.apply(m, args); - }); -} - -IndexedCursorPrototype.mergeWith = -KeyedCursorPrototype.mergeWith = function(merger/*, ...iters*/) { - var args = arguments; - return updateCursor(this, function (m) { - return m.mergeWith.apply(m, args); - }); -} - -IndexedCursorPrototype.mergeIn = -KeyedCursorPrototype.mergeIn = Map.prototype.mergeIn; - -IndexedCursorPrototype.mergeDeep = -KeyedCursorPrototype.mergeDeep = function(/*...iters*/) { - var args = arguments; - return updateCursor(this, function (m) { - return m.mergeDeep.apply(m, args); - }); -} - -IndexedCursorPrototype.mergeDeepWith = -KeyedCursorPrototype.mergeDeepWith = function(merger/*, ...iters*/) { - var args = arguments; - return updateCursor(this, function (m) { - return m.mergeDeepWith.apply(m, args); - }); -} - -IndexedCursorPrototype.mergeDeepIn = -KeyedCursorPrototype.mergeDeepIn = Map.prototype.mergeDeepIn; - -KeyedCursorPrototype.withMutations = -IndexedCursorPrototype.withMutations = function(fn) { - return updateCursor(this, function (m) { - return (m || Map()).withMutations(fn); - }); -} - -KeyedCursorPrototype.cursor = -IndexedCursorPrototype.cursor = function(subKeyPath) { - subKeyPath = valToKeyPath(subKeyPath); - return subKeyPath.length === 0 ? this : subCursor(this, subKeyPath); -} - -/** - * All iterables need to implement __iterate - */ -KeyedCursorPrototype.__iterate = -IndexedCursorPrototype.__iterate = function(fn, reverse) { - var cursor = this; - var deref = cursor.deref(); - return deref && deref.__iterate ? deref.__iterate( - function (v, k) { return fn(wrappedValue(cursor, [k], v), k, cursor); }, - reverse - ) : 0; -} - -/** - * All iterables need to implement __iterator - */ -KeyedCursorPrototype.__iterator = -IndexedCursorPrototype.__iterator = function(type, reverse) { - var deref = this.deref(); - var cursor = this; - var iterator = deref && deref.__iterator && - deref.__iterator(Iterator.ENTRIES, reverse); - return new Iterator(function () { - if (!iterator) { - return { value: undefined, done: true }; - } - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var k = entry[0]; - var v = wrappedValue(cursor, [k], entry[1]); - return { - value: type === Iterator.KEYS ? k : type === Iterator.VALUES ? v : [k, v], - done: false - }; - }); -} - -KeyedCursor.prototype = KeyedCursorPrototype; -IndexedCursor.prototype = IndexedCursorPrototype; - - -var NOT_SET = {}; // Sentinel value - -function makeCursor(rootData, keyPath, onChange, value) { - if (arguments.length < 4) { - value = rootData.getIn(keyPath); - } - var size = value && value.size; - var CursorClass = Iterable.isIndexed(value) ? IndexedCursor : KeyedCursor; - var cursor = new CursorClass(rootData, keyPath, onChange, size); - - if (value instanceof Record) { - defineRecordProperties(cursor, value); - } - - return cursor; -} - -function defineRecordProperties(cursor, value) { - try { - value._keys.forEach(setProp.bind(undefined, cursor)); - } catch (error) { - // Object.defineProperty failed. Probably IE8. - } -} - -function setProp(prototype, name) { - Object.defineProperty(prototype, name, { - get: function() { - return this.get(name); - }, - set: function(value) { - if (!this.__ownerID) { - throw new Error('Cannot set on an immutable record.'); - } - } - }); -} - -function wrappedValue(cursor, keyPath, value) { - return Iterable.isIterable(value) ? subCursor(cursor, keyPath, value) : value; -} - -function subCursor(cursor, keyPath, value) { - if (arguments.length < 3) { - return makeCursor( // call without value - cursor._rootData, - newKeyPath(cursor._keyPath, keyPath), - cursor._onChange - ); - } - return makeCursor( - cursor._rootData, - newKeyPath(cursor._keyPath, keyPath), - cursor._onChange, - value - ); -} - -function updateCursor(cursor, changeFn, changeKeyPath) { - var deepChange = arguments.length > 2; - var newRootData = cursor._rootData.updateIn( - cursor._keyPath, - deepChange ? Map() : undefined, - changeFn - ); - var keyPath = cursor._keyPath || []; - var result = cursor._onChange && cursor._onChange.call( - undefined, - newRootData, - cursor._rootData, - deepChange ? newKeyPath(keyPath, changeKeyPath) : keyPath - ); - if (result !== undefined) { - newRootData = result; - } - return makeCursor(newRootData, cursor._keyPath, cursor._onChange); -} - -function newKeyPath(head, tail) { - return head.concat(listToKeyPath(tail)); -} - -function listToKeyPath(list) { - return Array.isArray(list) ? list : Immutable.Iterable(list).toArray(); -} - -function valToKeyPath(val) { - return Array.isArray(val) ? val : - Iterable.isIterable(val) ? val.toArray() : - [val]; -} - -exports.from = cursorFrom; diff --git a/dist/immutable-nonambient.d.ts b/dist/immutable-nonambient.d.ts deleted file mode 100644 index 517271e097..0000000000 --- a/dist/immutable-nonambient.d.ts +++ /dev/null @@ -1,3082 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -/** - * Immutable data encourages pure functions (data-in, data-out) and lends itself - * to much simpler application development and enabling techniques from - * functional programming such as lazy evaluation. - * - * While designed to bring these powerful functional concepts to JavaScript, it - * presents an Object-Oriented API familiar to Javascript engineers and closely - * mirroring that of Array, Map, and Set. It is easy and efficient to convert to - * and from plain Javascript types. - * - * Note: all examples are presented in [ES6][]. To run in all browsers, they - * need to be translated to ES3. For example: - * - * // ES6 - * foo.map(x => x * x); - * // ES3 - * foo.map(function (x) { return x * x; }); - * - * [ES6]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla - */ - - - - /** - * Deeply converts plain JS objects and arrays to Immutable Maps and Lists. - * - * If a `reviver` is optionally provided, it will be called with every - * collection as a Seq (beginning with the most nested collections - * and proceeding to the top-level collection itself), along with the key - * refering to each collection and the parent JS object provided as `this`. - * For the top level, object, the key will be `""`. This `reviver` is expected - * to return a new Immutable Iterable, allowing for custom conversions from - * deep JS objects. - * - * This example converts JSON to List and OrderedMap: - * - * Immutable.fromJS({a: {b: [10, 20, 30]}, c: 40}, function (key, value) { - * var isIndexed = Immutable.Iterable.isIndexed(value); - * return isIndexed ? value.toList() : value.toOrderedMap(); - * }); - * - * // true, "b", {b: [10, 20, 30]} - * // false, "a", {a: {b: [10, 20, 30]}, c: 40} - * // false, "", {"": {a: {b: [10, 20, 30]}, c: 40}} - * - * If `reviver` is not provided, the default behavior will convert Arrays into - * Lists and Objects into Maps. - * - * `reviver` acts similarly to the [same parameter in `JSON.parse`][1]. - * - * `Immutable.fromJS` is conservative in its conversion. It will only convert - * arrays which pass `Array.isArray` to Lists, and only raw objects (no custom - * prototype) to Map. - * - * Keep in mind, when using JS objects to construct Immutable Maps, that - * JavaScript Object properties are always strings, even if written in a - * quote-less shorthand, while Immutable Maps accept keys of any type. - * - * ```js - * var obj = { 1: "one" }; - * Object.keys(obj); // [ "1" ] - * obj["1"]; // "one" - * obj[1]; // "one" - * - * var map = Map(obj); - * map.get("1"); // "one" - * map.get(1); // undefined - * ``` - * - * Property access for JavaScript Objects first converts the key to a string, - * but since Immutable Map keys can be of any type the argument to `get()` is - * not altered. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter - * "Using the reviver parameter" - */ - export function fromJS( - json: any, - reviver?: (k: any, v: Iterable) => any - ): any; - - - /** - * Value equality check with semantics similar to `Object.is`, but treats - * Immutable `Iterable`s as values, equal if the second `Iterable` includes - * equivalent values. - * - * It's used throughout Immutable when checking for equality, including `Map` - * key equality and `Set` membership. - * - * var map1 = Immutable.Map({a:1, b:1, c:1}); - * var map2 = Immutable.Map({a:1, b:1, c:1}); - * assert(map1 !== map2); - * assert(Object.is(map1, map2) === false); - * assert(Immutable.is(map1, map2) === true); - * - * Note: Unlike `Object.is`, `Immutable.is` assumes `0` and `-0` are the same - * value, matching the behavior of ES6 Map key equality. - */ - export function is(first: any, second: any): boolean; - - - /** - * The `hash()` function is an important part of how Immutable determines if - * two values are equivalent and is used to determine how to store those - * values. Provided with any value, `hash()` will return a 31-bit integer. - * - * When designing Objects which may be equal, it's important than when a - * `.equals()` method returns true, that both values `.hashCode()` method - * return the same value. `hash()` may be used to produce those values. - * - * Note that `hash()` attempts to balance between speed and avoiding - * collisions, however it makes no attempt to produce secure hashes. - */ - export function hash(value: any): number; - - - /** - * Lists are ordered indexed dense collections, much like a JavaScript - * Array. - * - * Lists are immutable and fully persistent with O(log32 N) gets and sets, - * and O(1) push and pop. - * - * Lists implement Deque, with efficient addition and removal from both the - * end (`push`, `pop`) and beginning (`unshift`, `shift`). - * - * Unlike a JavaScript Array, there is no distinction between an - * "unset" index and an index set to `undefined`. `List#forEach` visits all - * indices from 0 to size, regardless of whether they were explicitly defined. - */ - export module List { - - /** - * True if the provided value is a List - * - * ```js - * List.isList([]); // false - * List.isList(List([])); // true - * ``` - */ - function isList(maybeList: any): maybeList is List; - - /** - * Creates a new List containing `values`. - * - * ```js - * List.of(1, 2, 3, 4).toJS(); - * // [ 1, 2, 3, 4 ] - * - * List.of({x:1}, 2, [3], 4).toJS(); - * // [ { x: 1 }, 2, [ 3 ], 4 ] - * ``` - */ - function of(...values: T[]): List; - } - - /** - * Create a new immutable List containing the values of the provided - * iterable-like. - * - * ```js - * List().toJS(); // [] - * - * const plainArray = [1, 2, 3, 4]; - * const listFromPlainArray = List(plainArray); - * - * const plainSet = new Set([1, 2, 3, 4]); - * const listFromPlainSet = List(plainSet); - * - * const iterableArray = plainArray[Symbol.iterator](); - * const listFromIterableArray = List(iterableArray); - * - * listFromPlainArray.toJS(); // [ 1, 2, 3, 4 ] - * listFromPlainSet.toJS(); // [ 1, 2, 3, 4 ] - * listFromIterableArray.toJS(); // [ 1, 2, 3, 4 ] - * - * Immutable.is(listFromPlainArray, listFromIterableSet); // true - * Immutable.is(listFromPlainSet, listFromIterableSet) // true - * Immutable.is(listFromPlainSet, listFromPlainArray) // true - * ``` - */ - export function List(): List; - export function List(): List; - export function List(iterable: ESIterable): List; - - export interface List extends Collection.Indexed { - - // Persistent changes - - /** - * Returns a new List which includes `value` at `index`. If `index` already - * exists in this List, it will be replaced. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.set(-1, "value")` sets the last item in the List. - * - * If `index` larger than `size`, the returned List's `size` will be large - * enough to include the `index`. - * - * ```js - * const originalList = List([0]); - * originalList.set(1, 1).toJS(); // [ 0, 1 ] - * originalList.set(0, 'overwritten').toJS(); // [ 'overwritten' ] - * - * List().set(50000, 'value').size; - * //50001 - * ``` - */ - set(index: number, value: T): List; - - /** - * Returns a new List which excludes this `index` and with a size 1 less - * than this List. Values at indices above `index` are shifted down by 1 to - * fill the position. - * - * This is synonymous with `list.splice(index, 1)`. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.delete(-1)` deletes the last item in the List. - * - * Note: `delete` cannot be safely used in IE8 - * - * ```js - * List([0, 1, 2, 3, 4]).delete(0).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - * - * @alias remove - */ - delete(index: number): List; - remove(index: number): List; - - /** - * Returns a new List with `value` at `index` with a size 1 more than this - * List. Values at indices above `index` are shifted over by 1. - * - * This is synonymous with `list.splice(index, 0, value)`. - * - * ```js - * List([0, 1, 2, 3, 4]).insert(6, 5).toJS(); - * // [ 0, 1, 2, 3, 4, 5 ] - * ``` - */ - insert(index: number, value: T): List; - - /** - * Returns a new List with 0 size and no values. - * - * ```js - * List([1, 2, 3, 4]).clear().toJS(); - * // [] - * ``` - */ - clear(): List; - - /** - * Returns a new List with the provided `values` appended, starting at this - * List's `size`. - * - * ```js - * List([1, 2, 3, 4]).push(5).toJS(); - * // [ 1, 2, 3, 4, 5 ] - * ``` - */ - push(...values: T[]): List; - - /** - * Returns a new List with a size ones less than this List, excluding - * the last index in this List. - * - * Note: this differs from `Array#pop` because it returns a new - * List rather than the removed value. Use `last()` to get the last value - * in this List. - * ```js - * List([1, 2, 3, 4]).pop().toJS(); - * // [ 1, 2, 3 ] - * ``` - */ - pop(): List; - - /** - * Returns a new List with the provided `values` prepended, shifting other - * values ahead to higher indices. - * - * ```js - * List([ 2, 3, 4]).unshift(1).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - */ - unshift(...values: T[]): List; - - /** - * Returns a new List with a size ones less than this List, excluding - * the first index in this List, shifting all other values to a lower index. - * - * Note: this differs from `Array#shift` because it returns a new - * List rather than the removed value. Use `first()` to get the first - * value in this List. - * - * ```js - * List([ 0, 1, 2, 3, 4]).shift(0).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - */ - shift(): List; - - /** - * Returns a new List with an updated value at `index` with the return - * value of calling `updater` with the existing value, or `notSetValue` if - * `index` was not set. If called with a single argument, `updater` is - * called with the List itself. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.update(-1)` updates the last item in the List. - * - * @see `Map#update` - */ - update(updater: (value: List) => List): List; - update(index: number, updater: (value: T) => T): List; - update(index: number, notSetValue: T, updater: (value: T) => T): List; - - /** - * @see `Map#merge` - */ - merge(...iterables: Iterable.Indexed[]): List; - merge(...iterables: Array[]): List; - - /** - * @see `Map#mergeWith` - */ - mergeWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Iterable.Indexed[] - ): List; - mergeWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Array[] - ): List; - - /** - * @see `Map#mergeDeep` - */ - mergeDeep(...iterables: Iterable.Indexed[]): List; - mergeDeep(...iterables: Array[]): List; - - /** - * @see `Map#mergeDeepWith` - */ - mergeDeepWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Iterable.Indexed[] - ): List; - mergeDeepWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Array[] - ): List; - - /** - * Returns a new List with size `size`. If `size` is less than this - * List's size, the new List will exclude values at the higher indices. - * If `size` is greater than this List's size, the new List will have - * undefined values for the newly available indices. - * - * When building a new List and the final size is known up front, `setSize` - * used in conjunction with `withMutations` may result in the more - * performant construction. - */ - setSize(size: number): List; - - - // Deep persistent changes - - /** - * Returns a new List having set `value` at this `keyPath`. If any keys in - * `keyPath` do not exist, a new immutable Map will be created at that key. - * - * Index numbers are used as keys to determine the path to follow in - * the List. - * - * ```js - * Immutable.fromJS([0, 1, 2, [3, 4]]).setIn([3, 0], -3).toJS(); - * // [ 0, 1, 2, [ -3, 4 ] ] - * ``` - */ - setIn(keyPath: Array, value: any): List; - setIn(keyPath: Iterable, value: any): List; - - /** - * Returns a new List having removed the value at this `keyPath`. If any - * keys in `keyPath` do not exist, no change will occur. - * - * ```js - * Immutable.fromJS([0, 1, 2, [3, 4]]).deleteIn([3, 1]).toJS(); - * // [ 0, 1, 2, [ 3 ] ] - * ``` - * @alias removeIn - */ - deleteIn(keyPath: Array): List; - deleteIn(keyPath: Iterable): List; - removeIn(keyPath: Array): List; - removeIn(keyPath: Iterable): List; - - /** - * @see `Map#updateIn` - */ - updateIn( - keyPath: Array, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Array, - notSetValue: any, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Iterable, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Iterable, - notSetValue: any, - updater: (value: any) => any - ): List; - - /** - * @see `Map#mergeIn` - */ - mergeIn(keyPath: Array | Iterable, ...iterables: Array): List; - - /** - * @see `Map#mergeDeepIn` - */ - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): List; - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set`, `push`, `pop`, `shift`, `unshift` and - * `merge` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: List) => any): List; - - /** - * @see `Map#asMutable` - */ - asMutable(): List; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): List; - - // Sequence algorithms - - /** - * Returns a new List with values passed through a - * `mapper` function. - * - * List([1,2]).map(x => 10 * x) - * // List [ 10, 20 ] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): List; - } - - - /** - * Immutable Map is an unordered Iterable.Keyed of (key, value) pairs with - * `O(log32 N)` gets and `O(log32 N)` persistent sets. - * - * Iteration order of a Map is undefined, however is stable. Multiple - * iterations of the same Map will iterate in the same order. - * - * Map's keys can be of any type, and use `Immutable.is` to determine key - * equality. This allows the use of any value (including NaN) as a key. - * - * Because `Immutable.is` returns equality based on value semantics, and - * Immutable collections are treated as values, any Immutable collection may - * be used as a key. - * - * Map().set(List.of(1), 'listofone').get(List.of(1)); - * // 'listofone' - * - * Any JavaScript object may be used as a key, however strict identity is used - * to evaluate key equality. Two similar looking objects will represent two - * different keys. - * - * Implemented by a hash-array mapped trie. - */ - export module Map { - - /** - * True if the provided value is a Map - * - * ```js - * Map.isMap({}); // false - * Map.isMap(Immutable.Map()); // true - * ``` - */ - function isMap(maybeMap: any): maybeMap is Map; - - /** - * Creates a new Map from alternating keys and values - * - * ```js - * Map.of( - * 'key', 'value', - * 'numerical value', 3, - * 0, 'numerical key' - * ).toJS(); - * // { '0': 'numerical key', key: 'value', 'numerical value': 3 } - * ``` - * - * @deprecated Use Map([ [ 'k', 'v' ] ]) or Map({ k: 'v' }) - */ - function of(...keyValues: any[]): Map; - } - - /** - * Creates a new Immutable Map. - * - * Created with the same key value pairs as the provided Iterable.Keyed or - * JavaScript Object or expects an Iterable of [K, V] tuple entries. - * - * var newMap = Map({key: "value"}); - * var newMap = Map([["key", "value"]]); - * - * Keep in mind, when using JS objects to construct Immutable Maps, that - * JavaScript Object properties are always strings, even if written in a - * quote-less shorthand, while Immutable Maps accept keys of any type. - * - * ```js - * var obj = { 1: "one" }; - * Object.keys(obj); // [ "1" ] - * obj["1"]; // "one" - * obj[1]; // "one" - * - * var map = Map(obj); - * map.get("1"); // "one" - * map.get(1); // undefined - * ``` - * - * Property access for JavaScript Objects first converts the key to a string, - * but since Immutable Map keys can be of any type the argument to `get()` is - * not altered. - */ - export function Map(): Map; - export function Map(): Map; - export function Map(iterable: ESIterable<[K, V]>): Map; - export function Map(iterable: ESIterable>): Map; - export function Map(obj: {[key: string]: V}): Map; - - export interface Map extends Collection.Keyed { - - // Persistent changes - - /** - * Returns a new Map also containing the new key, value pair. If an equivalent - * key already exists in this Map, it will be replaced. - * - * ```js - * const originalMap = Immutable.Map(); - * const newerMap = originalMap.set('key', 'value'); - * const newestMap = newerMap.set('key', 'newer value'); - * originalMap.toJS(); // {} - * newerMap.toJS(); // { key: 'value' } - * newestMap.toJS(); // { key: 'newer value' } - * ``` - */ - set(key: K, value: V): Map; - - /** - * Returns a new Map which excludes this `key`. - * - * Note: `delete` cannot be safely used in IE8, but is provided to mirror - * the ES6 collection API. - * - * ```js - * Immutable.Map({ - * key: 'value', - * otherKey: 'other value' - * }).delete('otherKey').toJS(); - * // { key: 'value' } - * ``` - * - * @alias remove - */ - delete(key: K): Map; - remove(key: K): Map; - - /** - * Returns a new Map which excludes the provided `keys`. - * - * var names = Immutable.Map({ a: "Aaron", b: "Barry", c: "Connor" }); - * names.deleteAll(['a', 'c']); // { b: "Barry" } - * - * @alias removeAll - */ - deleteAll(keys: Array | ESIterable): Map; - removeAll(keys: Array | ESIterable): Map; - - /** - * Returns a new Map containing no keys or values. - * - * ```js - * Immutable.Map({ key: 'value' }).clear().toJS(); - * // {} - * ``` - */ - clear(): Map; - - /** - * Returns a new Map having updated the value at this `key` with the return - * value of calling `updater` with the existing value, or `notSetValue` if - * the key was not set. If called with only a single argument, `updater` is - * called with the Map itself. - * - * Equivalent to: `map.set(key, updater(map.get(key)))`. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * const newMap = originalMap.update('key', value => { - * return value + value; - * }); - * newMap.toJS(); // { key: 'valuevalue' } - * - * When a `notSetValue` is provided, it is provided to the `updater` - * function when the value at the key does not exist in the Map. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * let newMap = originalMap.update('noKey', 'no value', value => { - * return value + value; - * }); - * newMap.toJS(); // { key: 'value', noKey: 'no valueno value' } - * - * However, if the `updater` function returns the same value it was called - * with, then no change will occur. This is still true if `notSetValue` - * is provided. - * - * var data1 = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data2 = data1.update('key', 100, val => val); - * assert(data2 === data1); - * - * If no key is provided, then the `updater` function return value is - * returned as well. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * const result = originalMap.update(map => { - * return map.get('key'); - * }); - * result; // 'value' - * - */ - update(key: K, updater: (value: V) => V): Map; - update(key: K, notSetValue: V, updater: (value: V) => V): Map; - update(updater: (value: Map) => R): R; - - /** - * Returns a new Map resulting from merging the provided Iterables - * (or JS objects) into this Map. In other words, this takes each entry of - * each iterable and sets it on this Map. - * - * If any of the values provided to `merge` are not Iterable (would return - * false for `Immutable.Iterable.isIterable`) then they are deeply converted - * via `Immutable.fromJS` before being merged. However, if the value is an - * Iterable but includes non-iterable JS objects or arrays, those nested - * values will be preserved. - * - * var x = Immutable.Map({a: 10, b: 20, c: 30}); - * var y = Immutable.Map({b: 40, a: 50, d: 60}); - * x.merge(y) // { a: 50, b: 40, c: 30, d: 60 } - * y.merge(x) // { b: 20, a: 10, d: 60, c: 30 } - * - */ - merge(...iterables: Iterable[]): Map; - merge(...iterables: {[key: string]: V}[]): Map; - - /** - * Like `merge()`, `mergeWith()` returns a new Map resulting from merging - * the provided Iterables (or JS objects) into this Map, but uses the - * `merger` function for dealing with conflicts. - * - * var x = Immutable.Map({a: 10, b: 20, c: 30}); - * var y = Immutable.Map({b: 40, a: 50, d: 60}); - * x.mergeWith((prev, next) => prev / next, y) // { a: 0.2, b: 0.5, c: 30, d: 60 } - * y.mergeWith((prev, next) => prev / next, x) // { b: 2, a: 5, d: 60, c: 30 } - * - */ - mergeWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: Iterable[] - ): Map; - mergeWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: {[key: string]: V}[] - ): Map; - - /** - * Like `merge()`, but when two Iterables conflict, it merges them as well, - * recursing deeply through the nested data. - * - * var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } }); - * var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } }); - * x.mergeDeep(y) // {a: { x: 2, y: 10 }, b: { x: 20, y: 5 }, c: { z: 3 } } - * - */ - mergeDeep(...iterables: Iterable[]): Map; - mergeDeep(...iterables: {[key: string]: V}[]): Map; - - /** - * Like `mergeDeep()`, but when two non-Iterables conflict, it uses the - * `merger` function to determine the resulting value. - * - * var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } }); - * var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } }); - * x.mergeDeepWith((prev, next) => prev / next, y) - * // {a: { x: 5, y: 10 }, b: { x: 20, y: 10 }, c: { z: 3 } } - * - */ - mergeDeepWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: Iterable[] - ): Map; - mergeDeepWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: {[key: string]: V}[] - ): Map; - - - // Deep persistent changes - - /** - * Returns a new Map having set `value` at this `keyPath`. If any keys in - * `keyPath` do not exist, a new immutable Map will be created at that key. - * - * ```js - * const originalMap = Immutable.fromJS({ - * subObject: { - * subKey: 'subvalue', - * subSubObject: { - * subSubKey: 'subSubValue' - * } - * } - * }); - - * const newMap = originalMap.setIn(['subObject', 'subKey'], 'ha ha!'); - * newMap.toJS(); - * // {subObject:{subKey:'ha ha!', subSubObject:{subSubKey:'subSubValue'}}} - * - * const newerMap = originalMap.setIn( - * ['subObject', 'subSubObject', 'subSubKey'], - * 'ha ha ha!' - * ); - * newerMap.toJS(); - * // {subObject:{subKey:'subvalue', subSubObject:{subSubKey:'ha ha ha!'}}} - * ``` - */ - setIn(keyPath: Array, value: any): Map; - setIn(KeyPath: Iterable, value: any): Map; - - /** - * Returns a new Map having removed the value at this `keyPath`. If any keys - * in `keyPath` do not exist, no change will occur. - * - * @alias removeIn - */ - deleteIn(keyPath: Array): Map; - deleteIn(keyPath: Iterable): Map; - removeIn(keyPath: Array): Map; - removeIn(keyPath: Iterable): Map; - - /** - * Returns a new Map having applied the `updater` to the entry found at the - * keyPath. - * - * If any keys in `keyPath` do not exist, new Immutable `Map`s will - * be created at those keys. If the `keyPath` does not already contain a - * value, the `updater` function will be called with `notSetValue`, if - * provided, otherwise `undefined`. - * - * var data = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data = data.updateIn(['a', 'b', 'c'], val => val * 2); - * // { a: { b: { c: 20 } } } - * - * If the `updater` function returns the same value it was called with, then - * no change will occur. This is still true if `notSetValue` is provided. - * - * var data1 = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data2 = data1.updateIn(['x', 'y', 'z'], 100, val => val); - * assert(data2 === data1); - * - */ - updateIn( - keyPath: Array, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Array, - notSetValue: any, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Iterable, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Iterable, - notSetValue: any, - updater: (value: any) => any - ): Map; - - /** - * A combination of `updateIn` and `merge`, returning a new Map, but - * performing the merge at a point arrived at by following the keyPath. - * In other words, these two lines are equivalent: - * - * x.updateIn(['a', 'b', 'c'], abc => abc.merge(y)); - * x.mergeIn(['a', 'b', 'c'], y); - * - */ - mergeIn(keyPath: Array | Iterable, ...iterables: Array): Map; - - /** - * A combination of `updateIn` and `mergeDeep`, returning a new Map, but - * performing the deep merge at a point arrived at by following the keyPath. - * In other words, these two lines are equivalent: - * - * x.updateIn(['a', 'b', 'c'], abc => abc.mergeDeep(y)); - * x.mergeDeepIn(['a', 'b', 'c'], y); - * - */ - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): Map; - - // Transient changes - - /** - * Every time you call one of the above functions, a new immutable Map is - * created. If a pure function calls a number of these to produce a final - * return value, then a penalty on performance and memory has been paid by - * creating all of the intermediate immutable Maps. - * - * If you need to apply a series of mutations to produce a new immutable - * Map, `withMutations()` creates a temporary mutable copy of the Map which - * can apply mutations in a highly performant manner. In fact, this is - * exactly how complex mutations like `merge` are done. - * - * As an example, this results in the creation of 2, not 4, new Maps: - * - * var map1 = Immutable.Map(); - * var map2 = map1.withMutations(map => { - * map.set('a', 1).set('b', 2).set('c', 3); - * }); - * assert(map1.size === 0); - * assert(map2.size === 3); - * - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` and `merge` may be used mutatively. - * - */ - withMutations(mutator: (mutable: Map) => any): Map; - - /** - * Another way to avoid creation of intermediate Immutable maps is to create - * a mutable copy of this collection. Mutable copies *always* return `this`, - * and thus shouldn't be used for equality. Your function should never return - * a mutable copy of a collection, only use it internally to create a new - * collection. If possible, use `withMutations` as it provides an easier to - * use API. - * - * Note: if the collection is already mutable, `asMutable` returns itself. - * - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` and `merge` may be used mutatively. - */ - asMutable(): Map; - - /** - * The yin to `asMutable`'s yang. Because it applies to mutable collections, - * this operation is *mutable* and returns itself. Once performed, the mutable - * copy has become immutable and can be safely returned from a function. - */ - asImmutable(): Map; - - // Sequence algorithms - - /** - * Returns a new Map with values passed through a - * `mapper` function. - * - * Map({ a: 1, b: 2 }).map(x => 10 * x) - * // Map { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Map; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Map; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Map; - } - - - /** - * A type of Map that has the additional guarantee that the iteration order of - * entries will be the order in which they were set(). - * - * The iteration behavior of OrderedMap is the same as native ES6 Map and - * JavaScript Object. - * - * Note that `OrderedMap` are more expensive than non-ordered `Map` and may - * consume more memory. `OrderedMap#set` is amortized O(log32 N), but not - * stable. - */ - - export module OrderedMap { - - /** - * True if the provided value is an OrderedMap. - */ - function isOrderedMap(maybeOrderedMap: any): maybeOrderedMap is OrderedMap; - } - - /** - * Creates a new Immutable OrderedMap. - * - * Created with the same key value pairs as the provided Iterable.Keyed or - * JavaScript Object or expects an Iterable of [K, V] tuple entries. - * - * The iteration order of key-value pairs provided to this constructor will - * be preserved in the OrderedMap. - * - * var newOrderedMap = OrderedMap({key: "value"}); - * var newOrderedMap = OrderedMap([["key", "value"]]); - * - */ - export function OrderedMap(): OrderedMap; - export function OrderedMap(): OrderedMap; - export function OrderedMap(iterable: ESIterable<[K, V]>): OrderedMap; - export function OrderedMap(iterable: ESIterable>): OrderedMap; - export function OrderedMap(obj: {[key: string]: V}): OrderedMap; - - export interface OrderedMap extends Map { - - // Sequence algorithms - - /** - * Returns a new OrderedMap with values passed through a - * `mapper` function. - * - * OrderedMap({ a: 1, b: 2 }).map(x => 10 * x) - * // OrderedMap { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): OrderedMap; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): OrderedMap; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): OrderedMap; - } - - - /** - * A Collection of unique values with `O(log32 N)` adds and has. - * - * When iterating a Set, the entries will be (value, value) pairs. Iteration - * order of a Set is undefined, however is stable. Multiple iterations of the - * same Set will iterate in the same order. - * - * Set values, like Map keys, may be of any type. Equality is determined using - * `Immutable.is`, enabling Sets to uniquely include other Immutable - * collections, custom value types, and NaN. - */ - export module Set { - - /** - * True if the provided value is a Set - */ - function isSet(maybeSet: any): maybeSet is Set; - - /** - * Creates a new Set containing `values`. - */ - function of(...values: T[]): Set; - - /** - * `Set.fromKeys()` creates a new immutable Set containing the keys from - * this Iterable or JavaScript Object. - */ - function fromKeys(iter: Iterable): Set; - function fromKeys(obj: {[key: string]: any}): Set; - } - - /** - * Create a new immutable Set containing the values of the provided - * iterable-like. - */ - export function Set(): Set; - export function Set(): Set; - export function Set(iterable: ESIterable): Set; - - export interface Set extends Collection.Set { - - // Persistent changes - - /** - * Returns a new Set which also includes this value. - */ - add(value: T): Set; - - /** - * Returns a new Set which excludes this value. - * - * Note: `delete` cannot be safely used in IE8 - * @alias remove - */ - delete(value: T): Set; - remove(value: T): Set; - - /** - * Returns a new Set containing no values. - */ - clear(): Set; - - /** - * Returns a Set including any value from `iterables` that does not already - * exist in this Set. - * @alias merge - */ - union(...iterables: Iterable[]): Set; - union(...iterables: Array[]): Set; - merge(...iterables: Iterable[]): Set; - merge(...iterables: Array[]): Set; - - - /** - * Returns a Set which has removed any values not also contained - * within `iterables`. - */ - intersect(...iterables: Iterable[]): Set; - intersect(...iterables: Array[]): Set; - - /** - * Returns a Set excluding any values contained within `iterables`. - */ - subtract(...iterables: Iterable[]): Set; - subtract(...iterables: Array[]): Set; - - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `add` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: Set) => any): Set; - - /** - * @see `Map#asMutable` - */ - asMutable(): Set; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): Set; - - // Sequence algorithms - - /** - * Returns a new Set with values passed through a - * `mapper` function. - * - * Set([1,2]).map(x => 10 * x) - * // Set [10,20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Set; - } - - - /** - * A type of Set that has the additional guarantee that the iteration order of - * values will be the order in which they were `add`ed. - * - * The iteration behavior of OrderedSet is the same as native ES6 Set. - * - * Note that `OrderedSet` are more expensive than non-ordered `Set` and may - * consume more memory. `OrderedSet#add` is amortized O(log32 N), but not - * stable. - */ - export module OrderedSet { - - /** - * True if the provided value is an OrderedSet. - */ - function isOrderedSet(maybeOrderedSet: any): boolean; - - /** - * Creates a new OrderedSet containing `values`. - */ - function of(...values: T[]): OrderedSet; - - /** - * `OrderedSet.fromKeys()` creates a new immutable OrderedSet containing - * the keys from this Iterable or JavaScript Object. - */ - function fromKeys(iter: Iterable): OrderedSet; - function fromKeys(obj: {[key: string]: any}): OrderedSet; - } - - /** - * Create a new immutable OrderedSet containing the values of the provided - * iterable-like. - */ - export function OrderedSet(): OrderedSet; - export function OrderedSet(): OrderedSet; - export function OrderedSet(iterable: ESIterable): OrderedSet; - - export interface OrderedSet extends Set { - - // Sequence algorithms - - /** - * Returns a new Set with values passed through a - * `mapper` function. - * - * OrderedSet([1,2]).map(x => 10 * x) - * // Set [10,20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): OrderedSet; - - /** - * Returns an OrderedSet of the same type "zipped" with the provided - * iterables. - * - * @see IndexedIterator.zip - * - * Like `zipWith`, but using the default `zipper`: creating an `Array`. - * - * var a = OrderedSet.of(1, 2, 3); - * var b = OrderedSet.of(4, 5, 6); - * var c = a.zip(b); // OrderedSet [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] - * - */ - zip(...iterables: Array>): OrderedSet; - - /** - * Returns an OrderedSet of the same type "zipped" with the provided - * iterables by using a custom `zipper` function. - * - * @see IndexedIterator.zipWith - */ - zipWith( - zipper: (value: T, otherValue: U) => Z, - otherIterable: Iterable - ): OrderedSet; - zipWith( - zipper: (value: T, otherValue: U, thirdValue: V) => Z, - otherIterable: Iterable, - thirdIterable: Iterable - ): OrderedSet; - zipWith( - zipper: (...any: Array) => Z, - ...iterables: Array> - ): OrderedSet; - - } - - - /** - * Stacks are indexed collections which support very efficient O(1) addition - * and removal from the front using `unshift(v)` and `shift()`. - * - * For familiarity, Stack also provides `push(v)`, `pop()`, and `peek()`, but - * be aware that they also operate on the front of the list, unlike List or - * a JavaScript Array. - * - * Note: `reverse()` or any inherent reverse traversal (`reduceRight`, - * `lastIndexOf`, etc.) is not efficient with a Stack. - * - * Stack is implemented with a Single-Linked List. - */ - export module Stack { - - /** - * True if the provided value is a Stack - */ - function isStack(maybeStack: any): maybeStack is Stack; - - /** - * Creates a new Stack containing `values`. - */ - function of(...values: T[]): Stack; - } - - /** - * Create a new immutable Stack containing the values of the provided - * iterable-like. - * - * The iteration order of the provided iterable is preserved in the - * resulting `Stack`. - */ - export function Stack(): Stack; - export function Stack(): Stack; - export function Stack(iterable: ESIterable): Stack; - - export interface Stack extends Collection.Indexed { - - // Reading values - - /** - * Alias for `Stack.first()`. - */ - peek(): T | undefined; - - - // Persistent changes - - /** - * Returns a new Stack with 0 size and no values. - */ - clear(): Stack; - - /** - * Returns a new Stack with the provided `values` prepended, shifting other - * values ahead to higher indices. - * - * This is very efficient for Stack. - */ - unshift(...values: T[]): Stack; - - /** - * Like `Stack#unshift`, but accepts a iterable rather than varargs. - */ - unshiftAll(iter: Iterable): Stack; - unshiftAll(iter: Array): Stack; - - /** - * Returns a new Stack with a size ones less than this Stack, excluding - * the first item in this Stack, shifting all other values to a lower index. - * - * Note: this differs from `Array#shift` because it returns a new - * Stack rather than the removed value. Use `first()` or `peek()` to get the - * first value in this Stack. - */ - shift(): Stack; - - /** - * Alias for `Stack#unshift` and is not equivalent to `List#push`. - */ - push(...values: T[]): Stack; - - /** - * Alias for `Stack#unshiftAll`. - */ - pushAll(iter: Iterable): Stack; - pushAll(iter: Array): Stack; - - /** - * Alias for `Stack#shift` and is not equivalent to `List#pop`. - */ - pop(): Stack; - - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set`, `push`, and `pop` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: Stack) => any): Stack; - - /** - * @see `Map#asMutable` - */ - asMutable(): Stack; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): Stack; - - // Sequence algorithms - - /** - * Returns a new Stack with values passed through a - * `mapper` function. - * - * Stack([1,2]).map(x => 10 * x) - * // Stack [10,20] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Stack; - } - - - /** - * Returns a Seq.Indexed of numbers from `start` (inclusive) to `end` - * (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to - * infinity. When `start` is equal to `end`, returns empty range. - * - * Range() // [0,1,2,3,...] - * Range(10) // [10,11,12,13,...] - * Range(10,15) // [10,11,12,13,14] - * Range(10,30,5) // [10,15,20,25] - * Range(30,10,5) // [30,25,20,15] - * Range(30,30,5) // [] - * - */ - export function Range(start?: number, end?: number, step?: number): Seq.Indexed; - - - /** - * Returns a Seq.Indexed of `value` repeated `times` times. When `times` is - * not defined, returns an infinite `Seq` of `value`. - * - * Repeat('foo') // ['foo','foo','foo',...] - * Repeat('bar',4) // ['bar','bar','bar','bar'] - * - */ - export function Repeat(value: T, times?: number): Seq.Indexed; - - - /** - * Creates a new Class which produces Record instances. A record is similar to - * a JS object, but enforce a specific set of allowed string keys, and have - * default values. - * - * var ABRecord = Record({a:1, b:2}) - * var myRecord = new ABRecord({b:3}) - * - * Records always have a value for the keys they define. `remove`ing a key - * from a record simply resets it to the default value for that key. - * - * myRecord.size // 2 - * myRecord.get('a') // 1 - * myRecord.get('b') // 3 - * myRecordWithoutB = myRecord.remove('b') - * myRecordWithoutB.get('b') // 2 - * myRecordWithoutB.size // 2 - * - * Values provided to the constructor not found in the Record type will - * be ignored. For example, in this case, ABRecord is provided a key "x" even - * though only "a" and "b" have been defined. The value for "x" will be - * ignored for this record. - * - * var myRecord = new ABRecord({b:3, x:10}) - * myRecord.get('x') // undefined - * - * Because Records have a known set of string keys, property get access works - * as expected, however property sets will throw an Error. - * - * Note: IE8 does not support property access. Only use `get()` when - * supporting IE8. - * - * myRecord.b // 3 - * myRecord.b = 5 // throws Error - * - * Record Classes can be extended as well, allowing for custom methods on your - * Record. This is not a common pattern in functional environments, but is in - * many JS programs. - * - * class ABRecord extends Record({a:1,b:2}) { - * getAB() { - * return this.a + this.b; - * } - * } - * - * var myRecord = new ABRecord({b: 3}) - * myRecord.getAB() // 4 - * - */ - export module Record { - - /** - * Records allow passing a second parameter to supply a descriptive name - * that appears when converting a Record to a string or in any error - * messages. A descriptive name for any record can be accessed by using this - * method. If one was not provided, the string "Record" is returned. - * - * ```js - * var Person = Record({ - * name: null - * }, 'Person') - * - * var me = Person({ name: 'My Name' }) - * me.toString() // "Person { "name": "My Name" }" - * Record.getDescriptiveName(me) // "Person" - * ``` - */ - export function getDescriptiveName(record: Instance): string; - - export interface Class { - (values?: Partial | ESIterable<[string, any]>): Instance & Readonly; - new (values?: Partial | ESIterable<[string, any]>): Instance & Readonly; - } - - export interface Instance { - size: number; - - // Reading values - - has(key: string): boolean; - get(key: K): T[K]; - - // Value equality - - equals(other: any): boolean; - hashCode(): number; - - // Persistent changes - - set(key: K, value: T[K]): this; - update(key: K, updater: (value: T[K]) => T[K]): this; - merge(...iterables: Array | ESIterable<[string, any]>>): this; - mergeDeep(...iterables: Array | ESIterable<[string, any]>>): this; - - /** - * @alias remove - */ - delete(key: K): this; - remove(key: K): this; - clear(): this; - - // Deep persistent changes - - setIn(keyPath: Array | Iterable, value: any): this; - updateIn(keyPath: Array | Iterable, updater: (value: any) => any): this; - mergeIn(keyPath: Array | Iterable, ...iterables: Array): this; - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): this; - - /** - * @alias removeIn - */ - deleteIn(keyPath: Array | Iterable): this; - removeIn(keyPath: Array | Iterable): this; - - // Conversion to JavaScript types - - /** - * Deeply converts this Record to equivalent JS. - * - * @alias toJSON - */ - toJS(): any; - - /** - * Shallowly converts this Record to equivalent JS. - */ - toObject(): T; - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: this) => any): this; - - /** - * @see `Map#asMutable` - */ - asMutable(): this; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): this; - - // Sequence algorithms - - [Symbol.iterator](): Iterator<[keyof T, T[keyof T]]>; - } - } - - export function Record(defaultValues: T, name?: string): Record.Class; - - - /** - * Represents a sequence of values, but may not be backed by a concrete data - * structure. - * - * **Seq is immutable** — Once a Seq is created, it cannot be - * changed, appended to, rearranged or otherwise modified. Instead, any - * mutative method called on a `Seq` will return a new `Seq`. - * - * **Seq is lazy** — Seq does as little work as necessary to respond to any - * method call. Values are often created during iteration, including implicit - * iteration when reducing or converting to a concrete data structure such as - * a `List` or JavaScript `Array`. - * - * For example, the following performs no work, because the resulting - * Seq's values are never iterated: - * - * var oddSquares = Immutable.Seq.of(1,2,3,4,5,6,7,8) - * .filter(x => x % 2).map(x => x * x); - * - * Once the Seq is used, it performs only the work necessary. In this - * example, no intermediate data structures are ever created, filter is only - * called three times, and map is only called once: - * - * console.log(oddSquares.get(1)); // 9 - * - * Seq allows for the efficient chaining of operations, - * allowing for the expression of logic that can otherwise be very tedious: - * - * Immutable.Seq({a:1, b:1, c:1}) - * .flip().map(key => key.toUpperCase()).flip().toObject(); - * // Map { A: 1, B: 1, C: 1 } - * - * As well as expressing logic that would otherwise be memory or time limited: - * - * Immutable.Range(1, Infinity) - * .skip(1000) - * .map(n => -n) - * .filter(n => n % 2 === 0) - * .take(2) - * .reduce((r, n) => r * n, 1); - * // 1006008 - * - * Seq is often used to provide a rich collection API to JavaScript Object. - * - * Immutable.Seq({ x: 0, y: 1, z: 2 }).map(v => v * 2).toObject(); - * // { x: 0, y: 2, z: 4 } - */ - - export module Seq { - /** - * True if `maybeSeq` is a Seq, it is not backed by a concrete - * structure such as Map, List, or Set. - */ - function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed | Seq.Keyed; - - /** - * Returns a Seq of the values provided. Alias for `Seq.Indexed.of()`. - */ - function of(...values: T[]): Seq.Indexed; - - - /** - * `Seq` which represents key-value pairs. - */ - export module Keyed {} - - /** - * Always returns a Seq.Keyed, if input is not keyed, expects an - * iterable of [K, V] tuples. - */ - export function Keyed(): Seq.Keyed; - export function Keyed(): Seq.Keyed; - export function Keyed(iterable: ESIterable<[K, V]>): Seq.Keyed; - export function Keyed(obj: {[key: string]: V}): Seq.Keyed; - - export interface Keyed extends Seq, Iterable.Keyed { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Keyed with values passed through a - * `mapper` function. - * - * Indexed([1, 2]).map(x => 10 * x) - * // Indexed [10, 20] - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Seq.Keyed; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Seq.Keyed; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Seq.Keyed; - } - - - /** - * `Seq` which represents an ordered indexed list of values. - */ - module Indexed { - - /** - * Provides an Seq.Indexed of the values provided. - */ - function of(...values: T[]): Seq.Indexed; - } - - /** - * Always returns Seq.Indexed, discarding associated keys and - * supplying incrementing indices. - */ - export function Indexed(): Seq.Indexed; - export function Indexed(): Seq.Indexed; - export function Indexed(iterable: ESIterable): Seq.Indexed; - - export interface Indexed extends Seq, Iterable.Indexed { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Indexed with values passed through a - * `mapper` function. - * - * Seq.Indexed({a: 1, b: 2}).map(x => 10 * x) - * // Seq.Indexed {a: 10, b: 20} - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Seq.Indexed; - } - - - /** - * `Seq` which represents a set of values. - * - * Because `Seq` are often lazy, `Seq.Set` does not provide the same guarantee - * of value uniqueness as the concrete `Set`. - */ - export module Set { - - /** - * Returns a Seq.Set of the provided values - */ - function of(...values: T[]): Seq.Set; - } - - /** - * Always returns a Seq.Set, discarding associated indices or keys. - */ - export function Set(): Seq.Set; - export function Set(): Seq.Set; - export function Set(iterable: ESIterable): Seq.Set; - - export interface Set extends Seq, Iterable.Set { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Set with values passed through a - * `mapper` function. - * - * Seq.Set([1, 2]).map(x => 10 * x) - * // Seq.Set [10, 20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Seq.Set; - } - - } - - /** - * Creates a Seq. - * - * Returns a particular kind of `Seq` based on the input. - * - * * If a `Seq`, that same `Seq`. - * * If an `Iterable`, a `Seq` of the same kind (Keyed, Indexed, or Set). - * * If an Array-like, an `Seq.Indexed`. - * * If an Object with an Iterator, an `Seq.Indexed`. - * * If an Iterator, an `Seq.Indexed`. - * * If an Object, a `Seq.Keyed`. - * - */ - export function Seq(): Seq; - export function Seq(): Seq; - export function Seq>(seq: S): S; - export function Seq(iterable: Iterable.Keyed): Seq.Keyed; - export function Seq(iterable: Iterable.Indexed): Seq.Indexed; - export function Seq(iterable: Iterable.Set): Seq.Set; - export function Seq(iterable: ESIterable): Seq.Indexed; - export function Seq(obj: {[key: string]: V}): Seq.Keyed; - - export interface Seq extends Iterable { - - /** - * Some Seqs can describe their size lazily. When this is the case, - * size will be an integer. Otherwise it will be undefined. - * - * For example, Seqs returned from `map()` or `reverse()` - * preserve the size of the original `Seq` while `filter()` does not. - * - * Note: `Range`, `Repeat` and `Seq`s made from `Array`s and `Object`s will - * always have a size. - */ - size: number/*?*/; - - - // Force evaluation - - /** - * Because Sequences are lazy and designed to be chained together, they do - * not cache their results. For example, this map function is called a total - * of 6 times, as each `join` iterates the Seq of three values. - * - * var squares = Seq.of(1,2,3).map(x => x * x); - * squares.join() + squares.join(); - * - * If you know a `Seq` will be used multiple times, it may be more - * efficient to first cache it in memory. Here, the map function is called - * only 3 times. - * - * var squares = Seq.of(1,2,3).map(x => x * x).cacheResult(); - * squares.join() + squares.join(); - * - * Use this method judiciously, as it must fully evaluate a Seq which can be - * a burden on memory and possibly performance. - * - * Note: after calling `cacheResult`, a Seq will always have a `size`. - */ - cacheResult(): this; - - // Sequence algorithms - - /** - * Returns a new Seq with values passed through a - * `mapper` function. - * - * Seq({a: 1, b: 2}).map(x => 10 * x) - * // Set {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Seq; - } - - /** - * The `Iterable` is a set of (key, value) entries which can be iterated, and - * is the base class for all collections in `immutable`, allowing them to - * make use of all the Iterable methods (such as `map` and `filter`). - * - * Note: An iterable is always iterated in the same order, however that order - * may not always be well defined, as is the case for the `Map` and `Set`. - */ - export module Iterable { - /** - * True if `maybeIterable` is an Iterable, or any of its subclasses. - * - * ```js - * Iterable.isIterable([]); // false - * Iterable.isIterable({}); // false - * Iterable.isIterable(Immutable.Map()); // true - * Iterable.isIterable(Immutable.List()); // true - * Iterable.isIterable(Immutable.Stack()); // true - * ``` - */ - function isIterable(maybeIterable: any): maybeIterable is Iterable; - - /** - * True if `maybeKeyed` is an Iterable.Keyed, or any of its subclasses. - */ - function isKeyed(maybeKeyed: any): maybeKeyed is Iterable.Keyed; - - /** - * True if `maybeIndexed` is a Iterable.Indexed, or any of its subclasses. - */ - function isIndexed(maybeIndexed: any): maybeIndexed is Iterable.Indexed; - - /** - * True if `maybeAssociative` is either a keyed or indexed Iterable. - */ - function isAssociative(maybeAssociative: any): maybeAssociative is Iterable.Keyed | Iterable.Indexed; - - /** - * True if `maybeOrdered` is an Iterable where iteration order is well - * defined. True for Iterable.Indexed as well as OrderedMap and OrderedSet. - */ - function isOrdered(maybeOrdered: any): boolean; - - - /** - * Keyed Iterables have discrete keys tied to each value. - * - * When iterating `Iterable.Keyed`, each iteration will yield a `[K, V]` - * tuple, in other words, `Iterable#entries` is the default iterator for - * Keyed Iterables. - */ - export module Keyed {} - - /** - * Creates an Iterable.Keyed - * - * Similar to `Iterable()`, however it expects iterable-likes of [K, V] - * tuples if not constructed from a Iterable.Keyed or JS Object. - */ - export function Keyed(iterable: ESIterable<[K, V]>): Iterable.Keyed; - export function Keyed(obj: {[key: string]: V}): Iterable.Keyed; - - export interface Keyed extends Iterable { - - /** - * Returns Seq.Keyed. - * @override - */ - toSeq(): Seq.Keyed; - - - // Sequence functions - - /** - * Returns a new Iterable.Keyed of the same type where the keys and values - * have been flipped. - * - * Seq({ a: 'z', b: 'y' }).flip() // { z: 'a', y: 'b' } - * - */ - flip(): this; - - /** - * Returns a new Iterable.Keyed with values passed through a - * `mapper` function. - * - * Iterable.Keyed({a: 1, b: 2}).map(x => 10 * x) - * // Iterable.Keyed {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Iterable.Keyed; - - /** - * Returns a new Iterable.Keyed of the same type with keys passed through - * a `mapper` function. - * - * Seq({ a: 1, b: 2 }) - * .mapKeys(x => x.toUpperCase()) - * // Seq { A: 1, B: 2 } - * - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Iterable.Keyed; - - /** - * Returns a new Iterable.Keyed of the same type with entries - * ([key, value] tuples) passed through a `mapper` function. - * - * Seq({ a: 1, b: 2 }) - * .mapEntries(([k, v]) => [k.toUpperCase(), v * 2]) - * // Seq { A: 2, B: 4 } - * - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Iterable.Keyed; - - [Symbol.iterator](): Iterator<[K, V]>; - } - - - /** - * Indexed Iterables have incrementing numeric keys. They exhibit - * slightly different behavior than `Iterable.Keyed` for some methods in order - * to better mirror the behavior of JavaScript's `Array`, and add methods - * which do not make sense on non-indexed Iterables such as `indexOf`. - * - * Unlike JavaScript arrays, `Iterable.Indexed`s are always dense. "Unset" - * indices and `undefined` indices are indistinguishable, and all indices from - * 0 to `size` are visited when iterated. - * - * All Iterable.Indexed methods return re-indexed Iterables. In other words, - * indices always start at 0 and increment until size. If you wish to - * preserve indices, using them as keys, convert to a Iterable.Keyed by - * calling `toKeyedSeq`. - */ - export module Indexed {} - - /** - * Creates a new Iterable.Indexed. - */ - export function Indexed(iterable: ESIterable): Iterable.Indexed; - - export interface Indexed extends Iterable { - - // Reading values - - /** - * Returns the value associated with the provided index, or notSetValue if - * the index is beyond the bounds of the Iterable. - * - * `index` may be a negative number, which indexes back from the end of the - * Iterable. `s.get(-1)` gets the last item in the Iterable. - */ - get(index: number, notSetValue?: T): T | undefined; - - - // Conversion to Seq - - /** - * Returns Seq.Indexed. - * @override - */ - toSeq(): Seq.Indexed; - - /** - * If this is an iterable of [key, value] entry tuples, it will return a - * Seq.Keyed of those entries. - */ - fromEntrySeq(): Seq.Keyed; - - - // Combination - - /** - * Returns an Iterable of the same type with `separator` between each item - * in this Iterable. - */ - interpose(separator: T): this; - - /** - * Returns an Iterable of the same type with the provided `iterables` - * interleaved into this iterable. - * - * The resulting Iterable includes the first item from each, then the - * second from each, etc. - * - * I.Seq.of(1,2,3).interleave(I.Seq.of('A','B','C')) - * // Seq [ 1, 'A', 2, 'B', 3, 'C' ] - * - * The shortest Iterable stops interleave. - * - * I.Seq.of(1,2,3).interleave( - * I.Seq.of('A','B'), - * I.Seq.of('X','Y','Z') - * ) - * // Seq [ 1, 'A', 'X', 2, 'B', 'Y' ] - */ - interleave(...iterables: Array>): this; - - /** - * Splice returns a new indexed Iterable by replacing a region of this - * Iterable with new values. If values are not provided, it only skips the - * region to be removed. - * - * `index` may be a negative number, which indexes back from the end of the - * Iterable. `s.splice(-2)` splices after the second to last item. - * - * Seq(['a','b','c','d']).splice(1, 2, 'q', 'r', 's') - * // Seq ['a', 'q', 'r', 's', 'd'] - * - */ - splice( - index: number, - removeNum: number, - ...values: T[] - ): this; - - /** - * Returns an Iterable of the same type "zipped" with the provided - * iterables. - * - * Like `zipWith`, but using the default `zipper`: creating an `Array`. - * - * var a = Seq.of(1, 2, 3); - * var b = Seq.of(4, 5, 6); - * var c = a.zip(b); // Seq [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] - * - */ - zip(...iterables: Array>): Iterable.Indexed; - - /** - * Returns an Iterable of the same type "zipped" with the provided - * iterables by using a custom `zipper` function. - * - * var a = Seq.of(1, 2, 3); - * var b = Seq.of(4, 5, 6); - * var c = a.zipWith((a, b) => a + b, b); // Seq [ 5, 7, 9 ] - * - */ - zipWith( - zipper: (value: T, otherValue: U) => Z, - otherIterable: Iterable - ): Iterable.Indexed; - zipWith( - zipper: (value: T, otherValue: U, thirdValue: V) => Z, - otherIterable: Iterable, - thirdIterable: Iterable - ): Iterable.Indexed; - zipWith( - zipper: (...any: Array) => Z, - ...iterables: Array> - ): Iterable.Indexed; - - - // Search for value - - /** - * Returns the first index at which a given value can be found in the - * Iterable, or -1 if it is not present. - */ - indexOf(searchValue: T): number; - - /** - * Returns the last index at which a given value can be found in the - * Iterable, or -1 if it is not present. - */ - lastIndexOf(searchValue: T): number; - - /** - * Returns the first index in the Iterable where a value satisfies the - * provided predicate function. Otherwise -1 is returned. - */ - findIndex( - predicate: (value: T, index: number, iter: this) => boolean, - context?: any - ): number; - - /** - * Returns the last index in the Iterable where a value satisfies the - * provided predicate function. Otherwise -1 is returned. - */ - findLastIndex( - predicate: (value: T, index: number, iter: this) => boolean, - context?: any - ): number; - - // Sequence algorithms - - /** - * Returns a new Iterable.Indexed with values passed through a - * `mapper` function. - * - * Iterable.Indexed([1,2]).map(x => 10 * x) - * // Iterable.Indexed [1,2] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Iterable.Indexed; - - [Symbol.iterator](): Iterator; - } - - - /** - * Set Iterables only represent values. They have no associated keys or - * indices. Duplicate values are possible in Seq.Sets, however the - * concrete `Set` does not allow duplicate values. - * - * Iterable methods on Iterable.Set such as `map` and `forEach` will provide - * the value as both the first and second arguments to the provided function. - * - * var seq = Seq.Set.of('A', 'B', 'C'); - * assert.equal(seq.every((v, k) => v === k), true); - * - */ - export module Set {} - - /** - * Similar to `Iterable()`, but always returns a Iterable.Set. - */ - export function Set(iterable: ESIterable): Iterable.Set; - - export interface Set extends Iterable { - - /** - * Returns Seq.Set. - * @override - */ - toSeq(): Seq.Set; - - // Sequence algorithms - - /** - * Returns a new Iterable.Set with values passed through a - * `mapper` function. - * - * Iterable.Set([1,2]).map(x => 10 * x) - * // Iterable.Set [1,2] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Iterable.Set; - - [Symbol.iterator](): Iterator; - } - - } - - /** - * Creates an Iterable. - * - * The type of Iterable created is based on the input. - * - * * If an `Iterable`, that same `Iterable`. - * * If an Array-like, an `Iterable.Indexed`. - * * If an Object with an Iterator, an `Iterable.Indexed`. - * * If an Iterator, an `Iterable.Indexed`. - * * If an Object, an `Iterable.Keyed`. - * - * This methods forces the conversion of Objects and Strings to Iterables. - * If you want to ensure that a Iterable of one item is returned, use - * `Seq.of`. - */ - export function Iterable>(iterable: I): I; - export function Iterable(iterable: ESIterable): Iterable.Indexed; - export function Iterable(obj: {[key: string]: V}): Iterable.Keyed; - - export interface Iterable { - - // Value equality - - /** - * True if this and the other Iterable have value equality, as defined - * by `Immutable.is()`. - * - * Note: This is equivalent to `Immutable.is(this, other)`, but provided to - * allow for chained expressions. - */ - equals(other: any): boolean; - - /** - * Computes and returns the hashed identity for this Iterable. - * - * The `hashCode` of an Iterable is used to determine potential equality, - * and is used when adding this to a `Set` or as a key in a `Map`, enabling - * lookup via a different instance. - * - * var a = List.of(1, 2, 3); - * var b = List.of(1, 2, 3); - * assert(a !== b); // different instances - * var set = Set.of(a); - * assert(set.has(b) === true); - * - * If two values have the same `hashCode`, they are [not guaranteed - * to be equal][Hash Collision]. If two values have different `hashCode`s, - * they must not be equal. - * - * [Hash Collision]: http://en.wikipedia.org/wiki/Collision_(computer_science) - */ - hashCode(): number; - - - // Reading values - - /** - * Returns the value associated with the provided key, or notSetValue if - * the Iterable does not contain this key. - * - * Note: it is possible a key may be associated with an `undefined` value, - * so if `notSetValue` is not provided and this method returns `undefined`, - * that does not guarantee the key was not found. - */ - get(key: K, notSetValue?: V): V | undefined; - - /** - * True if a key exists within this `Iterable`, using `Immutable.is` to determine equality - */ - has(key: K): boolean; - - /** - * True if a value exists within this `Iterable`, using `Immutable.is` to determine equality - * @alias contains - */ - includes(value: V): boolean; - contains(value: V): boolean; - - /** - * The first value in the Iterable. - */ - first(): V | undefined; - - /** - * The last value in the Iterable. - */ - last(): V | undefined; - - - // Reading deep values - - /** - * Returns the value found by following a path of keys or indices through - * nested Iterables. - */ - getIn(searchKeyPath: Array, notSetValue?: any): any; - getIn(searchKeyPath: Iterable, notSetValue?: any): any; - - /** - * True if the result of following a path of keys or indices through nested - * Iterables results in a set value. - */ - hasIn(searchKeyPath: Array): boolean; - hasIn(searchKeyPath: Iterable): boolean; - - - // Conversion to JavaScript types - - /** - * Deeply converts this Iterable to equivalent JS. - * - * `Iterable.Indexeds`, and `Iterable.Sets` become Arrays, while - * `Iterable.Keyeds` become Objects. - * - * @alias toJSON - */ - toJS(): any; - - /** - * Shallowly converts this iterable to an Array, discarding keys. - */ - toArray(): Array; - - /** - * Shallowly converts this Iterable to an Object. - * - * Throws if keys are not strings. - */ - toObject(): { [key: string]: V }; - - - // Conversion to Collections - - /** - * Converts this Iterable to a Map, Throws if keys are not hashable. - * - * Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided - * for convenience and to allow for chained expressions. - */ - toMap(): Map; - - /** - * Converts this Iterable to a Map, maintaining the order of iteration. - * - * Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but - * provided for convenience and to allow for chained expressions. - */ - toOrderedMap(): OrderedMap; - - /** - * Converts this Iterable to a Set, discarding keys. Throws if values - * are not hashable. - * - * Note: This is equivalent to `Set(this)`, but provided to allow for - * chained expressions. - */ - toSet(): Set; - - /** - * Converts this Iterable to a Set, maintaining the order of iteration and - * discarding keys. - * - * Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided - * for convenience and to allow for chained expressions. - */ - toOrderedSet(): OrderedSet; - - /** - * Converts this Iterable to a List, discarding keys. - * - * Note: This is equivalent to `List(this)`, but provided to allow - * for chained expressions. - */ - toList(): List; - - /** - * Converts this Iterable to a Stack, discarding keys. Throws if values - * are not hashable. - * - * Note: This is equivalent to `Stack(this)`, but provided to allow for - * chained expressions. - */ - toStack(): Stack; - - - // Conversion to Seq - - /** - * Converts this Iterable to a Seq of the same kind (indexed, - * keyed, or set). - */ - toSeq(): Seq; - - /** - * Returns a Seq.Keyed from this Iterable where indices are treated as keys. - * - * This is useful if you want to operate on an - * Iterable.Indexed and preserve the [index, value] pairs. - * - * The returned Seq will have identical iteration order as - * this Iterable. - * - * Example: - * - * var indexedSeq = Immutable.Seq.of('A', 'B', 'C'); - * indexedSeq.filter(v => v === 'B').toString() // Seq [ 'B' ] - * var keyedSeq = indexedSeq.toKeyedSeq(); - * keyedSeq.filter(v => v === 'B').toString() // Seq { 1: 'B' } - * - */ - toKeyedSeq(): Seq.Keyed; - - /** - * Returns an Seq.Indexed of the values of this Iterable, discarding keys. - */ - toIndexedSeq(): Seq.Indexed; - - /** - * Returns a Seq.Set of the values of this Iterable, discarding keys. - */ - toSetSeq(): Seq.Set; - - - // Iterators - - /** - * An iterator of this `Iterable`'s keys. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `keySeq` instead, if this is what you want. - */ - keys(): Iterator; - - /** - * An iterator of this `Iterable`'s values. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `valueSeq` instead, if this is what you want. - */ - values(): Iterator; - - /** - * An iterator of this `Iterable`'s entries as `[key, value]` tuples. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `entrySeq` instead, if this is what you want. - */ - entries(): Iterator<[K, V]>; - - - // Iterables (Seq) - - /** - * Returns a new Seq.Indexed of the keys of this Iterable, - * discarding values. - */ - keySeq(): Seq.Indexed; - - /** - * Returns an Seq.Indexed of the values of this Iterable, discarding keys. - */ - valueSeq(): Seq.Indexed; - - /** - * Returns a new Seq.Indexed of [key, value] tuples. - */ - entrySeq(): Seq.Indexed<[K, V]>; - - - // Sequence algorithms - - /** - * Returns a new Iterable of the same type with values passed through a - * `mapper` function. - * - * Seq({ a: 1, b: 2 }).map(x => 10 * x) - * // Seq { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Iterable; - - /** - * Returns a new Iterable of the same type with only the entries for which - * the `predicate` function returns true. - * - * Seq({a:1,b:2,c:3,d:4}).filter(x => x % 2 === 0) - * // Seq { b: 2, d: 4 } - * - */ - filter( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type with only the entries for which - * the `predicate` function returns false. - * - * Seq({a:1,b:2,c:3,d:4}).filterNot(x => x % 2 === 0) - * // Seq { a: 1, c: 3 } - * - */ - filterNot( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type in reverse order. - */ - reverse(): this; - - /** - * Returns a new Iterable of the same type which includes the same entries, - * stably sorted by using a `comparator`. - * - * If a `comparator` is not provided, a default comparator uses `<` and `>`. - * - * `comparator(valueA, valueB)`: - * - * * Returns `0` if the elements should not be swapped. - * * Returns `-1` (or any negative number) if `valueA` comes before `valueB` - * * Returns `1` (or any positive number) if `valueA` comes after `valueB` - * * Is pure, i.e. it must always return the same value for the same pair - * of values. - * - * When sorting collections which have no defined order, their ordered - * equivalents will be returned. e.g. `map.sort()` returns OrderedMap. - * - * ```js - * Seq({c: 3, a: 1, b: 2}).sort((a, b) => { - * if (a < b) { return -1; } - * if (a > b) { return 1; } - * if (a === b) { return 0; } - * }).toJS(); - * // { a: 1, b: 2, c: 3 } - * ``` - */ - sort(comparator?: (valueA: V, valueB: V) => number): this; - - /** - * Like `sort`, but also accepts a `comparatorValueMapper` which allows for - * sorting by more sophisticated means: - * - * hitters.sortBy(hitter => hitter.avgHits); - * - */ - sortBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): this; - - /** - * Returns a `Iterable.Keyed` of `Iterable.Keyeds`, grouped by the return - * value of the `grouper` function. - * - * Note: This is always an eager operation. - * - * Immutable.fromJS([{v: 0}, {v: 1}, {v: 1}, {v: 0}, {v: 1}]) - * .groupBy(x => x.get('v')) - * // Map {0: [{v: 0},{v: 0}], 1: [{v: 1},{v: 1},{v: 1}]} - */ - groupBy( - grouper: (value: V, key: K, iter: this) => G, - context?: any - ): /*Map*/Seq.Keyed>; - - - // Side effects - - /** - * The `sideEffect` is executed for every entry in the Iterable. - * - * Unlike `Array#forEach`, if any call of `sideEffect` returns - * `false`, the iteration will stop. Returns the number of entries iterated - * (including the last iteration which returned false). - */ - forEach( - sideEffect: (value: V, key: K, iter: this) => any, - context?: any - ): number; - - - // Creating subsets - - /** - * Returns a new Iterable of the same type representing a portion of this - * Iterable from start up to but not including end. - * - * If begin is negative, it is offset from the end of the Iterable. e.g. - * `slice(-2)` returns a Iterable of the last two entries. If it is not - * provided the new Iterable will begin at the beginning of this Iterable. - * - * If end is negative, it is offset from the end of the Iterable. e.g. - * `slice(0, -1)` returns an Iterable of everything but the last entry. If - * it is not provided, the new Iterable will continue through the end of - * this Iterable. - * - * If the requested slice is equivalent to the current Iterable, then it - * will return itself. - */ - slice(begin?: number, end?: number): this; - - /** - * Returns a new Iterable of the same type containing all entries except - * the first. - */ - rest(): this; - - /** - * Returns a new Iterable of the same type containing all entries except - * the last. - */ - butLast(): this; - - /** - * Returns a new Iterable of the same type which excludes the first `amount` - * entries from this Iterable. - */ - skip(amount: number): this; - - /** - * Returns a new Iterable of the same type which excludes the last `amount` - * entries from this Iterable. - */ - skipLast(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes entries starting - * from when `predicate` first returns false. - * - * Seq.of('dog','frog','cat','hat','god') - * .skipWhile(x => x.match(/g/)) - * // Seq [ 'cat', 'hat', 'god' ] - * - */ - skipWhile( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes entries starting - * from when `predicate` first returns true. - * - * Seq.of('dog','frog','cat','hat','god') - * .skipUntil(x => x.match(/hat/)) - * // Seq [ 'hat', 'god' ] - * - */ - skipUntil( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes the first `amount` - * entries from this Iterable. - */ - take(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes the last `amount` - * entries from this Iterable. - */ - takeLast(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes entries from this - * Iterable as long as the `predicate` returns true. - * - * Seq.of('dog','frog','cat','hat','god') - * .takeWhile(x => x.match(/o/)) - * // Seq [ 'dog', 'frog' ] - * - */ - takeWhile( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes entries from this - * Iterable as long as the `predicate` returns false. - * - * Seq.of('dog','frog','cat','hat','god').takeUntil(x => x.match(/at/)) - * // ['dog', 'frog'] - * - */ - takeUntil( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - - // Combination - - /** - * Returns a new Iterable of the same type with other values and - * iterable-like concatenated to this one. - * - * For Seqs, all entries will be present in - * the resulting iterable, even if they have the same key. - */ - concat(...valuesOrIterables: any[]): Iterable; - - /** - * Flattens nested Iterables. - * - * Will deeply flatten the Iterable by default, returning an Iterable of the - * same type, but a `depth` can be provided in the form of a number or - * boolean (where true means to shallowly flatten one level). A depth of 0 - * (or shallow: false) will deeply flatten. - * - * Flattens only others Iterable, not Arrays or Objects. - * - * Note: `flatten(true)` operates on Iterable> and - * returns Iterable - */ - flatten(depth?: number): Iterable; - flatten(shallow?: boolean): Iterable; - - /** - * Flat-maps the Iterable, returning an Iterable of the same type. - * - * Similar to `iter.map(...).flatten(true)`. - */ - flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable, - context?: any - ): Iterable; - - // Reducing a value - - /** - * Reduces the Iterable to a value by calling the `reducer` for every entry - * in the Iterable and passing along the reduced value. - * - * If `initialReduction` is not provided, the first item in the - * Iterable will be used. - * - * @see `Array#reduce`. - */ - reduce( - reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: any - ): R; - - /** - * Reduces the Iterable in reverse (from the right side). - * - * Note: Similar to this.reverse().reduce(), and provided for parity - * with `Array#reduceRight`. - */ - reduceRight( - reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: any - ): R; - - /** - * True if `predicate` returns true for all entries in the Iterable. - */ - every( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): boolean; - - /** - * True if `predicate` returns true for any entry in the Iterable. - */ - some( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): boolean; - - /** - * Joins values together as a string, inserting a separator between each. - * The default separator is `","`. - */ - join(separator?: string): string; - - /** - * Returns true if this Iterable includes no values. - * - * For some lazy `Seq`, `isEmpty` might need to iterate to determine - * emptiness. At most one iteration will occur. - */ - isEmpty(): boolean; - - /** - * Returns the size of this Iterable. - * - * Regardless of if this Iterable can describe its size lazily (some Seqs - * cannot), this method will always return the correct size. E.g. it - * evaluates a lazy `Seq` if necessary. - * - * If `predicate` is provided, then this returns the count of entries in the - * Iterable for which the `predicate` returns true. - */ - count(): number; - count( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): number; - - /** - * Returns a `Seq.Keyed` of counts, grouped by the return value of - * the `grouper` function. - * - * Note: This is not a lazy operation. - */ - countBy( - grouper: (value: V, key: K, iter: this) => G, - context?: any - ): Map; - - - // Search for value - - /** - * Returns the first value for which the `predicate` returns true. - */ - find( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): V | undefined; - - /** - * Returns the last value for which the `predicate` returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLast( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): V | undefined; - - /** - * Returns the first [key, value] entry for which the `predicate` returns true. - */ - findEntry( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): [K, V] | undefined; - - /** - * Returns the last [key, value] entry for which the `predicate` - * returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLastEntry( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): [K, V] | undefined; - - /** - * Returns the key for which the `predicate` returns true. - */ - findKey( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): K | undefined; - - /** - * Returns the last key for which the `predicate` returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLastKey( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): K | undefined; - - /** - * Returns the key associated with the search value, or undefined. - */ - keyOf(searchValue: V): K | undefined; - - /** - * Returns the last key associated with the search value, or undefined. - */ - lastKeyOf(searchValue: V): K | undefined; - - /** - * Returns the maximum value in this collection. If any values are - * comparatively equivalent, the first one found will be returned. - * - * The `comparator` is used in the same way as `Iterable#sort`. If it is not - * provided, the default comparator is `>`. - * - * When two values are considered equivalent, the first encountered will be - * returned. Otherwise, `max` will operate independent of the order of input - * as long as the comparator is commutative. The default comparator `>` is - * commutative *only* when types do not differ. - * - * If `comparator` returns 0 and either value is NaN, undefined, or null, - * that value will be returned. - */ - max(comparator?: (valueA: V, valueB: V) => number): V | undefined; - - /** - * Like `max`, but also accepts a `comparatorValueMapper` which allows for - * comparing by more sophisticated means: - * - * hitters.maxBy(hitter => hitter.avgHits); - * - */ - maxBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): V | undefined; - - /** - * Returns the minimum value in this collection. If any values are - * comparatively equivalent, the first one found will be returned. - * - * The `comparator` is used in the same way as `Iterable#sort`. If it is not - * provided, the default comparator is `<`. - * - * When two values are considered equivalent, the first encountered will be - * returned. Otherwise, `min` will operate independent of the order of input - * as long as the comparator is commutative. The default comparator `<` is - * commutative *only* when types do not differ. - * - * If `comparator` returns 0 and either value is NaN, undefined, or null, - * that value will be returned. - */ - min(comparator?: (valueA: V, valueB: V) => number): V | undefined; - - /** - * Like `min`, but also accepts a `comparatorValueMapper` which allows for - * comparing by more sophisticated means: - * - * hitters.minBy(hitter => hitter.avgHits); - * - */ - minBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): V | undefined; - - - // Comparison - - /** - * True if `iter` includes every value in this Iterable. - */ - isSubset(iter: Iterable): boolean; - isSubset(iter: Array): boolean; - - /** - * True if this Iterable includes every value in `iter`. - */ - isSuperset(iter: Iterable): boolean; - isSuperset(iter: Array): boolean; - - - /** - * Note: this is here as a convenience to work around an issue with - * TypeScript https://github.com/Microsoft/TypeScript/issues/285, but - * Iterable does not define `size`, instead `Seq` defines `size` as - * nullable number, and `Collection` defines `size` as always a number. - * - * @ignore - */ - size: number; - } - - - /** - * Collection is the abstract base class for concrete data structures. It - * cannot be constructed directly. - * - * Implementations should extend one of the subclasses, `Collection.Keyed`, - * `Collection.Indexed`, or `Collection.Set`. - */ - export module Collection { - - - /** - * `Collection` which represents key-value pairs. - */ - export module Keyed {} - - export interface Keyed extends Collection, Iterable.Keyed { - - /** - * Returns Seq.Keyed. - * @override - */ - toSeq(): Seq.Keyed; - - // Sequence algorithms - - /** - * Returns a new Collection.Keyed with values passed through a - * `mapper` function. - * - * Collection.Keyed({a: 1, b: 2}).map(x => 10 * x) - * // Collection.Keyed {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Collection.Keyed; - } - - - /** - * `Collection` which represents ordered indexed values. - */ - export module Indexed {} - - export interface Indexed extends Collection, Iterable.Indexed { - - /** - * Returns Seq.Indexed. - * @override - */ - toSeq(): Seq.Indexed; - - // Sequence algorithms - - /** - * Returns a new Collection.Indexed with values passed through a - * `mapper` function. - * - * Collection.Indexed([1,2]).map(x => 10 * x) - * // Collection.Indexed [1,2] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Collection.Indexed; - } - - - /** - * `Collection` which represents values, unassociated with keys or indices. - * - * `Collection.Set` implementations should guarantee value uniqueness. - */ - export module Set {} - - export interface Set extends Collection, Iterable.Set { - - /** - * Returns Seq.Set. - * @override - */ - toSeq(): Seq.Set; - - // Sequence algorithms - - /** - * Returns a new Collection.Set with values passed through a - * `mapper` function. - * - * Collection.Set([1,2]).map(x => 10 * x) - * // Collection.Set [1,2] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Collection.Set; - } - - } - - export interface Collection extends Iterable { - - /** - * All collections maintain their current `size` as an integer. - */ - size: number; - } - - - /** - * ES6 Iterator. - * - * This is not part of the Immutable library, but a common interface used by - * many types in ES6 JavaScript. - * - * @ignore - */ - interface ESIterable { - [Symbol.iterator](): Iterator; - } - - diff --git a/dist/immutable.d.ts b/dist/immutable.d.ts deleted file mode 100644 index 29d48af16d..0000000000 --- a/dist/immutable.d.ts +++ /dev/null @@ -1,3086 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -/** - * Immutable data encourages pure functions (data-in, data-out) and lends itself - * to much simpler application development and enabling techniques from - * functional programming such as lazy evaluation. - * - * While designed to bring these powerful functional concepts to JavaScript, it - * presents an Object-Oriented API familiar to Javascript engineers and closely - * mirroring that of Array, Map, and Set. It is easy and efficient to convert to - * and from plain Javascript types. - * - * Note: all examples are presented in [ES6][]. To run in all browsers, they - * need to be translated to ES3. For example: - * - * // ES6 - * foo.map(x => x * x); - * // ES3 - * foo.map(function (x) { return x * x; }); - * - * [ES6]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla - */ - -declare module Immutable { - - /** - * Deeply converts plain JS objects and arrays to Immutable Maps and Lists. - * - * If a `reviver` is optionally provided, it will be called with every - * collection as a Seq (beginning with the most nested collections - * and proceeding to the top-level collection itself), along with the key - * refering to each collection and the parent JS object provided as `this`. - * For the top level, object, the key will be `""`. This `reviver` is expected - * to return a new Immutable Iterable, allowing for custom conversions from - * deep JS objects. - * - * This example converts JSON to List and OrderedMap: - * - * Immutable.fromJS({a: {b: [10, 20, 30]}, c: 40}, function (key, value) { - * var isIndexed = Immutable.Iterable.isIndexed(value); - * return isIndexed ? value.toList() : value.toOrderedMap(); - * }); - * - * // true, "b", {b: [10, 20, 30]} - * // false, "a", {a: {b: [10, 20, 30]}, c: 40} - * // false, "", {"": {a: {b: [10, 20, 30]}, c: 40}} - * - * If `reviver` is not provided, the default behavior will convert Arrays into - * Lists and Objects into Maps. - * - * `reviver` acts similarly to the [same parameter in `JSON.parse`][1]. - * - * `Immutable.fromJS` is conservative in its conversion. It will only convert - * arrays which pass `Array.isArray` to Lists, and only raw objects (no custom - * prototype) to Map. - * - * Keep in mind, when using JS objects to construct Immutable Maps, that - * JavaScript Object properties are always strings, even if written in a - * quote-less shorthand, while Immutable Maps accept keys of any type. - * - * ```js - * var obj = { 1: "one" }; - * Object.keys(obj); // [ "1" ] - * obj["1"]; // "one" - * obj[1]; // "one" - * - * var map = Map(obj); - * map.get("1"); // "one" - * map.get(1); // undefined - * ``` - * - * Property access for JavaScript Objects first converts the key to a string, - * but since Immutable Map keys can be of any type the argument to `get()` is - * not altered. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter - * "Using the reviver parameter" - */ - export function fromJS( - json: any, - reviver?: (k: any, v: Iterable) => any - ): any; - - - /** - * Value equality check with semantics similar to `Object.is`, but treats - * Immutable `Iterable`s as values, equal if the second `Iterable` includes - * equivalent values. - * - * It's used throughout Immutable when checking for equality, including `Map` - * key equality and `Set` membership. - * - * var map1 = Immutable.Map({a:1, b:1, c:1}); - * var map2 = Immutable.Map({a:1, b:1, c:1}); - * assert(map1 !== map2); - * assert(Object.is(map1, map2) === false); - * assert(Immutable.is(map1, map2) === true); - * - * Note: Unlike `Object.is`, `Immutable.is` assumes `0` and `-0` are the same - * value, matching the behavior of ES6 Map key equality. - */ - export function is(first: any, second: any): boolean; - - - /** - * The `hash()` function is an important part of how Immutable determines if - * two values are equivalent and is used to determine how to store those - * values. Provided with any value, `hash()` will return a 31-bit integer. - * - * When designing Objects which may be equal, it's important than when a - * `.equals()` method returns true, that both values `.hashCode()` method - * return the same value. `hash()` may be used to produce those values. - * - * Note that `hash()` attempts to balance between speed and avoiding - * collisions, however it makes no attempt to produce secure hashes. - */ - export function hash(value: any): number; - - - /** - * Lists are ordered indexed dense collections, much like a JavaScript - * Array. - * - * Lists are immutable and fully persistent with O(log32 N) gets and sets, - * and O(1) push and pop. - * - * Lists implement Deque, with efficient addition and removal from both the - * end (`push`, `pop`) and beginning (`unshift`, `shift`). - * - * Unlike a JavaScript Array, there is no distinction between an - * "unset" index and an index set to `undefined`. `List#forEach` visits all - * indices from 0 to size, regardless of whether they were explicitly defined. - */ - export module List { - - /** - * True if the provided value is a List - * - * ```js - * List.isList([]); // false - * List.isList(List([])); // true - * ``` - */ - function isList(maybeList: any): maybeList is List; - - /** - * Creates a new List containing `values`. - * - * ```js - * List.of(1, 2, 3, 4).toJS(); - * // [ 1, 2, 3, 4 ] - * - * List.of({x:1}, 2, [3], 4).toJS(); - * // [ { x: 1 }, 2, [ 3 ], 4 ] - * ``` - */ - function of(...values: T[]): List; - } - - /** - * Create a new immutable List containing the values of the provided - * iterable-like. - * - * ```js - * List().toJS(); // [] - * - * const plainArray = [1, 2, 3, 4]; - * const listFromPlainArray = List(plainArray); - * - * const plainSet = new Set([1, 2, 3, 4]); - * const listFromPlainSet = List(plainSet); - * - * const iterableArray = plainArray[Symbol.iterator](); - * const listFromIterableArray = List(iterableArray); - * - * listFromPlainArray.toJS(); // [ 1, 2, 3, 4 ] - * listFromPlainSet.toJS(); // [ 1, 2, 3, 4 ] - * listFromIterableArray.toJS(); // [ 1, 2, 3, 4 ] - * - * Immutable.is(listFromPlainArray, listFromIterableSet); // true - * Immutable.is(listFromPlainSet, listFromIterableSet) // true - * Immutable.is(listFromPlainSet, listFromPlainArray) // true - * ``` - */ - export function List(): List; - export function List(): List; - export function List(iterable: ESIterable): List; - - export interface List extends Collection.Indexed { - - // Persistent changes - - /** - * Returns a new List which includes `value` at `index`. If `index` already - * exists in this List, it will be replaced. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.set(-1, "value")` sets the last item in the List. - * - * If `index` larger than `size`, the returned List's `size` will be large - * enough to include the `index`. - * - * ```js - * const originalList = List([0]); - * originalList.set(1, 1).toJS(); // [ 0, 1 ] - * originalList.set(0, 'overwritten').toJS(); // [ 'overwritten' ] - * - * List().set(50000, 'value').size; - * //50001 - * ``` - */ - set(index: number, value: T): List; - - /** - * Returns a new List which excludes this `index` and with a size 1 less - * than this List. Values at indices above `index` are shifted down by 1 to - * fill the position. - * - * This is synonymous with `list.splice(index, 1)`. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.delete(-1)` deletes the last item in the List. - * - * Note: `delete` cannot be safely used in IE8 - * - * ```js - * List([0, 1, 2, 3, 4]).delete(0).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - * - * @alias remove - */ - delete(index: number): List; - remove(index: number): List; - - /** - * Returns a new List with `value` at `index` with a size 1 more than this - * List. Values at indices above `index` are shifted over by 1. - * - * This is synonymous with `list.splice(index, 0, value)`. - * - * ```js - * List([0, 1, 2, 3, 4]).insert(6, 5).toJS(); - * // [ 0, 1, 2, 3, 4, 5 ] - * ``` - */ - insert(index: number, value: T): List; - - /** - * Returns a new List with 0 size and no values. - * - * ```js - * List([1, 2, 3, 4]).clear().toJS(); - * // [] - * ``` - */ - clear(): List; - - /** - * Returns a new List with the provided `values` appended, starting at this - * List's `size`. - * - * ```js - * List([1, 2, 3, 4]).push(5).toJS(); - * // [ 1, 2, 3, 4, 5 ] - * ``` - */ - push(...values: T[]): List; - - /** - * Returns a new List with a size ones less than this List, excluding - * the last index in this List. - * - * Note: this differs from `Array#pop` because it returns a new - * List rather than the removed value. Use `last()` to get the last value - * in this List. - * ```js - * List([1, 2, 3, 4]).pop().toJS(); - * // [ 1, 2, 3 ] - * ``` - */ - pop(): List; - - /** - * Returns a new List with the provided `values` prepended, shifting other - * values ahead to higher indices. - * - * ```js - * List([ 2, 3, 4]).unshift(1).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - */ - unshift(...values: T[]): List; - - /** - * Returns a new List with a size ones less than this List, excluding - * the first index in this List, shifting all other values to a lower index. - * - * Note: this differs from `Array#shift` because it returns a new - * List rather than the removed value. Use `first()` to get the first - * value in this List. - * - * ```js - * List([ 0, 1, 2, 3, 4]).shift(0).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - */ - shift(): List; - - /** - * Returns a new List with an updated value at `index` with the return - * value of calling `updater` with the existing value, or `notSetValue` if - * `index` was not set. If called with a single argument, `updater` is - * called with the List itself. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.update(-1)` updates the last item in the List. - * - * @see `Map#update` - */ - update(updater: (value: List) => List): List; - update(index: number, updater: (value: T) => T): List; - update(index: number, notSetValue: T, updater: (value: T) => T): List; - - /** - * @see `Map#merge` - */ - merge(...iterables: Iterable.Indexed[]): List; - merge(...iterables: Array[]): List; - - /** - * @see `Map#mergeWith` - */ - mergeWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Iterable.Indexed[] - ): List; - mergeWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Array[] - ): List; - - /** - * @see `Map#mergeDeep` - */ - mergeDeep(...iterables: Iterable.Indexed[]): List; - mergeDeep(...iterables: Array[]): List; - - /** - * @see `Map#mergeDeepWith` - */ - mergeDeepWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Iterable.Indexed[] - ): List; - mergeDeepWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Array[] - ): List; - - /** - * Returns a new List with size `size`. If `size` is less than this - * List's size, the new List will exclude values at the higher indices. - * If `size` is greater than this List's size, the new List will have - * undefined values for the newly available indices. - * - * When building a new List and the final size is known up front, `setSize` - * used in conjunction with `withMutations` may result in the more - * performant construction. - */ - setSize(size: number): List; - - - // Deep persistent changes - - /** - * Returns a new List having set `value` at this `keyPath`. If any keys in - * `keyPath` do not exist, a new immutable Map will be created at that key. - * - * Index numbers are used as keys to determine the path to follow in - * the List. - * - * ```js - * Immutable.fromJS([0, 1, 2, [3, 4]]).setIn([3, 0], -3).toJS(); - * // [ 0, 1, 2, [ -3, 4 ] ] - * ``` - */ - setIn(keyPath: Array, value: any): List; - setIn(keyPath: Iterable, value: any): List; - - /** - * Returns a new List having removed the value at this `keyPath`. If any - * keys in `keyPath` do not exist, no change will occur. - * - * ```js - * Immutable.fromJS([0, 1, 2, [3, 4]]).deleteIn([3, 1]).toJS(); - * // [ 0, 1, 2, [ 3 ] ] - * ``` - * @alias removeIn - */ - deleteIn(keyPath: Array): List; - deleteIn(keyPath: Iterable): List; - removeIn(keyPath: Array): List; - removeIn(keyPath: Iterable): List; - - /** - * @see `Map#updateIn` - */ - updateIn( - keyPath: Array, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Array, - notSetValue: any, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Iterable, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Iterable, - notSetValue: any, - updater: (value: any) => any - ): List; - - /** - * @see `Map#mergeIn` - */ - mergeIn(keyPath: Array | Iterable, ...iterables: Array): List; - - /** - * @see `Map#mergeDeepIn` - */ - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): List; - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set`, `push`, `pop`, `shift`, `unshift` and - * `merge` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: List) => any): List; - - /** - * @see `Map#asMutable` - */ - asMutable(): List; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): List; - - // Sequence algorithms - - /** - * Returns a new List with values passed through a - * `mapper` function. - * - * List([1,2]).map(x => 10 * x) - * // List [ 10, 20 ] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): List; - } - - - /** - * Immutable Map is an unordered Iterable.Keyed of (key, value) pairs with - * `O(log32 N)` gets and `O(log32 N)` persistent sets. - * - * Iteration order of a Map is undefined, however is stable. Multiple - * iterations of the same Map will iterate in the same order. - * - * Map's keys can be of any type, and use `Immutable.is` to determine key - * equality. This allows the use of any value (including NaN) as a key. - * - * Because `Immutable.is` returns equality based on value semantics, and - * Immutable collections are treated as values, any Immutable collection may - * be used as a key. - * - * Map().set(List.of(1), 'listofone').get(List.of(1)); - * // 'listofone' - * - * Any JavaScript object may be used as a key, however strict identity is used - * to evaluate key equality. Two similar looking objects will represent two - * different keys. - * - * Implemented by a hash-array mapped trie. - */ - export module Map { - - /** - * True if the provided value is a Map - * - * ```js - * Map.isMap({}); // false - * Map.isMap(Immutable.Map()); // true - * ``` - */ - function isMap(maybeMap: any): maybeMap is Map; - - /** - * Creates a new Map from alternating keys and values - * - * ```js - * Map.of( - * 'key', 'value', - * 'numerical value', 3, - * 0, 'numerical key' - * ).toJS(); - * // { '0': 'numerical key', key: 'value', 'numerical value': 3 } - * ``` - * - * @deprecated Use Map([ [ 'k', 'v' ] ]) or Map({ k: 'v' }) - */ - function of(...keyValues: any[]): Map; - } - - /** - * Creates a new Immutable Map. - * - * Created with the same key value pairs as the provided Iterable.Keyed or - * JavaScript Object or expects an Iterable of [K, V] tuple entries. - * - * var newMap = Map({key: "value"}); - * var newMap = Map([["key", "value"]]); - * - * Keep in mind, when using JS objects to construct Immutable Maps, that - * JavaScript Object properties are always strings, even if written in a - * quote-less shorthand, while Immutable Maps accept keys of any type. - * - * ```js - * var obj = { 1: "one" }; - * Object.keys(obj); // [ "1" ] - * obj["1"]; // "one" - * obj[1]; // "one" - * - * var map = Map(obj); - * map.get("1"); // "one" - * map.get(1); // undefined - * ``` - * - * Property access for JavaScript Objects first converts the key to a string, - * but since Immutable Map keys can be of any type the argument to `get()` is - * not altered. - */ - export function Map(): Map; - export function Map(): Map; - export function Map(iterable: ESIterable<[K, V]>): Map; - export function Map(iterable: ESIterable>): Map; - export function Map(obj: {[key: string]: V}): Map; - - export interface Map extends Collection.Keyed { - - // Persistent changes - - /** - * Returns a new Map also containing the new key, value pair. If an equivalent - * key already exists in this Map, it will be replaced. - * - * ```js - * const originalMap = Immutable.Map(); - * const newerMap = originalMap.set('key', 'value'); - * const newestMap = newerMap.set('key', 'newer value'); - * originalMap.toJS(); // {} - * newerMap.toJS(); // { key: 'value' } - * newestMap.toJS(); // { key: 'newer value' } - * ``` - */ - set(key: K, value: V): Map; - - /** - * Returns a new Map which excludes this `key`. - * - * Note: `delete` cannot be safely used in IE8, but is provided to mirror - * the ES6 collection API. - * - * ```js - * Immutable.Map({ - * key: 'value', - * otherKey: 'other value' - * }).delete('otherKey').toJS(); - * // { key: 'value' } - * ``` - * - * @alias remove - */ - delete(key: K): Map; - remove(key: K): Map; - - /** - * Returns a new Map which excludes the provided `keys`. - * - * var names = Immutable.Map({ a: "Aaron", b: "Barry", c: "Connor" }); - * names.deleteAll(['a', 'c']); // { b: "Barry" } - * - * @alias removeAll - */ - deleteAll(keys: Array | ESIterable): Map; - removeAll(keys: Array | ESIterable): Map; - - /** - * Returns a new Map containing no keys or values. - * - * ```js - * Immutable.Map({ key: 'value' }).clear().toJS(); - * // {} - * ``` - */ - clear(): Map; - - /** - * Returns a new Map having updated the value at this `key` with the return - * value of calling `updater` with the existing value, or `notSetValue` if - * the key was not set. If called with only a single argument, `updater` is - * called with the Map itself. - * - * Equivalent to: `map.set(key, updater(map.get(key)))`. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * const newMap = originalMap.update('key', value => { - * return value + value; - * }); - * newMap.toJS(); // { key: 'valuevalue' } - * - * When a `notSetValue` is provided, it is provided to the `updater` - * function when the value at the key does not exist in the Map. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * let newMap = originalMap.update('noKey', 'no value', value => { - * return value + value; - * }); - * newMap.toJS(); // { key: 'value', noKey: 'no valueno value' } - * - * However, if the `updater` function returns the same value it was called - * with, then no change will occur. This is still true if `notSetValue` - * is provided. - * - * var data1 = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data2 = data1.update('key', 100, val => val); - * assert(data2 === data1); - * - * If no key is provided, then the `updater` function return value is - * returned as well. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * const result = originalMap.update(map => { - * return map.get('key'); - * }); - * result; // 'value' - * - */ - update(key: K, updater: (value: V) => V): Map; - update(key: K, notSetValue: V, updater: (value: V) => V): Map; - update(updater: (value: Map) => R): R; - - /** - * Returns a new Map resulting from merging the provided Iterables - * (or JS objects) into this Map. In other words, this takes each entry of - * each iterable and sets it on this Map. - * - * If any of the values provided to `merge` are not Iterable (would return - * false for `Immutable.Iterable.isIterable`) then they are deeply converted - * via `Immutable.fromJS` before being merged. However, if the value is an - * Iterable but includes non-iterable JS objects or arrays, those nested - * values will be preserved. - * - * var x = Immutable.Map({a: 10, b: 20, c: 30}); - * var y = Immutable.Map({b: 40, a: 50, d: 60}); - * x.merge(y) // { a: 50, b: 40, c: 30, d: 60 } - * y.merge(x) // { b: 20, a: 10, d: 60, c: 30 } - * - */ - merge(...iterables: Iterable[]): Map; - merge(...iterables: {[key: string]: V}[]): Map; - - /** - * Like `merge()`, `mergeWith()` returns a new Map resulting from merging - * the provided Iterables (or JS objects) into this Map, but uses the - * `merger` function for dealing with conflicts. - * - * var x = Immutable.Map({a: 10, b: 20, c: 30}); - * var y = Immutable.Map({b: 40, a: 50, d: 60}); - * x.mergeWith((prev, next) => prev / next, y) // { a: 0.2, b: 0.5, c: 30, d: 60 } - * y.mergeWith((prev, next) => prev / next, x) // { b: 2, a: 5, d: 60, c: 30 } - * - */ - mergeWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: Iterable[] - ): Map; - mergeWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: {[key: string]: V}[] - ): Map; - - /** - * Like `merge()`, but when two Iterables conflict, it merges them as well, - * recursing deeply through the nested data. - * - * var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } }); - * var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } }); - * x.mergeDeep(y) // {a: { x: 2, y: 10 }, b: { x: 20, y: 5 }, c: { z: 3 } } - * - */ - mergeDeep(...iterables: Iterable[]): Map; - mergeDeep(...iterables: {[key: string]: V}[]): Map; - - /** - * Like `mergeDeep()`, but when two non-Iterables conflict, it uses the - * `merger` function to determine the resulting value. - * - * var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } }); - * var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } }); - * x.mergeDeepWith((prev, next) => prev / next, y) - * // {a: { x: 5, y: 10 }, b: { x: 20, y: 10 }, c: { z: 3 } } - * - */ - mergeDeepWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: Iterable[] - ): Map; - mergeDeepWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: {[key: string]: V}[] - ): Map; - - - // Deep persistent changes - - /** - * Returns a new Map having set `value` at this `keyPath`. If any keys in - * `keyPath` do not exist, a new immutable Map will be created at that key. - * - * ```js - * const originalMap = Immutable.fromJS({ - * subObject: { - * subKey: 'subvalue', - * subSubObject: { - * subSubKey: 'subSubValue' - * } - * } - * }); - - * const newMap = originalMap.setIn(['subObject', 'subKey'], 'ha ha!'); - * newMap.toJS(); - * // {subObject:{subKey:'ha ha!', subSubObject:{subSubKey:'subSubValue'}}} - * - * const newerMap = originalMap.setIn( - * ['subObject', 'subSubObject', 'subSubKey'], - * 'ha ha ha!' - * ); - * newerMap.toJS(); - * // {subObject:{subKey:'subvalue', subSubObject:{subSubKey:'ha ha ha!'}}} - * ``` - */ - setIn(keyPath: Array, value: any): Map; - setIn(KeyPath: Iterable, value: any): Map; - - /** - * Returns a new Map having removed the value at this `keyPath`. If any keys - * in `keyPath` do not exist, no change will occur. - * - * @alias removeIn - */ - deleteIn(keyPath: Array): Map; - deleteIn(keyPath: Iterable): Map; - removeIn(keyPath: Array): Map; - removeIn(keyPath: Iterable): Map; - - /** - * Returns a new Map having applied the `updater` to the entry found at the - * keyPath. - * - * If any keys in `keyPath` do not exist, new Immutable `Map`s will - * be created at those keys. If the `keyPath` does not already contain a - * value, the `updater` function will be called with `notSetValue`, if - * provided, otherwise `undefined`. - * - * var data = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data = data.updateIn(['a', 'b', 'c'], val => val * 2); - * // { a: { b: { c: 20 } } } - * - * If the `updater` function returns the same value it was called with, then - * no change will occur. This is still true if `notSetValue` is provided. - * - * var data1 = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data2 = data1.updateIn(['x', 'y', 'z'], 100, val => val); - * assert(data2 === data1); - * - */ - updateIn( - keyPath: Array, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Array, - notSetValue: any, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Iterable, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Iterable, - notSetValue: any, - updater: (value: any) => any - ): Map; - - /** - * A combination of `updateIn` and `merge`, returning a new Map, but - * performing the merge at a point arrived at by following the keyPath. - * In other words, these two lines are equivalent: - * - * x.updateIn(['a', 'b', 'c'], abc => abc.merge(y)); - * x.mergeIn(['a', 'b', 'c'], y); - * - */ - mergeIn(keyPath: Array | Iterable, ...iterables: Array): Map; - - /** - * A combination of `updateIn` and `mergeDeep`, returning a new Map, but - * performing the deep merge at a point arrived at by following the keyPath. - * In other words, these two lines are equivalent: - * - * x.updateIn(['a', 'b', 'c'], abc => abc.mergeDeep(y)); - * x.mergeDeepIn(['a', 'b', 'c'], y); - * - */ - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): Map; - - // Transient changes - - /** - * Every time you call one of the above functions, a new immutable Map is - * created. If a pure function calls a number of these to produce a final - * return value, then a penalty on performance and memory has been paid by - * creating all of the intermediate immutable Maps. - * - * If you need to apply a series of mutations to produce a new immutable - * Map, `withMutations()` creates a temporary mutable copy of the Map which - * can apply mutations in a highly performant manner. In fact, this is - * exactly how complex mutations like `merge` are done. - * - * As an example, this results in the creation of 2, not 4, new Maps: - * - * var map1 = Immutable.Map(); - * var map2 = map1.withMutations(map => { - * map.set('a', 1).set('b', 2).set('c', 3); - * }); - * assert(map1.size === 0); - * assert(map2.size === 3); - * - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` and `merge` may be used mutatively. - * - */ - withMutations(mutator: (mutable: Map) => any): Map; - - /** - * Another way to avoid creation of intermediate Immutable maps is to create - * a mutable copy of this collection. Mutable copies *always* return `this`, - * and thus shouldn't be used for equality. Your function should never return - * a mutable copy of a collection, only use it internally to create a new - * collection. If possible, use `withMutations` as it provides an easier to - * use API. - * - * Note: if the collection is already mutable, `asMutable` returns itself. - * - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` and `merge` may be used mutatively. - */ - asMutable(): Map; - - /** - * The yin to `asMutable`'s yang. Because it applies to mutable collections, - * this operation is *mutable* and returns itself. Once performed, the mutable - * copy has become immutable and can be safely returned from a function. - */ - asImmutable(): Map; - - // Sequence algorithms - - /** - * Returns a new Map with values passed through a - * `mapper` function. - * - * Map({ a: 1, b: 2 }).map(x => 10 * x) - * // Map { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Map; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Map; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Map; - } - - - /** - * A type of Map that has the additional guarantee that the iteration order of - * entries will be the order in which they were set(). - * - * The iteration behavior of OrderedMap is the same as native ES6 Map and - * JavaScript Object. - * - * Note that `OrderedMap` are more expensive than non-ordered `Map` and may - * consume more memory. `OrderedMap#set` is amortized O(log32 N), but not - * stable. - */ - - export module OrderedMap { - - /** - * True if the provided value is an OrderedMap. - */ - function isOrderedMap(maybeOrderedMap: any): maybeOrderedMap is OrderedMap; - } - - /** - * Creates a new Immutable OrderedMap. - * - * Created with the same key value pairs as the provided Iterable.Keyed or - * JavaScript Object or expects an Iterable of [K, V] tuple entries. - * - * The iteration order of key-value pairs provided to this constructor will - * be preserved in the OrderedMap. - * - * var newOrderedMap = OrderedMap({key: "value"}); - * var newOrderedMap = OrderedMap([["key", "value"]]); - * - */ - export function OrderedMap(): OrderedMap; - export function OrderedMap(): OrderedMap; - export function OrderedMap(iterable: ESIterable<[K, V]>): OrderedMap; - export function OrderedMap(iterable: ESIterable>): OrderedMap; - export function OrderedMap(obj: {[key: string]: V}): OrderedMap; - - export interface OrderedMap extends Map { - - // Sequence algorithms - - /** - * Returns a new OrderedMap with values passed through a - * `mapper` function. - * - * OrderedMap({ a: 1, b: 2 }).map(x => 10 * x) - * // OrderedMap { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): OrderedMap; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): OrderedMap; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): OrderedMap; - } - - - /** - * A Collection of unique values with `O(log32 N)` adds and has. - * - * When iterating a Set, the entries will be (value, value) pairs. Iteration - * order of a Set is undefined, however is stable. Multiple iterations of the - * same Set will iterate in the same order. - * - * Set values, like Map keys, may be of any type. Equality is determined using - * `Immutable.is`, enabling Sets to uniquely include other Immutable - * collections, custom value types, and NaN. - */ - export module Set { - - /** - * True if the provided value is a Set - */ - function isSet(maybeSet: any): maybeSet is Set; - - /** - * Creates a new Set containing `values`. - */ - function of(...values: T[]): Set; - - /** - * `Set.fromKeys()` creates a new immutable Set containing the keys from - * this Iterable or JavaScript Object. - */ - function fromKeys(iter: Iterable): Set; - function fromKeys(obj: {[key: string]: any}): Set; - } - - /** - * Create a new immutable Set containing the values of the provided - * iterable-like. - */ - export function Set(): Set; - export function Set(): Set; - export function Set(iterable: ESIterable): Set; - - export interface Set extends Collection.Set { - - // Persistent changes - - /** - * Returns a new Set which also includes this value. - */ - add(value: T): Set; - - /** - * Returns a new Set which excludes this value. - * - * Note: `delete` cannot be safely used in IE8 - * @alias remove - */ - delete(value: T): Set; - remove(value: T): Set; - - /** - * Returns a new Set containing no values. - */ - clear(): Set; - - /** - * Returns a Set including any value from `iterables` that does not already - * exist in this Set. - * @alias merge - */ - union(...iterables: Iterable[]): Set; - union(...iterables: Array[]): Set; - merge(...iterables: Iterable[]): Set; - merge(...iterables: Array[]): Set; - - - /** - * Returns a Set which has removed any values not also contained - * within `iterables`. - */ - intersect(...iterables: Iterable[]): Set; - intersect(...iterables: Array[]): Set; - - /** - * Returns a Set excluding any values contained within `iterables`. - */ - subtract(...iterables: Iterable[]): Set; - subtract(...iterables: Array[]): Set; - - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `add` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: Set) => any): Set; - - /** - * @see `Map#asMutable` - */ - asMutable(): Set; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): Set; - - // Sequence algorithms - - /** - * Returns a new Set with values passed through a - * `mapper` function. - * - * Set([1,2]).map(x => 10 * x) - * // Set [10,20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Set; - } - - - /** - * A type of Set that has the additional guarantee that the iteration order of - * values will be the order in which they were `add`ed. - * - * The iteration behavior of OrderedSet is the same as native ES6 Set. - * - * Note that `OrderedSet` are more expensive than non-ordered `Set` and may - * consume more memory. `OrderedSet#add` is amortized O(log32 N), but not - * stable. - */ - export module OrderedSet { - - /** - * True if the provided value is an OrderedSet. - */ - function isOrderedSet(maybeOrderedSet: any): boolean; - - /** - * Creates a new OrderedSet containing `values`. - */ - function of(...values: T[]): OrderedSet; - - /** - * `OrderedSet.fromKeys()` creates a new immutable OrderedSet containing - * the keys from this Iterable or JavaScript Object. - */ - function fromKeys(iter: Iterable): OrderedSet; - function fromKeys(obj: {[key: string]: any}): OrderedSet; - } - - /** - * Create a new immutable OrderedSet containing the values of the provided - * iterable-like. - */ - export function OrderedSet(): OrderedSet; - export function OrderedSet(): OrderedSet; - export function OrderedSet(iterable: ESIterable): OrderedSet; - - export interface OrderedSet extends Set { - - // Sequence algorithms - - /** - * Returns a new Set with values passed through a - * `mapper` function. - * - * OrderedSet([1,2]).map(x => 10 * x) - * // Set [10,20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): OrderedSet; - - /** - * Returns an OrderedSet of the same type "zipped" with the provided - * iterables. - * - * @see IndexedIterator.zip - * - * Like `zipWith`, but using the default `zipper`: creating an `Array`. - * - * var a = OrderedSet.of(1, 2, 3); - * var b = OrderedSet.of(4, 5, 6); - * var c = a.zip(b); // OrderedSet [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] - * - */ - zip(...iterables: Array>): OrderedSet; - - /** - * Returns an OrderedSet of the same type "zipped" with the provided - * iterables by using a custom `zipper` function. - * - * @see IndexedIterator.zipWith - */ - zipWith( - zipper: (value: T, otherValue: U) => Z, - otherIterable: Iterable - ): OrderedSet; - zipWith( - zipper: (value: T, otherValue: U, thirdValue: V) => Z, - otherIterable: Iterable, - thirdIterable: Iterable - ): OrderedSet; - zipWith( - zipper: (...any: Array) => Z, - ...iterables: Array> - ): OrderedSet; - - } - - - /** - * Stacks are indexed collections which support very efficient O(1) addition - * and removal from the front using `unshift(v)` and `shift()`. - * - * For familiarity, Stack also provides `push(v)`, `pop()`, and `peek()`, but - * be aware that they also operate on the front of the list, unlike List or - * a JavaScript Array. - * - * Note: `reverse()` or any inherent reverse traversal (`reduceRight`, - * `lastIndexOf`, etc.) is not efficient with a Stack. - * - * Stack is implemented with a Single-Linked List. - */ - export module Stack { - - /** - * True if the provided value is a Stack - */ - function isStack(maybeStack: any): maybeStack is Stack; - - /** - * Creates a new Stack containing `values`. - */ - function of(...values: T[]): Stack; - } - - /** - * Create a new immutable Stack containing the values of the provided - * iterable-like. - * - * The iteration order of the provided iterable is preserved in the - * resulting `Stack`. - */ - export function Stack(): Stack; - export function Stack(): Stack; - export function Stack(iterable: ESIterable): Stack; - - export interface Stack extends Collection.Indexed { - - // Reading values - - /** - * Alias for `Stack.first()`. - */ - peek(): T | undefined; - - - // Persistent changes - - /** - * Returns a new Stack with 0 size and no values. - */ - clear(): Stack; - - /** - * Returns a new Stack with the provided `values` prepended, shifting other - * values ahead to higher indices. - * - * This is very efficient for Stack. - */ - unshift(...values: T[]): Stack; - - /** - * Like `Stack#unshift`, but accepts a iterable rather than varargs. - */ - unshiftAll(iter: Iterable): Stack; - unshiftAll(iter: Array): Stack; - - /** - * Returns a new Stack with a size ones less than this Stack, excluding - * the first item in this Stack, shifting all other values to a lower index. - * - * Note: this differs from `Array#shift` because it returns a new - * Stack rather than the removed value. Use `first()` or `peek()` to get the - * first value in this Stack. - */ - shift(): Stack; - - /** - * Alias for `Stack#unshift` and is not equivalent to `List#push`. - */ - push(...values: T[]): Stack; - - /** - * Alias for `Stack#unshiftAll`. - */ - pushAll(iter: Iterable): Stack; - pushAll(iter: Array): Stack; - - /** - * Alias for `Stack#shift` and is not equivalent to `List#pop`. - */ - pop(): Stack; - - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set`, `push`, and `pop` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: Stack) => any): Stack; - - /** - * @see `Map#asMutable` - */ - asMutable(): Stack; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): Stack; - - // Sequence algorithms - - /** - * Returns a new Stack with values passed through a - * `mapper` function. - * - * Stack([1,2]).map(x => 10 * x) - * // Stack [10,20] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Stack; - } - - - /** - * Returns a Seq.Indexed of numbers from `start` (inclusive) to `end` - * (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to - * infinity. When `start` is equal to `end`, returns empty range. - * - * Range() // [0,1,2,3,...] - * Range(10) // [10,11,12,13,...] - * Range(10,15) // [10,11,12,13,14] - * Range(10,30,5) // [10,15,20,25] - * Range(30,10,5) // [30,25,20,15] - * Range(30,30,5) // [] - * - */ - export function Range(start?: number, end?: number, step?: number): Seq.Indexed; - - - /** - * Returns a Seq.Indexed of `value` repeated `times` times. When `times` is - * not defined, returns an infinite `Seq` of `value`. - * - * Repeat('foo') // ['foo','foo','foo',...] - * Repeat('bar',4) // ['bar','bar','bar','bar'] - * - */ - export function Repeat(value: T, times?: number): Seq.Indexed; - - - /** - * Creates a new Class which produces Record instances. A record is similar to - * a JS object, but enforce a specific set of allowed string keys, and have - * default values. - * - * var ABRecord = Record({a:1, b:2}) - * var myRecord = new ABRecord({b:3}) - * - * Records always have a value for the keys they define. `remove`ing a key - * from a record simply resets it to the default value for that key. - * - * myRecord.size // 2 - * myRecord.get('a') // 1 - * myRecord.get('b') // 3 - * myRecordWithoutB = myRecord.remove('b') - * myRecordWithoutB.get('b') // 2 - * myRecordWithoutB.size // 2 - * - * Values provided to the constructor not found in the Record type will - * be ignored. For example, in this case, ABRecord is provided a key "x" even - * though only "a" and "b" have been defined. The value for "x" will be - * ignored for this record. - * - * var myRecord = new ABRecord({b:3, x:10}) - * myRecord.get('x') // undefined - * - * Because Records have a known set of string keys, property get access works - * as expected, however property sets will throw an Error. - * - * Note: IE8 does not support property access. Only use `get()` when - * supporting IE8. - * - * myRecord.b // 3 - * myRecord.b = 5 // throws Error - * - * Record Classes can be extended as well, allowing for custom methods on your - * Record. This is not a common pattern in functional environments, but is in - * many JS programs. - * - * class ABRecord extends Record({a:1,b:2}) { - * getAB() { - * return this.a + this.b; - * } - * } - * - * var myRecord = new ABRecord({b: 3}) - * myRecord.getAB() // 4 - * - */ - export module Record { - - /** - * Records allow passing a second parameter to supply a descriptive name - * that appears when converting a Record to a string or in any error - * messages. A descriptive name for any record can be accessed by using this - * method. If one was not provided, the string "Record" is returned. - * - * ```js - * var Person = Record({ - * name: null - * }, 'Person') - * - * var me = Person({ name: 'My Name' }) - * me.toString() // "Person { "name": "My Name" }" - * Record.getDescriptiveName(me) // "Person" - * ``` - */ - export function getDescriptiveName(record: Instance): string; - - export interface Class { - (values?: Partial | ESIterable<[string, any]>): Instance & Readonly; - new (values?: Partial | ESIterable<[string, any]>): Instance & Readonly; - } - - export interface Instance { - size: number; - - // Reading values - - has(key: string): boolean; - get(key: K): T[K]; - - // Value equality - - equals(other: any): boolean; - hashCode(): number; - - // Persistent changes - - set(key: K, value: T[K]): this; - update(key: K, updater: (value: T[K]) => T[K]): this; - merge(...iterables: Array | ESIterable<[string, any]>>): this; - mergeDeep(...iterables: Array | ESIterable<[string, any]>>): this; - - /** - * @alias remove - */ - delete(key: K): this; - remove(key: K): this; - clear(): this; - - // Deep persistent changes - - setIn(keyPath: Array | Iterable, value: any): this; - updateIn(keyPath: Array | Iterable, updater: (value: any) => any): this; - mergeIn(keyPath: Array | Iterable, ...iterables: Array): this; - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): this; - - /** - * @alias removeIn - */ - deleteIn(keyPath: Array | Iterable): this; - removeIn(keyPath: Array | Iterable): this; - - // Conversion to JavaScript types - - /** - * Deeply converts this Record to equivalent JS. - * - * @alias toJSON - */ - toJS(): any; - - /** - * Shallowly converts this Record to equivalent JS. - */ - toObject(): T; - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: this) => any): this; - - /** - * @see `Map#asMutable` - */ - asMutable(): this; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): this; - - // Sequence algorithms - - [Symbol.iterator](): Iterator<[keyof T, T[keyof T]]>; - } - } - - export function Record(defaultValues: T, name?: string): Record.Class; - - - /** - * Represents a sequence of values, but may not be backed by a concrete data - * structure. - * - * **Seq is immutable** — Once a Seq is created, it cannot be - * changed, appended to, rearranged or otherwise modified. Instead, any - * mutative method called on a `Seq` will return a new `Seq`. - * - * **Seq is lazy** — Seq does as little work as necessary to respond to any - * method call. Values are often created during iteration, including implicit - * iteration when reducing or converting to a concrete data structure such as - * a `List` or JavaScript `Array`. - * - * For example, the following performs no work, because the resulting - * Seq's values are never iterated: - * - * var oddSquares = Immutable.Seq.of(1,2,3,4,5,6,7,8) - * .filter(x => x % 2).map(x => x * x); - * - * Once the Seq is used, it performs only the work necessary. In this - * example, no intermediate data structures are ever created, filter is only - * called three times, and map is only called once: - * - * console.log(oddSquares.get(1)); // 9 - * - * Seq allows for the efficient chaining of operations, - * allowing for the expression of logic that can otherwise be very tedious: - * - * Immutable.Seq({a:1, b:1, c:1}) - * .flip().map(key => key.toUpperCase()).flip().toObject(); - * // Map { A: 1, B: 1, C: 1 } - * - * As well as expressing logic that would otherwise be memory or time limited: - * - * Immutable.Range(1, Infinity) - * .skip(1000) - * .map(n => -n) - * .filter(n => n % 2 === 0) - * .take(2) - * .reduce((r, n) => r * n, 1); - * // 1006008 - * - * Seq is often used to provide a rich collection API to JavaScript Object. - * - * Immutable.Seq({ x: 0, y: 1, z: 2 }).map(v => v * 2).toObject(); - * // { x: 0, y: 2, z: 4 } - */ - - export module Seq { - /** - * True if `maybeSeq` is a Seq, it is not backed by a concrete - * structure such as Map, List, or Set. - */ - function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed | Seq.Keyed; - - /** - * Returns a Seq of the values provided. Alias for `Seq.Indexed.of()`. - */ - function of(...values: T[]): Seq.Indexed; - - - /** - * `Seq` which represents key-value pairs. - */ - export module Keyed {} - - /** - * Always returns a Seq.Keyed, if input is not keyed, expects an - * iterable of [K, V] tuples. - */ - export function Keyed(): Seq.Keyed; - export function Keyed(): Seq.Keyed; - export function Keyed(iterable: ESIterable<[K, V]>): Seq.Keyed; - export function Keyed(obj: {[key: string]: V}): Seq.Keyed; - - export interface Keyed extends Seq, Iterable.Keyed { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Keyed with values passed through a - * `mapper` function. - * - * Indexed([1, 2]).map(x => 10 * x) - * // Indexed [10, 20] - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Seq.Keyed; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Seq.Keyed; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Seq.Keyed; - } - - - /** - * `Seq` which represents an ordered indexed list of values. - */ - module Indexed { - - /** - * Provides an Seq.Indexed of the values provided. - */ - function of(...values: T[]): Seq.Indexed; - } - - /** - * Always returns Seq.Indexed, discarding associated keys and - * supplying incrementing indices. - */ - export function Indexed(): Seq.Indexed; - export function Indexed(): Seq.Indexed; - export function Indexed(iterable: ESIterable): Seq.Indexed; - - export interface Indexed extends Seq, Iterable.Indexed { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Indexed with values passed through a - * `mapper` function. - * - * Seq.Indexed({a: 1, b: 2}).map(x => 10 * x) - * // Seq.Indexed {a: 10, b: 20} - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Seq.Indexed; - } - - - /** - * `Seq` which represents a set of values. - * - * Because `Seq` are often lazy, `Seq.Set` does not provide the same guarantee - * of value uniqueness as the concrete `Set`. - */ - export module Set { - - /** - * Returns a Seq.Set of the provided values - */ - function of(...values: T[]): Seq.Set; - } - - /** - * Always returns a Seq.Set, discarding associated indices or keys. - */ - export function Set(): Seq.Set; - export function Set(): Seq.Set; - export function Set(iterable: ESIterable): Seq.Set; - - export interface Set extends Seq, Iterable.Set { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Set with values passed through a - * `mapper` function. - * - * Seq.Set([1, 2]).map(x => 10 * x) - * // Seq.Set [10, 20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Seq.Set; - } - - } - - /** - * Creates a Seq. - * - * Returns a particular kind of `Seq` based on the input. - * - * * If a `Seq`, that same `Seq`. - * * If an `Iterable`, a `Seq` of the same kind (Keyed, Indexed, or Set). - * * If an Array-like, an `Seq.Indexed`. - * * If an Object with an Iterator, an `Seq.Indexed`. - * * If an Iterator, an `Seq.Indexed`. - * * If an Object, a `Seq.Keyed`. - * - */ - export function Seq(): Seq; - export function Seq(): Seq; - export function Seq>(seq: S): S; - export function Seq(iterable: Iterable.Keyed): Seq.Keyed; - export function Seq(iterable: Iterable.Indexed): Seq.Indexed; - export function Seq(iterable: Iterable.Set): Seq.Set; - export function Seq(iterable: ESIterable): Seq.Indexed; - export function Seq(obj: {[key: string]: V}): Seq.Keyed; - - export interface Seq extends Iterable { - - /** - * Some Seqs can describe their size lazily. When this is the case, - * size will be an integer. Otherwise it will be undefined. - * - * For example, Seqs returned from `map()` or `reverse()` - * preserve the size of the original `Seq` while `filter()` does not. - * - * Note: `Range`, `Repeat` and `Seq`s made from `Array`s and `Object`s will - * always have a size. - */ - size: number/*?*/; - - - // Force evaluation - - /** - * Because Sequences are lazy and designed to be chained together, they do - * not cache their results. For example, this map function is called a total - * of 6 times, as each `join` iterates the Seq of three values. - * - * var squares = Seq.of(1,2,3).map(x => x * x); - * squares.join() + squares.join(); - * - * If you know a `Seq` will be used multiple times, it may be more - * efficient to first cache it in memory. Here, the map function is called - * only 3 times. - * - * var squares = Seq.of(1,2,3).map(x => x * x).cacheResult(); - * squares.join() + squares.join(); - * - * Use this method judiciously, as it must fully evaluate a Seq which can be - * a burden on memory and possibly performance. - * - * Note: after calling `cacheResult`, a Seq will always have a `size`. - */ - cacheResult(): this; - - // Sequence algorithms - - /** - * Returns a new Seq with values passed through a - * `mapper` function. - * - * Seq({a: 1, b: 2}).map(x => 10 * x) - * // Set {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Seq; - } - - /** - * The `Iterable` is a set of (key, value) entries which can be iterated, and - * is the base class for all collections in `immutable`, allowing them to - * make use of all the Iterable methods (such as `map` and `filter`). - * - * Note: An iterable is always iterated in the same order, however that order - * may not always be well defined, as is the case for the `Map` and `Set`. - */ - export module Iterable { - /** - * True if `maybeIterable` is an Iterable, or any of its subclasses. - * - * ```js - * Iterable.isIterable([]); // false - * Iterable.isIterable({}); // false - * Iterable.isIterable(Immutable.Map()); // true - * Iterable.isIterable(Immutable.List()); // true - * Iterable.isIterable(Immutable.Stack()); // true - * ``` - */ - function isIterable(maybeIterable: any): maybeIterable is Iterable; - - /** - * True if `maybeKeyed` is an Iterable.Keyed, or any of its subclasses. - */ - function isKeyed(maybeKeyed: any): maybeKeyed is Iterable.Keyed; - - /** - * True if `maybeIndexed` is a Iterable.Indexed, or any of its subclasses. - */ - function isIndexed(maybeIndexed: any): maybeIndexed is Iterable.Indexed; - - /** - * True if `maybeAssociative` is either a keyed or indexed Iterable. - */ - function isAssociative(maybeAssociative: any): maybeAssociative is Iterable.Keyed | Iterable.Indexed; - - /** - * True if `maybeOrdered` is an Iterable where iteration order is well - * defined. True for Iterable.Indexed as well as OrderedMap and OrderedSet. - */ - function isOrdered(maybeOrdered: any): boolean; - - - /** - * Keyed Iterables have discrete keys tied to each value. - * - * When iterating `Iterable.Keyed`, each iteration will yield a `[K, V]` - * tuple, in other words, `Iterable#entries` is the default iterator for - * Keyed Iterables. - */ - export module Keyed {} - - /** - * Creates an Iterable.Keyed - * - * Similar to `Iterable()`, however it expects iterable-likes of [K, V] - * tuples if not constructed from a Iterable.Keyed or JS Object. - */ - export function Keyed(iterable: ESIterable<[K, V]>): Iterable.Keyed; - export function Keyed(obj: {[key: string]: V}): Iterable.Keyed; - - export interface Keyed extends Iterable { - - /** - * Returns Seq.Keyed. - * @override - */ - toSeq(): Seq.Keyed; - - - // Sequence functions - - /** - * Returns a new Iterable.Keyed of the same type where the keys and values - * have been flipped. - * - * Seq({ a: 'z', b: 'y' }).flip() // { z: 'a', y: 'b' } - * - */ - flip(): this; - - /** - * Returns a new Iterable.Keyed with values passed through a - * `mapper` function. - * - * Iterable.Keyed({a: 1, b: 2}).map(x => 10 * x) - * // Iterable.Keyed {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Iterable.Keyed; - - /** - * Returns a new Iterable.Keyed of the same type with keys passed through - * a `mapper` function. - * - * Seq({ a: 1, b: 2 }) - * .mapKeys(x => x.toUpperCase()) - * // Seq { A: 1, B: 2 } - * - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Iterable.Keyed; - - /** - * Returns a new Iterable.Keyed of the same type with entries - * ([key, value] tuples) passed through a `mapper` function. - * - * Seq({ a: 1, b: 2 }) - * .mapEntries(([k, v]) => [k.toUpperCase(), v * 2]) - * // Seq { A: 2, B: 4 } - * - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Iterable.Keyed; - - [Symbol.iterator](): Iterator<[K, V]>; - } - - - /** - * Indexed Iterables have incrementing numeric keys. They exhibit - * slightly different behavior than `Iterable.Keyed` for some methods in order - * to better mirror the behavior of JavaScript's `Array`, and add methods - * which do not make sense on non-indexed Iterables such as `indexOf`. - * - * Unlike JavaScript arrays, `Iterable.Indexed`s are always dense. "Unset" - * indices and `undefined` indices are indistinguishable, and all indices from - * 0 to `size` are visited when iterated. - * - * All Iterable.Indexed methods return re-indexed Iterables. In other words, - * indices always start at 0 and increment until size. If you wish to - * preserve indices, using them as keys, convert to a Iterable.Keyed by - * calling `toKeyedSeq`. - */ - export module Indexed {} - - /** - * Creates a new Iterable.Indexed. - */ - export function Indexed(iterable: ESIterable): Iterable.Indexed; - - export interface Indexed extends Iterable { - - // Reading values - - /** - * Returns the value associated with the provided index, or notSetValue if - * the index is beyond the bounds of the Iterable. - * - * `index` may be a negative number, which indexes back from the end of the - * Iterable. `s.get(-1)` gets the last item in the Iterable. - */ - get(index: number, notSetValue?: T): T | undefined; - - - // Conversion to Seq - - /** - * Returns Seq.Indexed. - * @override - */ - toSeq(): Seq.Indexed; - - /** - * If this is an iterable of [key, value] entry tuples, it will return a - * Seq.Keyed of those entries. - */ - fromEntrySeq(): Seq.Keyed; - - - // Combination - - /** - * Returns an Iterable of the same type with `separator` between each item - * in this Iterable. - */ - interpose(separator: T): this; - - /** - * Returns an Iterable of the same type with the provided `iterables` - * interleaved into this iterable. - * - * The resulting Iterable includes the first item from each, then the - * second from each, etc. - * - * I.Seq.of(1,2,3).interleave(I.Seq.of('A','B','C')) - * // Seq [ 1, 'A', 2, 'B', 3, 'C' ] - * - * The shortest Iterable stops interleave. - * - * I.Seq.of(1,2,3).interleave( - * I.Seq.of('A','B'), - * I.Seq.of('X','Y','Z') - * ) - * // Seq [ 1, 'A', 'X', 2, 'B', 'Y' ] - */ - interleave(...iterables: Array>): this; - - /** - * Splice returns a new indexed Iterable by replacing a region of this - * Iterable with new values. If values are not provided, it only skips the - * region to be removed. - * - * `index` may be a negative number, which indexes back from the end of the - * Iterable. `s.splice(-2)` splices after the second to last item. - * - * Seq(['a','b','c','d']).splice(1, 2, 'q', 'r', 's') - * // Seq ['a', 'q', 'r', 's', 'd'] - * - */ - splice( - index: number, - removeNum: number, - ...values: T[] - ): this; - - /** - * Returns an Iterable of the same type "zipped" with the provided - * iterables. - * - * Like `zipWith`, but using the default `zipper`: creating an `Array`. - * - * var a = Seq.of(1, 2, 3); - * var b = Seq.of(4, 5, 6); - * var c = a.zip(b); // Seq [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] - * - */ - zip(...iterables: Array>): Iterable.Indexed; - - /** - * Returns an Iterable of the same type "zipped" with the provided - * iterables by using a custom `zipper` function. - * - * var a = Seq.of(1, 2, 3); - * var b = Seq.of(4, 5, 6); - * var c = a.zipWith((a, b) => a + b, b); // Seq [ 5, 7, 9 ] - * - */ - zipWith( - zipper: (value: T, otherValue: U) => Z, - otherIterable: Iterable - ): Iterable.Indexed; - zipWith( - zipper: (value: T, otherValue: U, thirdValue: V) => Z, - otherIterable: Iterable, - thirdIterable: Iterable - ): Iterable.Indexed; - zipWith( - zipper: (...any: Array) => Z, - ...iterables: Array> - ): Iterable.Indexed; - - - // Search for value - - /** - * Returns the first index at which a given value can be found in the - * Iterable, or -1 if it is not present. - */ - indexOf(searchValue: T): number; - - /** - * Returns the last index at which a given value can be found in the - * Iterable, or -1 if it is not present. - */ - lastIndexOf(searchValue: T): number; - - /** - * Returns the first index in the Iterable where a value satisfies the - * provided predicate function. Otherwise -1 is returned. - */ - findIndex( - predicate: (value: T, index: number, iter: this) => boolean, - context?: any - ): number; - - /** - * Returns the last index in the Iterable where a value satisfies the - * provided predicate function. Otherwise -1 is returned. - */ - findLastIndex( - predicate: (value: T, index: number, iter: this) => boolean, - context?: any - ): number; - - // Sequence algorithms - - /** - * Returns a new Iterable.Indexed with values passed through a - * `mapper` function. - * - * Iterable.Indexed([1,2]).map(x => 10 * x) - * // Iterable.Indexed [1,2] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Iterable.Indexed; - - [Symbol.iterator](): Iterator; - } - - - /** - * Set Iterables only represent values. They have no associated keys or - * indices. Duplicate values are possible in Seq.Sets, however the - * concrete `Set` does not allow duplicate values. - * - * Iterable methods on Iterable.Set such as `map` and `forEach` will provide - * the value as both the first and second arguments to the provided function. - * - * var seq = Seq.Set.of('A', 'B', 'C'); - * assert.equal(seq.every((v, k) => v === k), true); - * - */ - export module Set {} - - /** - * Similar to `Iterable()`, but always returns a Iterable.Set. - */ - export function Set(iterable: ESIterable): Iterable.Set; - - export interface Set extends Iterable { - - /** - * Returns Seq.Set. - * @override - */ - toSeq(): Seq.Set; - - // Sequence algorithms - - /** - * Returns a new Iterable.Set with values passed through a - * `mapper` function. - * - * Iterable.Set([1,2]).map(x => 10 * x) - * // Iterable.Set [1,2] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Iterable.Set; - - [Symbol.iterator](): Iterator; - } - - } - - /** - * Creates an Iterable. - * - * The type of Iterable created is based on the input. - * - * * If an `Iterable`, that same `Iterable`. - * * If an Array-like, an `Iterable.Indexed`. - * * If an Object with an Iterator, an `Iterable.Indexed`. - * * If an Iterator, an `Iterable.Indexed`. - * * If an Object, an `Iterable.Keyed`. - * - * This methods forces the conversion of Objects and Strings to Iterables. - * If you want to ensure that a Iterable of one item is returned, use - * `Seq.of`. - */ - export function Iterable>(iterable: I): I; - export function Iterable(iterable: ESIterable): Iterable.Indexed; - export function Iterable(obj: {[key: string]: V}): Iterable.Keyed; - - export interface Iterable { - - // Value equality - - /** - * True if this and the other Iterable have value equality, as defined - * by `Immutable.is()`. - * - * Note: This is equivalent to `Immutable.is(this, other)`, but provided to - * allow for chained expressions. - */ - equals(other: any): boolean; - - /** - * Computes and returns the hashed identity for this Iterable. - * - * The `hashCode` of an Iterable is used to determine potential equality, - * and is used when adding this to a `Set` or as a key in a `Map`, enabling - * lookup via a different instance. - * - * var a = List.of(1, 2, 3); - * var b = List.of(1, 2, 3); - * assert(a !== b); // different instances - * var set = Set.of(a); - * assert(set.has(b) === true); - * - * If two values have the same `hashCode`, they are [not guaranteed - * to be equal][Hash Collision]. If two values have different `hashCode`s, - * they must not be equal. - * - * [Hash Collision]: http://en.wikipedia.org/wiki/Collision_(computer_science) - */ - hashCode(): number; - - - // Reading values - - /** - * Returns the value associated with the provided key, or notSetValue if - * the Iterable does not contain this key. - * - * Note: it is possible a key may be associated with an `undefined` value, - * so if `notSetValue` is not provided and this method returns `undefined`, - * that does not guarantee the key was not found. - */ - get(key: K, notSetValue?: V): V | undefined; - - /** - * True if a key exists within this `Iterable`, using `Immutable.is` to determine equality - */ - has(key: K): boolean; - - /** - * True if a value exists within this `Iterable`, using `Immutable.is` to determine equality - * @alias contains - */ - includes(value: V): boolean; - contains(value: V): boolean; - - /** - * The first value in the Iterable. - */ - first(): V | undefined; - - /** - * The last value in the Iterable. - */ - last(): V | undefined; - - - // Reading deep values - - /** - * Returns the value found by following a path of keys or indices through - * nested Iterables. - */ - getIn(searchKeyPath: Array, notSetValue?: any): any; - getIn(searchKeyPath: Iterable, notSetValue?: any): any; - - /** - * True if the result of following a path of keys or indices through nested - * Iterables results in a set value. - */ - hasIn(searchKeyPath: Array): boolean; - hasIn(searchKeyPath: Iterable): boolean; - - - // Conversion to JavaScript types - - /** - * Deeply converts this Iterable to equivalent JS. - * - * `Iterable.Indexeds`, and `Iterable.Sets` become Arrays, while - * `Iterable.Keyeds` become Objects. - * - * @alias toJSON - */ - toJS(): any; - - /** - * Shallowly converts this iterable to an Array, discarding keys. - */ - toArray(): Array; - - /** - * Shallowly converts this Iterable to an Object. - * - * Throws if keys are not strings. - */ - toObject(): { [key: string]: V }; - - - // Conversion to Collections - - /** - * Converts this Iterable to a Map, Throws if keys are not hashable. - * - * Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided - * for convenience and to allow for chained expressions. - */ - toMap(): Map; - - /** - * Converts this Iterable to a Map, maintaining the order of iteration. - * - * Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but - * provided for convenience and to allow for chained expressions. - */ - toOrderedMap(): OrderedMap; - - /** - * Converts this Iterable to a Set, discarding keys. Throws if values - * are not hashable. - * - * Note: This is equivalent to `Set(this)`, but provided to allow for - * chained expressions. - */ - toSet(): Set; - - /** - * Converts this Iterable to a Set, maintaining the order of iteration and - * discarding keys. - * - * Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided - * for convenience and to allow for chained expressions. - */ - toOrderedSet(): OrderedSet; - - /** - * Converts this Iterable to a List, discarding keys. - * - * Note: This is equivalent to `List(this)`, but provided to allow - * for chained expressions. - */ - toList(): List; - - /** - * Converts this Iterable to a Stack, discarding keys. Throws if values - * are not hashable. - * - * Note: This is equivalent to `Stack(this)`, but provided to allow for - * chained expressions. - */ - toStack(): Stack; - - - // Conversion to Seq - - /** - * Converts this Iterable to a Seq of the same kind (indexed, - * keyed, or set). - */ - toSeq(): Seq; - - /** - * Returns a Seq.Keyed from this Iterable where indices are treated as keys. - * - * This is useful if you want to operate on an - * Iterable.Indexed and preserve the [index, value] pairs. - * - * The returned Seq will have identical iteration order as - * this Iterable. - * - * Example: - * - * var indexedSeq = Immutable.Seq.of('A', 'B', 'C'); - * indexedSeq.filter(v => v === 'B').toString() // Seq [ 'B' ] - * var keyedSeq = indexedSeq.toKeyedSeq(); - * keyedSeq.filter(v => v === 'B').toString() // Seq { 1: 'B' } - * - */ - toKeyedSeq(): Seq.Keyed; - - /** - * Returns an Seq.Indexed of the values of this Iterable, discarding keys. - */ - toIndexedSeq(): Seq.Indexed; - - /** - * Returns a Seq.Set of the values of this Iterable, discarding keys. - */ - toSetSeq(): Seq.Set; - - - // Iterators - - /** - * An iterator of this `Iterable`'s keys. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `keySeq` instead, if this is what you want. - */ - keys(): Iterator; - - /** - * An iterator of this `Iterable`'s values. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `valueSeq` instead, if this is what you want. - */ - values(): Iterator; - - /** - * An iterator of this `Iterable`'s entries as `[key, value]` tuples. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `entrySeq` instead, if this is what you want. - */ - entries(): Iterator<[K, V]>; - - - // Iterables (Seq) - - /** - * Returns a new Seq.Indexed of the keys of this Iterable, - * discarding values. - */ - keySeq(): Seq.Indexed; - - /** - * Returns an Seq.Indexed of the values of this Iterable, discarding keys. - */ - valueSeq(): Seq.Indexed; - - /** - * Returns a new Seq.Indexed of [key, value] tuples. - */ - entrySeq(): Seq.Indexed<[K, V]>; - - - // Sequence algorithms - - /** - * Returns a new Iterable of the same type with values passed through a - * `mapper` function. - * - * Seq({ a: 1, b: 2 }).map(x => 10 * x) - * // Seq { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Iterable; - - /** - * Returns a new Iterable of the same type with only the entries for which - * the `predicate` function returns true. - * - * Seq({a:1,b:2,c:3,d:4}).filter(x => x % 2 === 0) - * // Seq { b: 2, d: 4 } - * - */ - filter( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type with only the entries for which - * the `predicate` function returns false. - * - * Seq({a:1,b:2,c:3,d:4}).filterNot(x => x % 2 === 0) - * // Seq { a: 1, c: 3 } - * - */ - filterNot( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type in reverse order. - */ - reverse(): this; - - /** - * Returns a new Iterable of the same type which includes the same entries, - * stably sorted by using a `comparator`. - * - * If a `comparator` is not provided, a default comparator uses `<` and `>`. - * - * `comparator(valueA, valueB)`: - * - * * Returns `0` if the elements should not be swapped. - * * Returns `-1` (or any negative number) if `valueA` comes before `valueB` - * * Returns `1` (or any positive number) if `valueA` comes after `valueB` - * * Is pure, i.e. it must always return the same value for the same pair - * of values. - * - * When sorting collections which have no defined order, their ordered - * equivalents will be returned. e.g. `map.sort()` returns OrderedMap. - * - * ```js - * Seq({c: 3, a: 1, b: 2}).sort((a, b) => { - * if (a < b) { return -1; } - * if (a > b) { return 1; } - * if (a === b) { return 0; } - * }).toJS(); - * // { a: 1, b: 2, c: 3 } - * ``` - */ - sort(comparator?: (valueA: V, valueB: V) => number): this; - - /** - * Like `sort`, but also accepts a `comparatorValueMapper` which allows for - * sorting by more sophisticated means: - * - * hitters.sortBy(hitter => hitter.avgHits); - * - */ - sortBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): this; - - /** - * Returns a `Iterable.Keyed` of `Iterable.Keyeds`, grouped by the return - * value of the `grouper` function. - * - * Note: This is always an eager operation. - * - * Immutable.fromJS([{v: 0}, {v: 1}, {v: 1}, {v: 0}, {v: 1}]) - * .groupBy(x => x.get('v')) - * // Map {0: [{v: 0},{v: 0}], 1: [{v: 1},{v: 1},{v: 1}]} - */ - groupBy( - grouper: (value: V, key: K, iter: this) => G, - context?: any - ): /*Map*/Seq.Keyed>; - - - // Side effects - - /** - * The `sideEffect` is executed for every entry in the Iterable. - * - * Unlike `Array#forEach`, if any call of `sideEffect` returns - * `false`, the iteration will stop. Returns the number of entries iterated - * (including the last iteration which returned false). - */ - forEach( - sideEffect: (value: V, key: K, iter: this) => any, - context?: any - ): number; - - - // Creating subsets - - /** - * Returns a new Iterable of the same type representing a portion of this - * Iterable from start up to but not including end. - * - * If begin is negative, it is offset from the end of the Iterable. e.g. - * `slice(-2)` returns a Iterable of the last two entries. If it is not - * provided the new Iterable will begin at the beginning of this Iterable. - * - * If end is negative, it is offset from the end of the Iterable. e.g. - * `slice(0, -1)` returns an Iterable of everything but the last entry. If - * it is not provided, the new Iterable will continue through the end of - * this Iterable. - * - * If the requested slice is equivalent to the current Iterable, then it - * will return itself. - */ - slice(begin?: number, end?: number): this; - - /** - * Returns a new Iterable of the same type containing all entries except - * the first. - */ - rest(): this; - - /** - * Returns a new Iterable of the same type containing all entries except - * the last. - */ - butLast(): this; - - /** - * Returns a new Iterable of the same type which excludes the first `amount` - * entries from this Iterable. - */ - skip(amount: number): this; - - /** - * Returns a new Iterable of the same type which excludes the last `amount` - * entries from this Iterable. - */ - skipLast(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes entries starting - * from when `predicate` first returns false. - * - * Seq.of('dog','frog','cat','hat','god') - * .skipWhile(x => x.match(/g/)) - * // Seq [ 'cat', 'hat', 'god' ] - * - */ - skipWhile( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes entries starting - * from when `predicate` first returns true. - * - * Seq.of('dog','frog','cat','hat','god') - * .skipUntil(x => x.match(/hat/)) - * // Seq [ 'hat', 'god' ] - * - */ - skipUntil( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes the first `amount` - * entries from this Iterable. - */ - take(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes the last `amount` - * entries from this Iterable. - */ - takeLast(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes entries from this - * Iterable as long as the `predicate` returns true. - * - * Seq.of('dog','frog','cat','hat','god') - * .takeWhile(x => x.match(/o/)) - * // Seq [ 'dog', 'frog' ] - * - */ - takeWhile( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes entries from this - * Iterable as long as the `predicate` returns false. - * - * Seq.of('dog','frog','cat','hat','god').takeUntil(x => x.match(/at/)) - * // ['dog', 'frog'] - * - */ - takeUntil( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - - // Combination - - /** - * Returns a new Iterable of the same type with other values and - * iterable-like concatenated to this one. - * - * For Seqs, all entries will be present in - * the resulting iterable, even if they have the same key. - */ - concat(...valuesOrIterables: any[]): Iterable; - - /** - * Flattens nested Iterables. - * - * Will deeply flatten the Iterable by default, returning an Iterable of the - * same type, but a `depth` can be provided in the form of a number or - * boolean (where true means to shallowly flatten one level). A depth of 0 - * (or shallow: false) will deeply flatten. - * - * Flattens only others Iterable, not Arrays or Objects. - * - * Note: `flatten(true)` operates on Iterable> and - * returns Iterable - */ - flatten(depth?: number): Iterable; - flatten(shallow?: boolean): Iterable; - - /** - * Flat-maps the Iterable, returning an Iterable of the same type. - * - * Similar to `iter.map(...).flatten(true)`. - */ - flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable, - context?: any - ): Iterable; - - // Reducing a value - - /** - * Reduces the Iterable to a value by calling the `reducer` for every entry - * in the Iterable and passing along the reduced value. - * - * If `initialReduction` is not provided, the first item in the - * Iterable will be used. - * - * @see `Array#reduce`. - */ - reduce( - reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: any - ): R; - - /** - * Reduces the Iterable in reverse (from the right side). - * - * Note: Similar to this.reverse().reduce(), and provided for parity - * with `Array#reduceRight`. - */ - reduceRight( - reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: any - ): R; - - /** - * True if `predicate` returns true for all entries in the Iterable. - */ - every( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): boolean; - - /** - * True if `predicate` returns true for any entry in the Iterable. - */ - some( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): boolean; - - /** - * Joins values together as a string, inserting a separator between each. - * The default separator is `","`. - */ - join(separator?: string): string; - - /** - * Returns true if this Iterable includes no values. - * - * For some lazy `Seq`, `isEmpty` might need to iterate to determine - * emptiness. At most one iteration will occur. - */ - isEmpty(): boolean; - - /** - * Returns the size of this Iterable. - * - * Regardless of if this Iterable can describe its size lazily (some Seqs - * cannot), this method will always return the correct size. E.g. it - * evaluates a lazy `Seq` if necessary. - * - * If `predicate` is provided, then this returns the count of entries in the - * Iterable for which the `predicate` returns true. - */ - count(): number; - count( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): number; - - /** - * Returns a `Seq.Keyed` of counts, grouped by the return value of - * the `grouper` function. - * - * Note: This is not a lazy operation. - */ - countBy( - grouper: (value: V, key: K, iter: this) => G, - context?: any - ): Map; - - - // Search for value - - /** - * Returns the first value for which the `predicate` returns true. - */ - find( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): V | undefined; - - /** - * Returns the last value for which the `predicate` returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLast( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): V | undefined; - - /** - * Returns the first [key, value] entry for which the `predicate` returns true. - */ - findEntry( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): [K, V] | undefined; - - /** - * Returns the last [key, value] entry for which the `predicate` - * returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLastEntry( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): [K, V] | undefined; - - /** - * Returns the key for which the `predicate` returns true. - */ - findKey( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): K | undefined; - - /** - * Returns the last key for which the `predicate` returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLastKey( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): K | undefined; - - /** - * Returns the key associated with the search value, or undefined. - */ - keyOf(searchValue: V): K | undefined; - - /** - * Returns the last key associated with the search value, or undefined. - */ - lastKeyOf(searchValue: V): K | undefined; - - /** - * Returns the maximum value in this collection. If any values are - * comparatively equivalent, the first one found will be returned. - * - * The `comparator` is used in the same way as `Iterable#sort`. If it is not - * provided, the default comparator is `>`. - * - * When two values are considered equivalent, the first encountered will be - * returned. Otherwise, `max` will operate independent of the order of input - * as long as the comparator is commutative. The default comparator `>` is - * commutative *only* when types do not differ. - * - * If `comparator` returns 0 and either value is NaN, undefined, or null, - * that value will be returned. - */ - max(comparator?: (valueA: V, valueB: V) => number): V | undefined; - - /** - * Like `max`, but also accepts a `comparatorValueMapper` which allows for - * comparing by more sophisticated means: - * - * hitters.maxBy(hitter => hitter.avgHits); - * - */ - maxBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): V | undefined; - - /** - * Returns the minimum value in this collection. If any values are - * comparatively equivalent, the first one found will be returned. - * - * The `comparator` is used in the same way as `Iterable#sort`. If it is not - * provided, the default comparator is `<`. - * - * When two values are considered equivalent, the first encountered will be - * returned. Otherwise, `min` will operate independent of the order of input - * as long as the comparator is commutative. The default comparator `<` is - * commutative *only* when types do not differ. - * - * If `comparator` returns 0 and either value is NaN, undefined, or null, - * that value will be returned. - */ - min(comparator?: (valueA: V, valueB: V) => number): V | undefined; - - /** - * Like `min`, but also accepts a `comparatorValueMapper` which allows for - * comparing by more sophisticated means: - * - * hitters.minBy(hitter => hitter.avgHits); - * - */ - minBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): V | undefined; - - - // Comparison - - /** - * True if `iter` includes every value in this Iterable. - */ - isSubset(iter: Iterable): boolean; - isSubset(iter: Array): boolean; - - /** - * True if this Iterable includes every value in `iter`. - */ - isSuperset(iter: Iterable): boolean; - isSuperset(iter: Array): boolean; - - - /** - * Note: this is here as a convenience to work around an issue with - * TypeScript https://github.com/Microsoft/TypeScript/issues/285, but - * Iterable does not define `size`, instead `Seq` defines `size` as - * nullable number, and `Collection` defines `size` as always a number. - * - * @ignore - */ - size: number; - } - - - /** - * Collection is the abstract base class for concrete data structures. It - * cannot be constructed directly. - * - * Implementations should extend one of the subclasses, `Collection.Keyed`, - * `Collection.Indexed`, or `Collection.Set`. - */ - export module Collection { - - - /** - * `Collection` which represents key-value pairs. - */ - export module Keyed {} - - export interface Keyed extends Collection, Iterable.Keyed { - - /** - * Returns Seq.Keyed. - * @override - */ - toSeq(): Seq.Keyed; - - // Sequence algorithms - - /** - * Returns a new Collection.Keyed with values passed through a - * `mapper` function. - * - * Collection.Keyed({a: 1, b: 2}).map(x => 10 * x) - * // Collection.Keyed {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Collection.Keyed; - } - - - /** - * `Collection` which represents ordered indexed values. - */ - export module Indexed {} - - export interface Indexed extends Collection, Iterable.Indexed { - - /** - * Returns Seq.Indexed. - * @override - */ - toSeq(): Seq.Indexed; - - // Sequence algorithms - - /** - * Returns a new Collection.Indexed with values passed through a - * `mapper` function. - * - * Collection.Indexed([1,2]).map(x => 10 * x) - * // Collection.Indexed [1,2] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Collection.Indexed; - } - - - /** - * `Collection` which represents values, unassociated with keys or indices. - * - * `Collection.Set` implementations should guarantee value uniqueness. - */ - export module Set {} - - export interface Set extends Collection, Iterable.Set { - - /** - * Returns Seq.Set. - * @override - */ - toSeq(): Seq.Set; - - // Sequence algorithms - - /** - * Returns a new Collection.Set with values passed through a - * `mapper` function. - * - * Collection.Set([1,2]).map(x => 10 * x) - * // Collection.Set [1,2] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Collection.Set; - } - - } - - export interface Collection extends Iterable { - - /** - * All collections maintain their current `size` as an integer. - */ - size: number; - } - - - /** - * ES6 Iterator. - * - * This is not part of the Immutable library, but a common interface used by - * many types in ES6 JavaScript. - * - * @ignore - */ - interface ESIterable { - [Symbol.iterator](): Iterator; - } - -} - -declare module "immutable" { - export = Immutable -} diff --git a/dist/immutable.js b/dist/immutable.js deleted file mode 100644 index 88aa94069c..0000000000 --- a/dist/immutable.js +++ /dev/null @@ -1,5042 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.Immutable = {}))); -}(this, function (exports) { 'use strict';var SLICE$0 = Array.prototype.slice; - - var imul = - typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? - Math.imul : - function imul(a, b) { - a = a | 0; // int - b = b | 0; // int - var c = a & 0xffff; - var d = b & 0xffff; - // Shift by 0 fixes the sign on the high part. - return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int - }; - - // v8 has an optimization for storing 31-bit signed numbers. - // Values which have either 00 or 11 as the high order bits qualify. - // This function drops the highest order bit in a signed number, maintaining - // the sign bit. - function smi(i32) { - return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF); - } - - function hash(o) { - if (o === false || o === null || o === undefined) { - return 0; - } - if (typeof o.valueOf === 'function') { - o = o.valueOf(); - if (o === false || o === null || o === undefined) { - return 0; - } - } - if (o === true) { - return 1; - } - var type = typeof o; - if (type === 'number') { - if (o !== o || o === Infinity) { - return 0; - } - var h = o | 0; - if (h !== o) { - h ^= o * 0xFFFFFFFF; - } - while (o > 0xFFFFFFFF) { - o /= 0xFFFFFFFF; - h ^= o; - } - return smi(h); - } - if (type === 'string') { - return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o); - } - if (typeof o.hashCode === 'function') { - return o.hashCode(); - } - if (type === 'object') { - return hashJSObj(o); - } - if (typeof o.toString === 'function') { - return hashString(o.toString()); - } - throw new Error('Value type ' + type + ' cannot be hashed.'); - } - - function cachedHashString(string) { - var hash = stringHashCache[string]; - if (hash === undefined) { - hash = hashString(string); - if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) { - STRING_HASH_CACHE_SIZE = 0; - stringHashCache = {}; - } - STRING_HASH_CACHE_SIZE++; - stringHashCache[string] = hash; - } - return hash; - } - - // http://jsperf.com/hashing-strings - function hashString(string) { - // This is the hash from JVM - // The hash code for a string is computed as - // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1], - // where s[i] is the ith character of the string and n is the length of - // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 - // (exclusive) by dropping high bits. - var hash = 0; - for (var ii = 0; ii < string.length; ii++) { - hash = 31 * hash + string.charCodeAt(ii) | 0; - } - return smi(hash); - } - - function hashJSObj(obj) { - var hash; - if (usingWeakMap) { - hash = weakMap.get(obj); - if (hash !== undefined) { - return hash; - } - } - - hash = obj[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; - } - - if (!canDefineProperty) { - hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; - } - - hash = getIENodeHash(obj); - if (hash !== undefined) { - return hash; - } - } - - hash = ++objHashUID; - if (objHashUID & 0x40000000) { - objHashUID = 0; - } - - if (usingWeakMap) { - weakMap.set(obj, hash); - } else if (isExtensible !== undefined && isExtensible(obj) === false) { - throw new Error('Non-extensible objects are not allowed as keys.'); - } else if (canDefineProperty) { - Object.defineProperty(obj, UID_HASH_KEY, { - 'enumerable': false, - 'configurable': false, - 'writable': false, - 'value': hash - }); - } else if (obj.propertyIsEnumerable !== undefined && - obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) { - // Since we can't define a non-enumerable property on the object - // we'll hijack one of the less-used non-enumerable properties to - // save our hash on it. Since this is a function it will not show up in - // `JSON.stringify` which is what we want. - obj.propertyIsEnumerable = function() { - return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments); - }; - obj.propertyIsEnumerable[UID_HASH_KEY] = hash; - } else if (obj.nodeType !== undefined) { - // At this point we couldn't get the IE `uniqueID` to use as a hash - // and we couldn't use a non-enumerable property to exploit the - // dontEnum bug so we simply add the `UID_HASH_KEY` on the node - // itself. - obj[UID_HASH_KEY] = hash; - } else { - throw new Error('Unable to set a non-enumerable property on object.'); - } - - return hash; - } - - // Get references to ES5 object methods. - var isExtensible = Object.isExtensible; - - // True if Object.defineProperty works as expected. IE8 fails this test. - var canDefineProperty = (function() { - try { - Object.defineProperty({}, '@', {}); - return true; - } catch (e) { - return false; - } - }()); - - // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it - // and avoid memory leaks from the IE cloneNode bug. - function getIENodeHash(node) { - if (node && node.nodeType > 0) { - switch (node.nodeType) { - case 1: // Element - return node.uniqueID; - case 9: // Document - return node.documentElement && node.documentElement.uniqueID; - } - } - } - - // If possible, use a WeakMap. - var usingWeakMap = typeof WeakMap === 'function'; - var weakMap; - if (usingWeakMap) { - weakMap = new WeakMap(); - } - - var objHashUID = 0; - - var UID_HASH_KEY = '__immutablehash__'; - if (typeof Symbol === 'function') { - UID_HASH_KEY = Symbol(UID_HASH_KEY); - } - - var STRING_HASH_CACHE_MIN_STRLEN = 16; - var STRING_HASH_CACHE_MAX_SIZE = 255; - var STRING_HASH_CACHE_SIZE = 0; - var stringHashCache = {}; - - function createClass(ctor, superClass) { - if (superClass) { - ctor.prototype = Object.create(superClass.prototype); - } - ctor.prototype.constructor = ctor; - } - - function Iterable(value) { - return isIterable(value) ? value : Seq(value); - } - - - createClass(KeyedIterable, Iterable); - function KeyedIterable(value) { - return isKeyed(value) ? value : KeyedSeq(value); - } - - - createClass(IndexedIterable, Iterable); - function IndexedIterable(value) { - return isIndexed(value) ? value : IndexedSeq(value); - } - - - createClass(SetIterable, Iterable); - function SetIterable(value) { - return isIterable(value) && !isAssociative(value) ? value : SetSeq(value); - } - - - - function isIterable(maybeIterable) { - return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]); - } - - function isKeyed(maybeKeyed) { - return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]); - } - - function isIndexed(maybeIndexed) { - return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]); - } - - function isAssociative(maybeAssociative) { - return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); - } - - function isOrdered(maybeOrdered) { - return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]); - } - - Iterable.isIterable = isIterable; - Iterable.isKeyed = isKeyed; - Iterable.isIndexed = isIndexed; - Iterable.isAssociative = isAssociative; - Iterable.isOrdered = isOrdered; - - Iterable.Keyed = KeyedIterable; - Iterable.Indexed = IndexedIterable; - Iterable.Set = SetIterable; - - - var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; - var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; - var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; - var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; - - // Used for setting prototype methods that IE8 chokes on. - var DELETE = 'delete'; - - // Constants describing the size of trie nodes. - var SHIFT = 5; // Resulted in best performance after ______? - var SIZE = 1 << SHIFT; - var MASK = SIZE - 1; - - // A consistent shared value representing "not set" which equals nothing other - // than itself, and nothing that could be provided externally. - var NOT_SET = {}; - - // Boolean references, Rough equivalent of `bool &`. - var CHANGE_LENGTH = { value: false }; - var DID_ALTER = { value: false }; - - function MakeRef(ref) { - ref.value = false; - return ref; - } - - function SetRef(ref) { - ref && (ref.value = true); - } - - // A function which returns a value representing an "owner" for transient writes - // to tries. The return value will only ever equal itself, and will not equal - // the return of any subsequent call of this function. - function OwnerID() {} - - // http://jsperf.com/copy-array-inline - function arrCopy(arr, offset) { - offset = offset || 0; - var len = Math.max(0, arr.length - offset); - var newArr = new Array(len); - for (var ii = 0; ii < len; ii++) { - newArr[ii] = arr[ii + offset]; - } - return newArr; - } - - function ensureSize(iter) { - if (iter.size === undefined) { - iter.size = iter.__iterate(returnTrue); - } - return iter.size; - } - - function wrapIndex(iter, index) { - // This implements "is array index" which the ECMAString spec defines as: - // - // A String property name P is an array index if and only if - // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal - // to 2^32−1. - // - // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects - if (typeof index !== 'number') { - var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32 - if ('' + uint32Index !== index || uint32Index === 4294967295) { - return NaN; - } - index = uint32Index; - } - return index < 0 ? ensureSize(iter) + index : index; - } - - function returnTrue() { - return true; - } - - function wholeSlice(begin, end, size) { - return (begin === 0 || (size !== undefined && begin <= -size)) && - (end === undefined || (size !== undefined && end >= size)); - } - - function resolveBegin(begin, size) { - return resolveIndex(begin, size, 0); - } - - function resolveEnd(end, size) { - return resolveIndex(end, size, size); - } - - function resolveIndex(index, size, defaultIndex) { - // Sanitize indices using this shorthand for ToInt32(argument) - // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 - return index === undefined ? - defaultIndex : - index < 0 ? - size === Infinity ? size : - Math.max(0, size + index) | 0 : - size === undefined || size === index ? - index : - Math.min(size, index) | 0; - } - - var ITERATE_KEYS = 0; - var ITERATE_VALUES = 1; - var ITERATE_ENTRIES = 2; - - var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; - - var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL; - - - function Iterator(next) { - this.next = next; - } - - Iterator.prototype.toString = function() { - return '[Iterator]'; - }; - - - Iterator.KEYS = ITERATE_KEYS; - Iterator.VALUES = ITERATE_VALUES; - Iterator.ENTRIES = ITERATE_ENTRIES; - - Iterator.prototype.inspect = - Iterator.prototype.toSource = function () { return this.toString(); } - Iterator.prototype[ITERATOR_SYMBOL] = function () { - return this; - }; - - - function iteratorValue(type, k, v, iteratorResult) { - var value = type === 0 ? k : type === 1 ? v : [k, v]; - iteratorResult ? (iteratorResult.value = value) : (iteratorResult = { - value: value, done: false - }); - return iteratorResult; - } - - function iteratorDone() { - return { value: undefined, done: true }; - } - - function hasIterator(maybeIterable) { - return !!getIteratorFn(maybeIterable); - } - - function isIterator(maybeIterator) { - return maybeIterator && typeof maybeIterator.next === 'function'; - } - - function getIterator(iterable) { - var iteratorFn = getIteratorFn(iterable); - return iteratorFn && iteratorFn.call(iterable); - } - - function getIteratorFn(iterable) { - var iteratorFn = iterable && ( - (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || - iterable[FAUX_ITERATOR_SYMBOL] - ); - if (typeof iteratorFn === 'function') { - return iteratorFn; - } - } - - function isArrayLike(value) { - return value && typeof value.length === 'number'; - } - - createClass(Seq, Iterable); - function Seq(value) { - return value === null || value === undefined ? emptySequence() : - isIterable(value) ? value.toSeq() : seqFromValue(value); - } - - Seq.of = function(/*...values*/) { - return Seq(arguments); - }; - - Seq.prototype.toSeq = function() { - return this; - }; - - Seq.prototype.toString = function() { - return this.__toString('Seq {', '}'); - }; - - Seq.prototype.cacheResult = function() { - if (!this._cache && this.__iterateUncached) { - this._cache = this.entrySeq().toArray(); - this.size = this._cache.length; - } - return this; - }; - - // abstract __iterateUncached(fn, reverse) - - Seq.prototype.__iterate = function(fn, reverse) { - var cache = this._cache; - if (cache) { - var size = cache.length; - var i = 0; - while (i !== size) { - var entry = cache[reverse ? size - ++i : i++]; - if (fn(entry[1], entry[0], this) === false) { - break; - } - } - return i; - } - return this.__iterateUncached(fn, reverse); - }; - - // abstract __iteratorUncached(type, reverse) - - Seq.prototype.__iterator = function(type, reverse) { - var cache = this._cache; - if (cache) { - var size = cache.length; - var i = 0; - return new Iterator(function() { - if (i === size) { - return iteratorDone(); - } - var entry = cache[reverse ? size - ++i : i++]; - return iteratorValue(type, entry[0], entry[1]); - }); - } - return this.__iteratorUncached(type, reverse); - }; - - - - createClass(KeyedSeq, Seq); - function KeyedSeq(value) { - return value === null || value === undefined ? - emptySequence().toKeyedSeq() : - isIterable(value) ? - (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) : - keyedSeqFromValue(value); - } - - KeyedSeq.prototype.toKeyedSeq = function() { - return this; - }; - - - - createClass(IndexedSeq, Seq); - function IndexedSeq(value) { - return value === null || value === undefined ? emptySequence() : - !isIterable(value) ? indexedSeqFromValue(value) : - isKeyed(value) ? value.entrySeq() : value.toIndexedSeq(); - } - - IndexedSeq.of = function(/*...values*/) { - return IndexedSeq(arguments); - }; - - IndexedSeq.prototype.toIndexedSeq = function() { - return this; - }; - - IndexedSeq.prototype.toString = function() { - return this.__toString('Seq [', ']'); - }; - - - - createClass(SetSeq, Seq); - function SetSeq(value) { - return ( - value === null || value === undefined ? emptySequence() : - !isIterable(value) ? indexedSeqFromValue(value) : - isKeyed(value) ? value.entrySeq() : value - ).toSetSeq(); - } - - SetSeq.of = function(/*...values*/) { - return SetSeq(arguments); - }; - - SetSeq.prototype.toSetSeq = function() { - return this; - }; - - - - Seq.isSeq = isSeq; - Seq.Keyed = KeyedSeq; - Seq.Set = SetSeq; - Seq.Indexed = IndexedSeq; - - var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; - - Seq.prototype[IS_SEQ_SENTINEL] = true; - - - - createClass(ArraySeq, IndexedSeq); - function ArraySeq(array) { - this._array = array; - this.size = array.length; - } - - ArraySeq.prototype.get = function(index, notSetValue) { - return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue; - }; - - ArraySeq.prototype.__iterate = function(fn, reverse) { - var array = this._array; - var size = array.length; - var i = 0; - while (i !== size) { - var ii = reverse ? size - ++i : i++; - if (fn(array[ii], ii, this) === false) { - break; - } - } - return i; - }; - - ArraySeq.prototype.__iterator = function(type, reverse) { - var array = this._array; - var size = array.length; - var i = 0; - return new Iterator(function() { - if (i === size) { - return iteratorDone(); - } - var ii = reverse ? size - ++i : i++; - return iteratorValue(type, ii, array[ii]); - }); - }; - - - - createClass(ObjectSeq, KeyedSeq); - function ObjectSeq(object) { - var keys = Object.keys(object); - this._object = object; - this._keys = keys; - this.size = keys.length; - } - - ObjectSeq.prototype.get = function(key, notSetValue) { - if (notSetValue !== undefined && !this.has(key)) { - return notSetValue; - } - return this._object[key]; - }; - - ObjectSeq.prototype.has = function(key) { - return this._object.hasOwnProperty(key); - }; - - ObjectSeq.prototype.__iterate = function(fn, reverse) { - var object = this._object; - var keys = this._keys; - var size = keys.length; - var i = 0; - while (i !== size) { - var key = keys[reverse ? size - ++i : i++]; - if (fn(object[key], key, this) === false) { - break; - } - } - return i; - }; - - ObjectSeq.prototype.__iterator = function(type, reverse) { - var object = this._object; - var keys = this._keys; - var size = keys.length; - var i = 0; - return new Iterator(function() { - if (i === size) { - return iteratorDone(); - } - var key = keys[reverse ? size - ++i : i++]; - return iteratorValue(type, key, object[key]); - }); - }; - - ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true; - - - createClass(IterableSeq, IndexedSeq); - function IterableSeq(iterable) { - this._iterable = iterable; - this.size = iterable.length || iterable.size; - } - - IterableSeq.prototype.__iterateUncached = function(fn, reverse) { - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterable = this._iterable; - var iterator = getIterator(iterable); - var iterations = 0; - if (isIterator(iterator)) { - var step; - while (!(step = iterator.next()).done) { - if (fn(step.value, iterations++, this) === false) { - break; - } - } - } - return iterations; - }; - - IterableSeq.prototype.__iteratorUncached = function(type, reverse) { - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterable = this._iterable; - var iterator = getIterator(iterable); - if (!isIterator(iterator)) { - return new Iterator(iteratorDone); - } - var iterations = 0; - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : iteratorValue(type, iterations++, step.value); - }); - }; - - - - createClass(IteratorSeq, IndexedSeq); - function IteratorSeq(iterator) { - this._iterator = iterator; - this._iteratorCache = []; - } - - IteratorSeq.prototype.__iterateUncached = function(fn, reverse) { - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterator = this._iterator; - var cache = this._iteratorCache; - var iterations = 0; - while (iterations < cache.length) { - if (fn(cache[iterations], iterations++, this) === false) { - return iterations; - } - } - var step; - while (!(step = iterator.next()).done) { - var val = step.value; - cache[iterations] = val; - if (fn(val, iterations++, this) === false) { - break; - } - } - return iterations; - }; - - IteratorSeq.prototype.__iteratorUncached = function(type, reverse) { - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = this._iterator; - var cache = this._iteratorCache; - var iterations = 0; - return new Iterator(function() { - if (iterations >= cache.length) { - var step = iterator.next(); - if (step.done) { - return step; - } - cache[iterations] = step.value; - } - return iteratorValue(type, iterations, cache[iterations++]); - }); - }; - - - - - // # pragma Helper functions - - function isSeq(maybeSeq) { - return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]); - } - - var EMPTY_SEQ; - - function emptySequence() { - return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([])); - } - - function keyedSeqFromValue(value) { - var seq = - Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : - isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : - hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : - typeof value === 'object' ? new ObjectSeq(value) : - undefined; - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of [k, v] entries, '+ - 'or keyed object: ' + value - ); - } - return seq; - } - - function indexedSeqFromValue(value) { - var seq = maybeIndexedSeqFromValue(value); - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of values: ' + value - ); - } - return seq; - } - - function seqFromValue(value) { - var seq = maybeIndexedSeqFromValue(value) || - (typeof value === 'object' && new ObjectSeq(value)); - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of values, or keyed object: ' + value - ); - } - return seq; - } - - function maybeIndexedSeqFromValue(value) { - return ( - isArrayLike(value) ? new ArraySeq(value) : - isIterator(value) ? new IteratorSeq(value) : - hasIterator(value) ? new IterableSeq(value) : - undefined - ); - } - - function fromJS(json, converter) { - return converter ? - fromJSWith(converter, json, '', {'': json}) : - fromJSDefault(json); - } - - function fromJSWith(converter, json, key, parentJSON) { - if (Array.isArray(json)) { - return converter.call(parentJSON, key, IndexedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); - } - if (isPlainObj(json)) { - return converter.call(parentJSON, key, KeyedSeq(json).map(function(v, k) {return fromJSWith(converter, v, k, json)})); - } - return json; - } - - function fromJSDefault(json) { - if (Array.isArray(json)) { - return IndexedSeq(json).map(fromJSDefault).toList(); - } - if (isPlainObj(json)) { - return KeyedSeq(json).map(fromJSDefault).toMap(); - } - return json; - } - - function isPlainObj(value) { - return value && (value.constructor === Object || value.constructor === undefined); - } - - /** - * An extension of the "same-value" algorithm as [described for use by ES6 Map - * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality) - * - * NaN is considered the same as NaN, however -0 and 0 are considered the same - * value, which is different from the algorithm described by - * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * This is extended further to allow Objects to describe the values they - * represent, by way of `valueOf` or `equals` (and `hashCode`). - * - * Note: because of this extension, the key equality of Immutable.Map and the - * value equality of Immutable.Set will differ from ES6 Map and Set. - * - * ### Defining custom values - * - * The easiest way to describe the value an object represents is by implementing - * `valueOf`. For example, `Date` represents a value by returning a unix - * timestamp for `valueOf`: - * - * var date1 = new Date(1234567890000); // Fri Feb 13 2009 ... - * var date2 = new Date(1234567890000); - * date1.valueOf(); // 1234567890000 - * assert( date1 !== date2 ); - * assert( Immutable.is( date1, date2 ) ); - * - * Note: overriding `valueOf` may have other implications if you use this object - * where JavaScript expects a primitive, such as implicit string coercion. - * - * For more complex types, especially collections, implementing `valueOf` may - * not be performant. An alternative is to implement `equals` and `hashCode`. - * - * `equals` takes another object, presumably of similar type, and returns true - * if it is equal. Equality is symmetrical, so the same result should be - * returned if this and the argument are flipped. - * - * assert( a.equals(b) === b.equals(a) ); - * - * `hashCode` returns a 32bit integer number representing the object which will - * be used to determine how to store the value object in a Map or Set. You must - * provide both or neither methods, one must not exist without the other. - * - * Also, an important relationship between these methods must be upheld: if two - * values are equal, they *must* return the same hashCode. If the values are not - * equal, they might have the same hashCode; this is called a hash collision, - * and while undesirable for performance reasons, it is acceptable. - * - * if (a.equals(b)) { - * assert( a.hashCode() === b.hashCode() ); - * } - * - * All Immutable collections implement `equals` and `hashCode`. - * - */ - function is(valueA, valueB) { - if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { - return true; - } - if (!valueA || !valueB) { - return false; - } - if (typeof valueA.valueOf === 'function' && - typeof valueB.valueOf === 'function') { - valueA = valueA.valueOf(); - valueB = valueB.valueOf(); - if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { - return true; - } - if (!valueA || !valueB) { - return false; - } - } - if (typeof valueA.equals === 'function' && - typeof valueB.equals === 'function' && - valueA.equals(valueB)) { - return true; - } - return false; - } - - function deepEqual(a, b) { - if (a === b) { - return true; - } - - if ( - !isIterable(b) || - a.size !== undefined && b.size !== undefined && a.size !== b.size || - a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || - isKeyed(a) !== isKeyed(b) || - isIndexed(a) !== isIndexed(b) || - isOrdered(a) !== isOrdered(b) - ) { - return false; - } - - if (a.size === 0 && b.size === 0) { - return true; - } - - var notAssociative = !isAssociative(a); - - if (isOrdered(a)) { - var entries = a.entries(); - return b.every(function(v, k) { - var entry = entries.next().value; - return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); - }) && entries.next().done; - } - - var flipped = false; - - if (a.size === undefined) { - if (b.size === undefined) { - if (typeof a.cacheResult === 'function') { - a.cacheResult(); - } - } else { - flipped = true; - var _ = a; - a = b; - b = _; - } - } - - var allEqual = true; - var bSize = b.__iterate(function(v, k) { - if (notAssociative ? !a.has(v) : - flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) { - allEqual = false; - return false; - } - }); - - return allEqual && a.size === bSize; - } - - createClass(Repeat, IndexedSeq); - - function Repeat(value, times) { - if (!(this instanceof Repeat)) { - return new Repeat(value, times); - } - this._value = value; - this.size = times === undefined ? Infinity : Math.max(0, times); - if (this.size === 0) { - if (EMPTY_REPEAT) { - return EMPTY_REPEAT; - } - EMPTY_REPEAT = this; - } - } - - Repeat.prototype.toString = function() { - if (this.size === 0) { - return 'Repeat []'; - } - return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]'; - }; - - Repeat.prototype.get = function(index, notSetValue) { - return this.has(index) ? this._value : notSetValue; - }; - - Repeat.prototype.includes = function(searchValue) { - return is(this._value, searchValue); - }; - - Repeat.prototype.slice = function(begin, end) { - var size = this.size; - return wholeSlice(begin, end, size) ? this : - new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size)); - }; - - Repeat.prototype.reverse = function() { - return this; - }; - - Repeat.prototype.indexOf = function(searchValue) { - if (is(this._value, searchValue)) { - return 0; - } - return -1; - }; - - Repeat.prototype.lastIndexOf = function(searchValue) { - if (is(this._value, searchValue)) { - return this.size; - } - return -1; - }; - - Repeat.prototype.__iterate = function(fn, reverse) { - var size = this.size; - var i = 0; - while (i !== size) { - if (fn(this._value, reverse ? size - ++i : i++, this) === false) { - break; - } - } - return i; - }; - - Repeat.prototype.__iterator = function(type, reverse) {var this$0 = this; - var size = this.size; - var i = 0; - return new Iterator(function() - {return i === size ? - iteratorDone() : - iteratorValue(type, reverse ? size - ++i : i++, this$0._value)} - ); - }; - - Repeat.prototype.equals = function(other) { - return other instanceof Repeat ? - is(this._value, other._value) : - deepEqual(other); - }; - - - var EMPTY_REPEAT; - - function invariant(condition, error) { - if (!condition) throw new Error(error); - } - - createClass(Range, IndexedSeq); - - function Range(start, end, step) { - if (!(this instanceof Range)) { - return new Range(start, end, step); - } - invariant(step !== 0, 'Cannot step a Range by 0'); - start = start || 0; - if (end === undefined) { - end = Infinity; - } - step = step === undefined ? 1 : Math.abs(step); - if (end < start) { - step = -step; - } - this._start = start; - this._end = end; - this._step = step; - this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1); - if (this.size === 0) { - if (EMPTY_RANGE) { - return EMPTY_RANGE; - } - EMPTY_RANGE = this; - } - } - - Range.prototype.toString = function() { - if (this.size === 0) { - return 'Range []'; - } - return 'Range [ ' + - this._start + '...' + this._end + - (this._step !== 1 ? ' by ' + this._step : '') + - ' ]'; - }; - - Range.prototype.get = function(index, notSetValue) { - return this.has(index) ? - this._start + wrapIndex(this, index) * this._step : - notSetValue; - }; - - Range.prototype.includes = function(searchValue) { - var possibleIndex = (searchValue - this._start) / this._step; - return possibleIndex >= 0 && - possibleIndex < this.size && - possibleIndex === Math.floor(possibleIndex); - }; - - Range.prototype.slice = function(begin, end) { - if (wholeSlice(begin, end, this.size)) { - return this; - } - begin = resolveBegin(begin, this.size); - end = resolveEnd(end, this.size); - if (end <= begin) { - return new Range(0, 0); - } - return new Range(this.get(begin, this._end), this.get(end, this._end), this._step); - }; - - Range.prototype.indexOf = function(searchValue) { - var offsetValue = searchValue - this._start; - if (offsetValue % this._step === 0) { - var index = offsetValue / this._step; - if (index >= 0 && index < this.size) { - return index - } - } - return -1; - }; - - Range.prototype.lastIndexOf = function(searchValue) { - return this.indexOf(searchValue); - }; - - Range.prototype.__iterate = function(fn, reverse) { - var size = this.size; - var step = this._step; - var value = reverse ? this._start + (size - 1) * step : this._start; - var i = 0; - while (i !== size) { - if (fn(value, reverse ? size - ++i : i++, this) === false) { - break; - } - value += reverse ? -step : step; - } - return i; - }; - - Range.prototype.__iterator = function(type, reverse) { - var size = this.size; - var step = this._step; - var value = reverse ? this._start + (size - 1) * step : this._start; - var i = 0; - return new Iterator(function() { - if (i === size) { - return iteratorDone(); - } - var v = value; - value += reverse ? -step : step; - return iteratorValue(type, reverse ? size - ++i : i++, v); - }); - }; - - Range.prototype.equals = function(other) { - return other instanceof Range ? - this._start === other._start && - this._end === other._end && - this._step === other._step : - deepEqual(this, other); - }; - - - var EMPTY_RANGE; - - createClass(Collection, Iterable); - function Collection() { - throw TypeError('Abstract'); - } - - - createClass(KeyedCollection, Collection);function KeyedCollection() {} - - createClass(IndexedCollection, Collection);function IndexedCollection() {} - - createClass(SetCollection, Collection);function SetCollection() {} - - - Collection.Keyed = KeyedCollection; - Collection.Indexed = IndexedCollection; - Collection.Set = SetCollection; - - function assertNotInfinite(size) { - invariant( - size !== Infinity, - 'Cannot perform this action with an infinite size.' - ); - } - - createClass(Map, KeyedCollection); - - // @pragma Construction - - function Map(value) { - return value === null || value === undefined ? emptyMap() : - isMap(value) && !isOrdered(value) ? value : - emptyMap().withMutations(function(map ) { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v, k) {return map.set(k, v)}); - }); - } - - Map.of = function() {var keyValues = SLICE$0.call(arguments, 0); - return emptyMap().withMutations(function(map ) { - for (var i = 0; i < keyValues.length; i += 2) { - if (i + 1 >= keyValues.length) { - throw new Error('Missing value for key: ' + keyValues[i]); - } - map.set(keyValues[i], keyValues[i + 1]); - } - }); - }; - - Map.prototype.toString = function() { - return this.__toString('Map {', '}'); - }; - - // @pragma Access - - Map.prototype.get = function(k, notSetValue) { - return this._root ? - this._root.get(0, undefined, k, notSetValue) : - notSetValue; - }; - - // @pragma Modification - - Map.prototype.set = function(k, v) { - return updateMap(this, k, v); - }; - - Map.prototype.setIn = function(keyPath, v) { - return this.updateIn(keyPath, NOT_SET, function() {return v}); - }; - - Map.prototype.remove = function(k) { - return updateMap(this, k, NOT_SET); - }; - - Map.prototype.deleteIn = function(keyPath) { - return this.updateIn(keyPath, function() {return NOT_SET}); - }; - - Map.prototype.deleteAll = function(keys) { - var iterable = Iterable(keys); - - if (iterable.size === 0) { - return this; - } - - return this.withMutations(function(map ) { - iterable.forEach(function(key ) {return map.remove(key)}); - }); - }; - - Map.prototype.update = function(k, notSetValue, updater) { - return arguments.length === 1 ? - k(this) : - this.updateIn([k], notSetValue, updater); - }; - - Map.prototype.updateIn = function(keyPath, notSetValue, updater) { - if (!updater) { - updater = notSetValue; - notSetValue = undefined; - } - var updatedValue = updateInDeepMap( - this, - forceIterator(keyPath), - notSetValue, - updater - ); - return updatedValue === NOT_SET ? notSetValue : updatedValue; - }; - - Map.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._root = null; - this.__hash = undefined; - this.__altered = true; - return this; - } - return emptyMap(); - }; - - // @pragma Composition - - Map.prototype.merge = function(/*...iters*/) { - return mergeIntoMapWith(this, undefined, arguments); - }; - - Map.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoMapWith(this, merger, iters); - }; - - Map.prototype.mergeIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); - return this.updateIn( - keyPath, - emptyMap(), - function(m ) {return typeof m.merge === 'function' ? - m.merge.apply(m, iters) : - iters[iters.length - 1]} - ); - }; - - Map.prototype.mergeDeep = function(/*...iters*/) { - return mergeIntoMapWith(this, deepMerger, arguments); - }; - - Map.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoMapWith(this, deepMergerWith(merger), iters); - }; - - Map.prototype.mergeDeepIn = function(keyPath) {var iters = SLICE$0.call(arguments, 1); - return this.updateIn( - keyPath, - emptyMap(), - function(m ) {return typeof m.mergeDeep === 'function' ? - m.mergeDeep.apply(m, iters) : - iters[iters.length - 1]} - ); - }; - - Map.prototype.sort = function(comparator) { - // Late binding - return OrderedMap(sortFactory(this, comparator)); - }; - - Map.prototype.sortBy = function(mapper, comparator) { - // Late binding - return OrderedMap(sortFactory(this, comparator, mapper)); - }; - - // @pragma Mutability - - Map.prototype.withMutations = function(fn) { - var mutable = this.asMutable(); - fn(mutable); - return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this; - }; - - Map.prototype.asMutable = function() { - return this.__ownerID ? this : this.__ensureOwner(new OwnerID()); - }; - - Map.prototype.asImmutable = function() { - return this.__ensureOwner(); - }; - - Map.prototype.wasAltered = function() { - return this.__altered; - }; - - Map.prototype.__iterator = function(type, reverse) { - return new MapIterator(this, type, reverse); - }; - - Map.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var iterations = 0; - this._root && this._root.iterate(function(entry ) { - iterations++; - return fn(entry[1], entry[0], this$0); - }, reverse); - return iterations; - }; - - Map.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - if (!ownerID) { - this.__ownerID = ownerID; - this.__altered = false; - return this; - } - return makeMap(this.size, this._root, ownerID, this.__hash); - }; - - - function isMap(maybeMap) { - return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]); - } - - Map.isMap = isMap; - - var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; - - var MapPrototype = Map.prototype; - MapPrototype[IS_MAP_SENTINEL] = true; - MapPrototype[DELETE] = MapPrototype.remove; - MapPrototype.removeIn = MapPrototype.deleteIn; - MapPrototype.removeAll = MapPrototype.deleteAll; - - - // #pragma Trie Nodes - - - - function ArrayMapNode(ownerID, entries) { - this.ownerID = ownerID; - this.entries = entries; - } - - ArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { - var entries = this.entries; - for (var ii = 0, len = entries.length; ii < len; ii++) { - if (is(key, entries[ii][0])) { - return entries[ii][1]; - } - } - return notSetValue; - }; - - ArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - var removed = value === NOT_SET; - - var entries = this.entries; - var idx = 0; - for (var len = entries.length; idx < len; idx++) { - if (is(key, entries[idx][0])) { - break; - } - } - var exists = idx < len; - - if (exists ? entries[idx][1] === value : removed) { - return this; - } - - SetRef(didAlter); - (removed || !exists) && SetRef(didChangeSize); - - if (removed && entries.length === 1) { - return; // undefined - } - - if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) { - return createNodes(ownerID, entries, key, value); - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newEntries = isEditable ? entries : arrCopy(entries); - - if (exists) { - if (removed) { - idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); - } else { - newEntries[idx] = [key, value]; - } - } else { - newEntries.push([key, value]); - } - - if (isEditable) { - this.entries = newEntries; - return this; - } - - return new ArrayMapNode(ownerID, newEntries); - }; - - - - - function BitmapIndexedNode(ownerID, bitmap, nodes) { - this.ownerID = ownerID; - this.bitmap = bitmap; - this.nodes = nodes; - } - - BitmapIndexedNode.prototype.get = function(shift, keyHash, key, notSetValue) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK)); - var bitmap = this.bitmap; - return (bitmap & bit) === 0 ? notSetValue : - this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue); - }; - - BitmapIndexedNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var bit = 1 << keyHashFrag; - var bitmap = this.bitmap; - var exists = (bitmap & bit) !== 0; - - if (!exists && value === NOT_SET) { - return this; - } - - var idx = popCount(bitmap & (bit - 1)); - var nodes = this.nodes; - var node = exists ? nodes[idx] : undefined; - var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); - - if (newNode === node) { - return this; - } - - if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) { - return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode); - } - - if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) { - return nodes[idx ^ 1]; - } - - if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) { - return newNode; - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit; - var newNodes = exists ? newNode ? - setIn(nodes, idx, newNode, isEditable) : - spliceOut(nodes, idx, isEditable) : - spliceIn(nodes, idx, newNode, isEditable); - - if (isEditable) { - this.bitmap = newBitmap; - this.nodes = newNodes; - return this; - } - - return new BitmapIndexedNode(ownerID, newBitmap, newNodes); - }; - - - - - function HashArrayMapNode(ownerID, count, nodes) { - this.ownerID = ownerID; - this.count = count; - this.nodes = nodes; - } - - HashArrayMapNode.prototype.get = function(shift, keyHash, key, notSetValue) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var node = this.nodes[idx]; - return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue; - }; - - HashArrayMapNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var removed = value === NOT_SET; - var nodes = this.nodes; - var node = nodes[idx]; - - if (removed && !node) { - return this; - } - - var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); - if (newNode === node) { - return this; - } - - var newCount = this.count; - if (!node) { - newCount++; - } else if (!newNode) { - newCount--; - if (newCount < MIN_HASH_ARRAY_MAP_SIZE) { - return packNodes(ownerID, nodes, newCount, idx); - } - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newNodes = setIn(nodes, idx, newNode, isEditable); - - if (isEditable) { - this.count = newCount; - this.nodes = newNodes; - return this; - } - - return new HashArrayMapNode(ownerID, newCount, newNodes); - }; - - - - - function HashCollisionNode(ownerID, keyHash, entries) { - this.ownerID = ownerID; - this.keyHash = keyHash; - this.entries = entries; - } - - HashCollisionNode.prototype.get = function(shift, keyHash, key, notSetValue) { - var entries = this.entries; - for (var ii = 0, len = entries.length; ii < len; ii++) { - if (is(key, entries[ii][0])) { - return entries[ii][1]; - } - } - return notSetValue; - }; - - HashCollisionNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (keyHash === undefined) { - keyHash = hash(key); - } - - var removed = value === NOT_SET; - - if (keyHash !== this.keyHash) { - if (removed) { - return this; - } - SetRef(didAlter); - SetRef(didChangeSize); - return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]); - } - - var entries = this.entries; - var idx = 0; - for (var len = entries.length; idx < len; idx++) { - if (is(key, entries[idx][0])) { - break; - } - } - var exists = idx < len; - - if (exists ? entries[idx][1] === value : removed) { - return this; - } - - SetRef(didAlter); - (removed || !exists) && SetRef(didChangeSize); - - if (removed && len === 2) { - return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]); - } - - var isEditable = ownerID && ownerID === this.ownerID; - var newEntries = isEditable ? entries : arrCopy(entries); - - if (exists) { - if (removed) { - idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); - } else { - newEntries[idx] = [key, value]; - } - } else { - newEntries.push([key, value]); - } - - if (isEditable) { - this.entries = newEntries; - return this; - } - - return new HashCollisionNode(ownerID, this.keyHash, newEntries); - }; - - - - - function ValueNode(ownerID, keyHash, entry) { - this.ownerID = ownerID; - this.keyHash = keyHash; - this.entry = entry; - } - - ValueNode.prototype.get = function(shift, keyHash, key, notSetValue) { - return is(key, this.entry[0]) ? this.entry[1] : notSetValue; - }; - - ValueNode.prototype.update = function(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - var removed = value === NOT_SET; - var keyMatch = is(key, this.entry[0]); - if (keyMatch ? value === this.entry[1] : removed) { - return this; - } - - SetRef(didAlter); - - if (removed) { - SetRef(didChangeSize); - return; // undefined - } - - if (keyMatch) { - if (ownerID && ownerID === this.ownerID) { - this.entry[1] = value; - return this; - } - return new ValueNode(ownerID, this.keyHash, [key, value]); - } - - SetRef(didChangeSize); - return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]); - }; - - - - // #pragma Iterators - - ArrayMapNode.prototype.iterate = - HashCollisionNode.prototype.iterate = function (fn, reverse) { - var entries = this.entries; - for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) { - if (fn(entries[reverse ? maxIndex - ii : ii]) === false) { - return false; - } - } - } - - BitmapIndexedNode.prototype.iterate = - HashArrayMapNode.prototype.iterate = function (fn, reverse) { - var nodes = this.nodes; - for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) { - var node = nodes[reverse ? maxIndex - ii : ii]; - if (node && node.iterate(fn, reverse) === false) { - return false; - } - } - } - - ValueNode.prototype.iterate = function (fn, reverse) { - return fn(this.entry); - } - - createClass(MapIterator, Iterator); - - function MapIterator(map, type, reverse) { - this._type = type; - this._reverse = reverse; - this._stack = map._root && mapIteratorFrame(map._root); - } - - MapIterator.prototype.next = function() { - var type = this._type; - var stack = this._stack; - while (stack) { - var node = stack.node; - var index = stack.index++; - var maxIndex; - if (node.entry) { - if (index === 0) { - return mapIteratorValue(type, node.entry); - } - } else if (node.entries) { - maxIndex = node.entries.length - 1; - if (index <= maxIndex) { - return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]); - } - } else { - maxIndex = node.nodes.length - 1; - if (index <= maxIndex) { - var subNode = node.nodes[this._reverse ? maxIndex - index : index]; - if (subNode) { - if (subNode.entry) { - return mapIteratorValue(type, subNode.entry); - } - stack = this._stack = mapIteratorFrame(subNode, stack); - } - continue; - } - } - stack = this._stack = this._stack.__prev; - } - return iteratorDone(); - }; - - - function mapIteratorValue(type, entry) { - return iteratorValue(type, entry[0], entry[1]); - } - - function mapIteratorFrame(node, prev) { - return { - node: node, - index: 0, - __prev: prev - }; - } - - function makeMap(size, root, ownerID, hash) { - var map = Object.create(MapPrototype); - map.size = size; - map._root = root; - map.__ownerID = ownerID; - map.__hash = hash; - map.__altered = false; - return map; - } - - var EMPTY_MAP; - function emptyMap() { - return EMPTY_MAP || (EMPTY_MAP = makeMap(0)); - } - - function updateMap(map, k, v) { - var newRoot; - var newSize; - if (!map._root) { - if (v === NOT_SET) { - return map; - } - newSize = 1; - newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]); - } else { - var didChangeSize = MakeRef(CHANGE_LENGTH); - var didAlter = MakeRef(DID_ALTER); - newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter); - if (!didAlter.value) { - return map; - } - newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0); - } - if (map.__ownerID) { - map.size = newSize; - map._root = newRoot; - map.__hash = undefined; - map.__altered = true; - return map; - } - return newRoot ? makeMap(newSize, newRoot) : emptyMap(); - } - - function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - if (!node) { - if (value === NOT_SET) { - return node; - } - SetRef(didAlter); - SetRef(didChangeSize); - return new ValueNode(ownerID, keyHash, [key, value]); - } - return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter); - } - - function isLeafNode(node) { - return node.constructor === ValueNode || node.constructor === HashCollisionNode; - } - - function mergeIntoNode(node, ownerID, shift, keyHash, entry) { - if (node.keyHash === keyHash) { - return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]); - } - - var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK; - var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - - var newNode; - var nodes = idx1 === idx2 ? - [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : - ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]); - - return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes); - } - - function createNodes(ownerID, entries, key, value) { - if (!ownerID) { - ownerID = new OwnerID(); - } - var node = new ValueNode(ownerID, hash(key), [key, value]); - for (var ii = 0; ii < entries.length; ii++) { - var entry = entries[ii]; - node = node.update(ownerID, 0, undefined, entry[0], entry[1]); - } - return node; - } - - function packNodes(ownerID, nodes, count, excluding) { - var bitmap = 0; - var packedII = 0; - var packedNodes = new Array(count); - for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) { - var node = nodes[ii]; - if (node !== undefined && ii !== excluding) { - bitmap |= bit; - packedNodes[packedII++] = node; - } - } - return new BitmapIndexedNode(ownerID, bitmap, packedNodes); - } - - function expandNodes(ownerID, nodes, bitmap, including, node) { - var count = 0; - var expandedNodes = new Array(SIZE); - for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) { - expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined; - } - expandedNodes[including] = node; - return new HashArrayMapNode(ownerID, count + 1, expandedNodes); - } - - function mergeIntoMapWith(map, merger, iterables) { - var iters = []; - for (var ii = 0; ii < iterables.length; ii++) { - var value = iterables[ii]; - var iter = KeyedIterable(value); - if (!isIterable(value)) { - iter = iter.map(function(v ) {return fromJS(v)}); - } - iters.push(iter); - } - return mergeIntoCollectionWith(map, merger, iters); - } - - function deepMerger(existing, value, key) { - return existing && existing.mergeDeep && isIterable(value) ? - existing.mergeDeep(value) : - is(existing, value) ? existing : value; - } - - function deepMergerWith(merger) { - return function(existing, value, key) { - if (existing && existing.mergeDeepWith && isIterable(value)) { - return existing.mergeDeepWith(merger, value); - } - var nextValue = merger(existing, value, key); - return is(existing, nextValue) ? existing : nextValue; - }; - } - - function mergeIntoCollectionWith(collection, merger, iters) { - iters = iters.filter(function(x ) {return x.size !== 0}); - if (iters.length === 0) { - return collection; - } - if (collection.size === 0 && !collection.__ownerID && iters.length === 1) { - return collection.constructor(iters[0]); - } - return collection.withMutations(function(collection ) { - var mergeIntoMap = merger ? - function(value, key) { - collection.update(key, NOT_SET, function(existing ) - {return existing === NOT_SET ? value : merger(existing, value, key)} - ); - } : - function(value, key) { - collection.set(key, value); - } - for (var ii = 0; ii < iters.length; ii++) { - iters[ii].forEach(mergeIntoMap); - } - }); - } - - function updateInDeepMap(existing, keyPathIter, notSetValue, updater) { - var isNotSet = existing === NOT_SET; - var step = keyPathIter.next(); - if (step.done) { - var existingValue = isNotSet ? notSetValue : existing; - var newValue = updater(existingValue); - return newValue === existingValue ? existing : newValue; - } - invariant( - isNotSet || (existing && existing.set), - 'invalid keyPath' - ); - var key = step.value; - var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET); - var nextUpdated = updateInDeepMap( - nextExisting, - keyPathIter, - notSetValue, - updater - ); - return nextUpdated === nextExisting ? existing : - nextUpdated === NOT_SET ? existing.remove(key) : - (isNotSet ? emptyMap() : existing).set(key, nextUpdated); - } - - function popCount(x) { - x = x - ((x >> 1) & 0x55555555); - x = (x & 0x33333333) + ((x >> 2) & 0x33333333); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = x + (x >> 8); - x = x + (x >> 16); - return x & 0x7f; - } - - function setIn(array, idx, val, canEdit) { - var newArray = canEdit ? array : arrCopy(array); - newArray[idx] = val; - return newArray; - } - - function spliceIn(array, idx, val, canEdit) { - var newLen = array.length + 1; - if (canEdit && idx + 1 === newLen) { - array[idx] = val; - return array; - } - var newArray = new Array(newLen); - var after = 0; - for (var ii = 0; ii < newLen; ii++) { - if (ii === idx) { - newArray[ii] = val; - after = -1; - } else { - newArray[ii] = array[ii + after]; - } - } - return newArray; - } - - function spliceOut(array, idx, canEdit) { - var newLen = array.length - 1; - if (canEdit && idx === newLen) { - array.pop(); - return array; - } - var newArray = new Array(newLen); - var after = 0; - for (var ii = 0; ii < newLen; ii++) { - if (ii === idx) { - after = 1; - } - newArray[ii] = array[ii + after]; - } - return newArray; - } - - var MAX_ARRAY_MAP_SIZE = SIZE / 4; - var MAX_BITMAP_INDEXED_SIZE = SIZE / 2; - var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4; - - createClass(List, IndexedCollection); - - // @pragma Construction - - function List(value) { - var empty = emptyList(); - if (value === null || value === undefined) { - return empty; - } - if (isList(value)) { - return value; - } - var iter = IndexedIterable(value); - var size = iter.size; - if (size === 0) { - return empty; - } - assertNotInfinite(size); - if (size > 0 && size < SIZE) { - return makeList(0, size, SHIFT, null, new VNode(iter.toArray())); - } - return empty.withMutations(function(list ) { - list.setSize(size); - iter.forEach(function(v, i) {return list.set(i, v)}); - }); - } - - List.of = function(/*...values*/) { - return this(arguments); - }; - - List.prototype.toString = function() { - return this.__toString('List [', ']'); - }; - - // @pragma Access - - List.prototype.get = function(index, notSetValue) { - index = wrapIndex(this, index); - if (index >= 0 && index < this.size) { - index += this._origin; - var node = listNodeFor(this, index); - return node && node.array[index & MASK]; - } - return notSetValue; - }; - - // @pragma Modification - - List.prototype.set = function(index, value) { - return updateList(this, index, value); - }; - - List.prototype.remove = function(index) { - return !this.has(index) ? this : - index === 0 ? this.shift() : - index === this.size - 1 ? this.pop() : - this.splice(index, 1); - }; - - List.prototype.insert = function(index, value) { - return this.splice(index, 0, value); - }; - - List.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = this._origin = this._capacity = 0; - this._level = SHIFT; - this._root = this._tail = null; - this.__hash = undefined; - this.__altered = true; - return this; - } - return emptyList(); - }; - - List.prototype.push = function(/*...values*/) { - var values = arguments; - var oldSize = this.size; - return this.withMutations(function(list ) { - setListBounds(list, 0, oldSize + values.length); - for (var ii = 0; ii < values.length; ii++) { - list.set(oldSize + ii, values[ii]); - } - }); - }; - - List.prototype.pop = function() { - return setListBounds(this, 0, -1); - }; - - List.prototype.unshift = function(/*...values*/) { - var values = arguments; - return this.withMutations(function(list ) { - setListBounds(list, -values.length); - for (var ii = 0; ii < values.length; ii++) { - list.set(ii, values[ii]); - } - }); - }; - - List.prototype.shift = function() { - return setListBounds(this, 1); - }; - - // @pragma Composition - - List.prototype.merge = function(/*...iters*/) { - return mergeIntoListWith(this, undefined, arguments); - }; - - List.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoListWith(this, merger, iters); - }; - - List.prototype.mergeDeep = function(/*...iters*/) { - return mergeIntoListWith(this, deepMerger, arguments); - }; - - List.prototype.mergeDeepWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return mergeIntoListWith(this, deepMergerWith(merger), iters); - }; - - List.prototype.setSize = function(size) { - return setListBounds(this, 0, size); - }; - - // @pragma Iteration - - List.prototype.slice = function(begin, end) { - var size = this.size; - if (wholeSlice(begin, end, size)) { - return this; - } - return setListBounds( - this, - resolveBegin(begin, size), - resolveEnd(end, size) - ); - }; - - List.prototype.__iterator = function(type, reverse) { - var index = reverse ? this.size : 0; - var values = iterateList(this, reverse); - return new Iterator(function() { - var value = values(); - return value === DONE ? - iteratorDone() : - iteratorValue(type, reverse ? --index : index++, value); - }); - }; - - List.prototype.__iterate = function(fn, reverse) { - var index = reverse ? this.size : 0; - var values = iterateList(this, reverse); - var value; - while ((value = values()) !== DONE) { - if (fn(value, reverse ? --index : index++, this) === false) { - break; - } - } - return index; - }; - - List.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - if (!ownerID) { - this.__ownerID = ownerID; - return this; - } - return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash); - }; - - - function isList(maybeList) { - return !!(maybeList && maybeList[IS_LIST_SENTINEL]); - } - - List.isList = isList; - - var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; - - var ListPrototype = List.prototype; - ListPrototype[IS_LIST_SENTINEL] = true; - ListPrototype[DELETE] = ListPrototype.remove; - ListPrototype.setIn = MapPrototype.setIn; - ListPrototype.deleteIn = - ListPrototype.removeIn = MapPrototype.removeIn; - ListPrototype.update = MapPrototype.update; - ListPrototype.updateIn = MapPrototype.updateIn; - ListPrototype.mergeIn = MapPrototype.mergeIn; - ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; - ListPrototype.withMutations = MapPrototype.withMutations; - ListPrototype.asMutable = MapPrototype.asMutable; - ListPrototype.asImmutable = MapPrototype.asImmutable; - ListPrototype.wasAltered = MapPrototype.wasAltered; - - - - function VNode(array, ownerID) { - this.array = array; - this.ownerID = ownerID; - } - - // TODO: seems like these methods are very similar - - VNode.prototype.removeBefore = function(ownerID, level, index) { - if (index === level ? 1 << level : 0 || this.array.length === 0) { - return this; - } - var originIndex = (index >>> level) & MASK; - if (originIndex >= this.array.length) { - return new VNode([], ownerID); - } - var removingFirst = originIndex === 0; - var newChild; - if (level > 0) { - var oldChild = this.array[originIndex]; - newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index); - if (newChild === oldChild && removingFirst) { - return this; - } - } - if (removingFirst && !newChild) { - return this; - } - var editable = editableVNode(this, ownerID); - if (!removingFirst) { - for (var ii = 0; ii < originIndex; ii++) { - editable.array[ii] = undefined; - } - } - if (newChild) { - editable.array[originIndex] = newChild; - } - return editable; - }; - - VNode.prototype.removeAfter = function(ownerID, level, index) { - if (index === (level ? 1 << level : 0) || this.array.length === 0) { - return this; - } - var sizeIndex = ((index - 1) >>> level) & MASK; - if (sizeIndex >= this.array.length) { - return this; - } - - var newChild; - if (level > 0) { - var oldChild = this.array[sizeIndex]; - newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index); - if (newChild === oldChild && sizeIndex === this.array.length - 1) { - return this; - } - } - - var editable = editableVNode(this, ownerID); - editable.array.splice(sizeIndex + 1); - if (newChild) { - editable.array[sizeIndex] = newChild; - } - return editable; - }; - - - - var DONE = {}; - - function iterateList(list, reverse) { - var left = list._origin; - var right = list._capacity; - var tailPos = getTailOffset(right); - var tail = list._tail; - - return iterateNodeOrLeaf(list._root, list._level, 0); - - function iterateNodeOrLeaf(node, level, offset) { - return level === 0 ? - iterateLeaf(node, offset) : - iterateNode(node, level, offset); - } - - function iterateLeaf(node, offset) { - var array = offset === tailPos ? tail && tail.array : node && node.array; - var from = offset > left ? 0 : left - offset; - var to = right - offset; - if (to > SIZE) { - to = SIZE; - } - return function() { - if (from === to) { - return DONE; - } - var idx = reverse ? --to : from++; - return array && array[idx]; - }; - } - - function iterateNode(node, level, offset) { - var values; - var array = node && node.array; - var from = offset > left ? 0 : (left - offset) >> level; - var to = ((right - offset) >> level) + 1; - if (to > SIZE) { - to = SIZE; - } - return function() { - do { - if (values) { - var value = values(); - if (value !== DONE) { - return value; - } - values = null; - } - if (from === to) { - return DONE; - } - var idx = reverse ? --to : from++; - values = iterateNodeOrLeaf( - array && array[idx], level - SHIFT, offset + (idx << level) - ); - } while (true); - }; - } - } - - function makeList(origin, capacity, level, root, tail, ownerID, hash) { - var list = Object.create(ListPrototype); - list.size = capacity - origin; - list._origin = origin; - list._capacity = capacity; - list._level = level; - list._root = root; - list._tail = tail; - list.__ownerID = ownerID; - list.__hash = hash; - list.__altered = false; - return list; - } - - var EMPTY_LIST; - function emptyList() { - return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT)); - } - - function updateList(list, index, value) { - index = wrapIndex(list, index); - - if (index !== index) { - return list; - } - - if (index >= list.size || index < 0) { - return list.withMutations(function(list ) { - index < 0 ? - setListBounds(list, index).set(0, value) : - setListBounds(list, 0, index + 1).set(index, value) - }); - } - - index += list._origin; - - var newTail = list._tail; - var newRoot = list._root; - var didAlter = MakeRef(DID_ALTER); - if (index >= getTailOffset(list._capacity)) { - newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter); - } else { - newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter); - } - - if (!didAlter.value) { - return list; - } - - if (list.__ownerID) { - list._root = newRoot; - list._tail = newTail; - list.__hash = undefined; - list.__altered = true; - return list; - } - return makeList(list._origin, list._capacity, list._level, newRoot, newTail); - } - - function updateVNode(node, ownerID, level, index, value, didAlter) { - var idx = (index >>> level) & MASK; - var nodeHas = node && idx < node.array.length; - if (!nodeHas && value === undefined) { - return node; - } - - var newNode; - - if (level > 0) { - var lowerNode = node && node.array[idx]; - var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter); - if (newLowerNode === lowerNode) { - return node; - } - newNode = editableVNode(node, ownerID); - newNode.array[idx] = newLowerNode; - return newNode; - } - - if (nodeHas && node.array[idx] === value) { - return node; - } - - SetRef(didAlter); - - newNode = editableVNode(node, ownerID); - if (value === undefined && idx === newNode.array.length - 1) { - newNode.array.pop(); - } else { - newNode.array[idx] = value; - } - return newNode; - } - - function editableVNode(node, ownerID) { - if (ownerID && node && ownerID === node.ownerID) { - return node; - } - return new VNode(node ? node.array.slice() : [], ownerID); - } - - function listNodeFor(list, rawIndex) { - if (rawIndex >= getTailOffset(list._capacity)) { - return list._tail; - } - if (rawIndex < 1 << (list._level + SHIFT)) { - var node = list._root; - var level = list._level; - while (node && level > 0) { - node = node.array[(rawIndex >>> level) & MASK]; - level -= SHIFT; - } - return node; - } - } - - function setListBounds(list, begin, end) { - // Sanitize begin & end using this shorthand for ToInt32(argument) - // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 - if (begin !== undefined) { - begin = begin | 0; - } - if (end !== undefined) { - end = end | 0; - } - var owner = list.__ownerID || new OwnerID(); - var oldOrigin = list._origin; - var oldCapacity = list._capacity; - var newOrigin = oldOrigin + begin; - var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end; - if (newOrigin === oldOrigin && newCapacity === oldCapacity) { - return list; - } - - // If it's going to end after it starts, it's empty. - if (newOrigin >= newCapacity) { - return list.clear(); - } - - var newLevel = list._level; - var newRoot = list._root; - - // New origin might need creating a higher root. - var offsetShift = 0; - while (newOrigin + offsetShift < 0) { - newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner); - newLevel += SHIFT; - offsetShift += 1 << newLevel; - } - if (offsetShift) { - newOrigin += offsetShift; - oldOrigin += offsetShift; - newCapacity += offsetShift; - oldCapacity += offsetShift; - } - - var oldTailOffset = getTailOffset(oldCapacity); - var newTailOffset = getTailOffset(newCapacity); - - // New size might need creating a higher root. - while (newTailOffset >= 1 << (newLevel + SHIFT)) { - newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner); - newLevel += SHIFT; - } - - // Locate or create the new tail. - var oldTail = list._tail; - var newTail = newTailOffset < oldTailOffset ? - listNodeFor(list, newCapacity - 1) : - newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail; - - // Merge Tail into tree. - if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) { - newRoot = editableVNode(newRoot, owner); - var node = newRoot; - for (var level = newLevel; level > SHIFT; level -= SHIFT) { - var idx = (oldTailOffset >>> level) & MASK; - node = node.array[idx] = editableVNode(node.array[idx], owner); - } - node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail; - } - - // If the size has been reduced, there's a chance the tail needs to be trimmed. - if (newCapacity < oldCapacity) { - newTail = newTail && newTail.removeAfter(owner, 0, newCapacity); - } - - // If the new origin is within the tail, then we do not need a root. - if (newOrigin >= newTailOffset) { - newOrigin -= newTailOffset; - newCapacity -= newTailOffset; - newLevel = SHIFT; - newRoot = null; - newTail = newTail && newTail.removeBefore(owner, 0, newOrigin); - - // Otherwise, if the root has been trimmed, garbage collect. - } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) { - offsetShift = 0; - - // Identify the new top root node of the subtree of the old root. - while (newRoot) { - var beginIndex = (newOrigin >>> newLevel) & MASK; - if (beginIndex !== (newTailOffset >>> newLevel) & MASK) { - break; - } - if (beginIndex) { - offsetShift += (1 << newLevel) * beginIndex; - } - newLevel -= SHIFT; - newRoot = newRoot.array[beginIndex]; - } - - // Trim the new sides of the new root. - if (newRoot && newOrigin > oldOrigin) { - newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift); - } - if (newRoot && newTailOffset < oldTailOffset) { - newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift); - } - if (offsetShift) { - newOrigin -= offsetShift; - newCapacity -= offsetShift; - } - } - - if (list.__ownerID) { - list.size = newCapacity - newOrigin; - list._origin = newOrigin; - list._capacity = newCapacity; - list._level = newLevel; - list._root = newRoot; - list._tail = newTail; - list.__hash = undefined; - list.__altered = true; - return list; - } - return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail); - } - - function mergeIntoListWith(list, merger, iterables) { - var iters = []; - var maxSize = 0; - for (var ii = 0; ii < iterables.length; ii++) { - var value = iterables[ii]; - var iter = IndexedIterable(value); - if (iter.size > maxSize) { - maxSize = iter.size; - } - if (!isIterable(value)) { - iter = iter.map(function(v ) {return fromJS(v)}); - } - iters.push(iter); - } - if (maxSize > list.size) { - list = list.setSize(maxSize); - } - return mergeIntoCollectionWith(list, merger, iters); - } - - function getTailOffset(size) { - return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT); - } - - createClass(OrderedMap, Map); - - // @pragma Construction - - function OrderedMap(value) { - return value === null || value === undefined ? emptyOrderedMap() : - isOrderedMap(value) ? value : - emptyOrderedMap().withMutations(function(map ) { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v, k) {return map.set(k, v)}); - }); - } - - OrderedMap.of = function(/*...values*/) { - return this(arguments); - }; - - OrderedMap.prototype.toString = function() { - return this.__toString('OrderedMap {', '}'); - }; - - // @pragma Access - - OrderedMap.prototype.get = function(k, notSetValue) { - var index = this._map.get(k); - return index !== undefined ? this._list.get(index)[1] : notSetValue; - }; - - // @pragma Modification - - OrderedMap.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._map.clear(); - this._list.clear(); - return this; - } - return emptyOrderedMap(); - }; - - OrderedMap.prototype.set = function(k, v) { - return updateOrderedMap(this, k, v); - }; - - OrderedMap.prototype.remove = function(k) { - return updateOrderedMap(this, k, NOT_SET); - }; - - OrderedMap.prototype.wasAltered = function() { - return this._map.wasAltered() || this._list.wasAltered(); - }; - - OrderedMap.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._list.__iterate( - function(entry ) {return entry && fn(entry[1], entry[0], this$0)}, - reverse - ); - }; - - OrderedMap.prototype.__iterator = function(type, reverse) { - return this._list.fromEntrySeq().__iterator(type, reverse); - }; - - OrderedMap.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - var newMap = this._map.__ensureOwner(ownerID); - var newList = this._list.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - this._list = newList; - return this; - } - return makeOrderedMap(newMap, newList, ownerID, this.__hash); - }; - - - function isOrderedMap(maybeOrderedMap) { - return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); - } - - OrderedMap.isOrderedMap = isOrderedMap; - - OrderedMap.prototype[IS_ORDERED_SENTINEL] = true; - OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove; - - - - function makeOrderedMap(map, list, ownerID, hash) { - var omap = Object.create(OrderedMap.prototype); - omap.size = map ? map.size : 0; - omap._map = map; - omap._list = list; - omap.__ownerID = ownerID; - omap.__hash = hash; - return omap; - } - - var EMPTY_ORDERED_MAP; - function emptyOrderedMap() { - return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())); - } - - function updateOrderedMap(omap, k, v) { - var map = omap._map; - var list = omap._list; - var i = map.get(k); - var has = i !== undefined; - var newMap; - var newList; - if (v === NOT_SET) { // removed - if (!has) { - return omap; - } - if (list.size >= SIZE && list.size >= map.size * 2) { - newList = list.filter(function(entry, idx) {return entry !== undefined && i !== idx}); - newMap = newList.toKeyedSeq().map(function(entry ) {return entry[0]}).flip().toMap(); - if (omap.__ownerID) { - newMap.__ownerID = newList.__ownerID = omap.__ownerID; - } - } else { - newMap = map.remove(k); - newList = i === list.size - 1 ? list.pop() : list.set(i, undefined); - } - } else { - if (has) { - if (v === list.get(i)[1]) { - return omap; - } - newMap = map; - newList = list.set(i, [k, v]); - } else { - newMap = map.set(k, list.size); - newList = list.set(list.size, [k, v]); - } - } - if (omap.__ownerID) { - omap.size = newMap.size; - omap._map = newMap; - omap._list = newList; - omap.__hash = undefined; - return omap; - } - return makeOrderedMap(newMap, newList); - } - - createClass(ToKeyedSequence, KeyedSeq); - function ToKeyedSequence(indexed, useKeys) { - this._iter = indexed; - this._useKeys = useKeys; - this.size = indexed.size; - } - - ToKeyedSequence.prototype.get = function(key, notSetValue) { - return this._iter.get(key, notSetValue); - }; - - ToKeyedSequence.prototype.has = function(key) { - return this._iter.has(key); - }; - - ToKeyedSequence.prototype.valueSeq = function() { - return this._iter.valueSeq(); - }; - - ToKeyedSequence.prototype.reverse = function() {var this$0 = this; - var reversedSequence = reverseFactory(this, true); - if (!this._useKeys) { - reversedSequence.valueSeq = function() {return this$0._iter.toSeq().reverse()}; - } - return reversedSequence; - }; - - ToKeyedSequence.prototype.map = function(mapper, context) {var this$0 = this; - var mappedSequence = mapFactory(this, mapper, context); - if (!this._useKeys) { - mappedSequence.valueSeq = function() {return this$0._iter.toSeq().map(mapper, context)}; - } - return mappedSequence; - }; - - ToKeyedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(v, k) {return fn(v, k, this$0)}, reverse); - }; - - ToKeyedSequence.prototype.__iterator = function(type, reverse) { - return this._iter.__iterator(type, reverse); - }; - - ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true; - - - createClass(ToIndexedSequence, IndexedSeq); - function ToIndexedSequence(iter) { - this._iter = iter; - this.size = iter.size; - } - - ToIndexedSequence.prototype.includes = function(value) { - return this._iter.includes(value); - }; - - ToIndexedSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - var i = 0; - reverse && ensureSize(this); - return this._iter.__iterate(function(v ) {return fn(v, reverse ? this$0.size - ++i : i++, this$0)}, reverse); - }; - - ToIndexedSequence.prototype.__iterator = function(type, reverse) {var this$0 = this; - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - var i = 0; - reverse && ensureSize(this); - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, reverse ? this$0.size - ++i : i++, step.value, step) - }); - }; - - - - createClass(ToSetSequence, SetSeq); - function ToSetSequence(iter) { - this._iter = iter; - this.size = iter.size; - } - - ToSetSequence.prototype.has = function(key) { - return this._iter.includes(key); - }; - - ToSetSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(v ) {return fn(v, v, this$0)}, reverse); - }; - - ToSetSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - return new Iterator(function() { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, step.value, step.value, step); - }); - }; - - - - createClass(FromEntriesSequence, KeyedSeq); - function FromEntriesSequence(entries) { - this._iter = entries; - this.size = entries.size; - } - - FromEntriesSequence.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._iter.__iterate(function(entry ) { - // Check if entry exists first so array access doesn't throw for holes - // in the parent iteration. - if (entry) { - validateEntry(entry); - var indexedIterable = isIterable(entry); - return fn( - indexedIterable ? entry.get(1) : entry[1], - indexedIterable ? entry.get(0) : entry[0], - this$0 - ); - } - }, reverse); - }; - - FromEntriesSequence.prototype.__iterator = function(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - return new Iterator(function() { - while (true) { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - // Check if entry exists first so array access doesn't throw for holes - // in the parent iteration. - if (entry) { - validateEntry(entry); - var indexedIterable = isIterable(entry); - return iteratorValue( - type, - indexedIterable ? entry.get(0) : entry[0], - indexedIterable ? entry.get(1) : entry[1], - step - ); - } - } - }); - }; - - - ToIndexedSequence.prototype.cacheResult = - ToKeyedSequence.prototype.cacheResult = - ToSetSequence.prototype.cacheResult = - FromEntriesSequence.prototype.cacheResult = - cacheResultThrough; - - - function flipFactory(iterable) { - var flipSequence = makeSequence(iterable); - flipSequence._iter = iterable; - flipSequence.size = iterable.size; - flipSequence.flip = function() {return iterable}; - flipSequence.reverse = function () { - var reversedSequence = iterable.reverse.apply(this); // super.reverse() - reversedSequence.flip = function() {return iterable.reverse()}; - return reversedSequence; - }; - flipSequence.has = function(key ) {return iterable.includes(key)}; - flipSequence.includes = function(key ) {return iterable.has(key)}; - flipSequence.cacheResult = cacheResultThrough; - flipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - return iterable.__iterate(function(v, k) {return fn(k, v, this$0) !== false}, reverse); - } - flipSequence.__iteratorUncached = function(type, reverse) { - if (type === ITERATE_ENTRIES) { - var iterator = iterable.__iterator(type, reverse); - return new Iterator(function() { - var step = iterator.next(); - if (!step.done) { - var k = step.value[0]; - step.value[0] = step.value[1]; - step.value[1] = k; - } - return step; - }); - } - return iterable.__iterator( - type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, - reverse - ); - } - return flipSequence; - } - - - function mapFactory(iterable, mapper, context) { - var mappedSequence = makeSequence(iterable); - mappedSequence.size = iterable.size; - mappedSequence.has = function(key ) {return iterable.has(key)}; - mappedSequence.get = function(key, notSetValue) { - var v = iterable.get(key, NOT_SET); - return v === NOT_SET ? - notSetValue : - mapper.call(context, v, key, iterable); - }; - mappedSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - return iterable.__iterate( - function(v, k, c) {return fn(mapper.call(context, v, k, c), k, this$0) !== false}, - reverse - ); - } - mappedSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - return new Iterator(function() { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var key = entry[0]; - return iteratorValue( - type, - key, - mapper.call(context, entry[1], key, iterable), - step - ); - }); - } - return mappedSequence; - } - - - function reverseFactory(iterable, useKeys) {var this$0 = this; - var reversedSequence = makeSequence(iterable); - reversedSequence._iter = iterable; - reversedSequence.size = iterable.size; - reversedSequence.reverse = function() {return iterable}; - if (iterable.flip) { - reversedSequence.flip = function () { - var flipSequence = flipFactory(iterable); - flipSequence.reverse = function() {return iterable.flip()}; - return flipSequence; - }; - } - reversedSequence.get = function(key, notSetValue) - {return iterable.get(useKeys ? key : -1 - key, notSetValue)}; - reversedSequence.has = function(key ) - {return iterable.has(useKeys ? key : -1 - key)}; - reversedSequence.includes = function(value ) {return iterable.includes(value)}; - reversedSequence.cacheResult = cacheResultThrough; - reversedSequence.__iterate = function (fn, reverse) {var this$0 = this; - var i = 0; - reverse && ensureSize(iterable); - return iterable.__iterate(function(v, k) - {return fn(v, useKeys ? k : reverse ? this$0.size - ++i : i++, this$0)}, - !reverse - ); - }; - reversedSequence.__iterator = function(type, reverse) { - var i = 0; - reverse && ensureSize(iterable); - var iterator = iterable.__iterator(ITERATE_ENTRIES, !reverse); - return new Iterator(function() { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - return iteratorValue( - type, - useKeys ? entry[0] : reverse ? this$0.size - ++i : i++, - entry[1], - step - ); - }); - } - return reversedSequence; - } - - - function filterFactory(iterable, predicate, context, useKeys) { - var filterSequence = makeSequence(iterable); - if (useKeys) { - filterSequence.has = function(key ) { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && !!predicate.call(context, v, key, iterable); - }; - filterSequence.get = function(key, notSetValue) { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && predicate.call(context, v, key, iterable) ? - v : notSetValue; - }; - } - filterSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - var iterations = 0; - iterable.__iterate(function(v, k, c) { - if (predicate.call(context, v, k, c)) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0); - } - }, reverse); - return iterations; - }; - filterSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterations = 0; - return new Iterator(function() { - while (true) { - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var key = entry[0]; - var value = entry[1]; - if (predicate.call(context, value, key, iterable)) { - return iteratorValue(type, useKeys ? key : iterations++, value, step); - } - } - }); - } - return filterSequence; - } - - - function countByFactory(iterable, grouper, context) { - var groups = Map().asMutable(); - iterable.__iterate(function(v, k) { - groups.update( - grouper.call(context, v, k, iterable), - 0, - function(a ) {return a + 1} - ); - }); - return groups.asImmutable(); - } - - - function groupByFactory(iterable, grouper, context) { - var isKeyedIter = isKeyed(iterable); - var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable(); - iterable.__iterate(function(v, k) { - groups.update( - grouper.call(context, v, k, iterable), - function(a ) {return (a = a || [], a.push(isKeyedIter ? [k, v] : v), a)} - ); - }); - var coerce = iterableClass(iterable); - return groups.map(function(arr ) {return reify(iterable, coerce(arr))}); - } - - - function sliceFactory(iterable, begin, end, useKeys) { - var originalSize = iterable.size; - - if (wholeSlice(begin, end, originalSize)) { - return iterable; - } - - var resolvedBegin = resolveBegin(begin, originalSize); - var resolvedEnd = resolveEnd(end, originalSize); - - // begin or end will be NaN if they were provided as negative numbers and - // this iterable's size is unknown. In that case, cache first so there is - // a known size and these do not resolve to NaN. - if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) { - return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys); - } - - // Note: resolvedEnd is undefined when the original sequence's length is - // unknown and this slice did not supply an end and should contain all - // elements after resolvedBegin. - // In that case, resolvedSize will be NaN and sliceSize will remain undefined. - var resolvedSize = resolvedEnd - resolvedBegin; - var sliceSize; - if (resolvedSize === resolvedSize) { - sliceSize = resolvedSize < 0 ? 0 : resolvedSize; - } - - var sliceSeq = makeSequence(iterable); - - // If iterable.size is undefined, the size of the realized sliceSeq is - // unknown at this point unless the number of items to slice is 0 - sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined; - - if (!useKeys && isSeq(iterable) && sliceSize >= 0) { - sliceSeq.get = function (index, notSetValue) { - index = wrapIndex(this, index); - return index >= 0 && index < sliceSize ? - iterable.get(index + resolvedBegin, notSetValue) : - notSetValue; - } - } - - sliceSeq.__iterateUncached = function(fn, reverse) {var this$0 = this; - if (sliceSize === 0) { - return 0; - } - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var skipped = 0; - var isSkipping = true; - var iterations = 0; - iterable.__iterate(function(v, k) { - if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0) !== false && - iterations !== sliceSize; - } - }); - return iterations; - }; - - sliceSeq.__iteratorUncached = function(type, reverse) { - if (sliceSize !== 0 && reverse) { - return this.cacheResult().__iterator(type, reverse); - } - // Don't bother instantiating parent iterator if taking 0. - var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse); - var skipped = 0; - var iterations = 0; - return new Iterator(function() { - while (skipped++ < resolvedBegin) { - iterator.next(); - } - if (++iterations > sliceSize) { - return iteratorDone(); - } - var step = iterator.next(); - if (useKeys || type === ITERATE_VALUES) { - return step; - } else if (type === ITERATE_KEYS) { - return iteratorValue(type, iterations - 1, undefined, step); - } else { - return iteratorValue(type, iterations - 1, step.value[1], step); - } - }); - } - - return sliceSeq; - } - - - function takeWhileFactory(iterable, predicate, context) { - var takeSequence = makeSequence(iterable); - takeSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterations = 0; - iterable.__iterate(function(v, k, c) - {return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$0)} - ); - return iterations; - }; - takeSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterating = true; - return new Iterator(function() { - if (!iterating) { - return iteratorDone(); - } - var step = iterator.next(); - if (step.done) { - return step; - } - var entry = step.value; - var k = entry[0]; - var v = entry[1]; - if (!predicate.call(context, v, k, this$0)) { - iterating = false; - return iteratorDone(); - } - return type === ITERATE_ENTRIES ? step : - iteratorValue(type, k, v, step); - }); - }; - return takeSequence; - } - - - function skipWhileFactory(iterable, predicate, context, useKeys) { - var skipSequence = makeSequence(iterable); - skipSequence.__iterateUncached = function (fn, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var isSkipping = true; - var iterations = 0; - iterable.__iterate(function(v, k, c) { - if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) { - iterations++; - return fn(v, useKeys ? k : iterations - 1, this$0); - } - }); - return iterations; - }; - skipSequence.__iteratorUncached = function(type, reverse) {var this$0 = this; - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var skipping = true; - var iterations = 0; - return new Iterator(function() { - var step, k, v; - do { - step = iterator.next(); - if (step.done) { - if (useKeys || type === ITERATE_VALUES) { - return step; - } else if (type === ITERATE_KEYS) { - return iteratorValue(type, iterations++, undefined, step); - } else { - return iteratorValue(type, iterations++, step.value[1], step); - } - } - var entry = step.value; - k = entry[0]; - v = entry[1]; - skipping && (skipping = predicate.call(context, v, k, this$0)); - } while (skipping); - return type === ITERATE_ENTRIES ? step : - iteratorValue(type, k, v, step); - }); - }; - return skipSequence; - } - - - function concatFactory(iterable, values) { - var isKeyedIterable = isKeyed(iterable); - var iters = [iterable].concat(values).map(function(v ) { - if (!isIterable(v)) { - v = isKeyedIterable ? - keyedSeqFromValue(v) : - indexedSeqFromValue(Array.isArray(v) ? v : [v]); - } else if (isKeyedIterable) { - v = KeyedIterable(v); - } - return v; - }).filter(function(v ) {return v.size !== 0}); - - if (iters.length === 0) { - return iterable; - } - - if (iters.length === 1) { - var singleton = iters[0]; - if (singleton === iterable || - isKeyedIterable && isKeyed(singleton) || - isIndexed(iterable) && isIndexed(singleton)) { - return singleton; - } - } - - var concatSeq = new ArraySeq(iters); - if (isKeyedIterable) { - concatSeq = concatSeq.toKeyedSeq(); - } else if (!isIndexed(iterable)) { - concatSeq = concatSeq.toSetSeq(); - } - concatSeq = concatSeq.flatten(true); - concatSeq.size = iters.reduce( - function(sum, seq) { - if (sum !== undefined) { - var size = seq.size; - if (size !== undefined) { - return sum + size; - } - } - }, - 0 - ); - return concatSeq; - } - - - function flattenFactory(iterable, depth, useKeys) { - var flatSequence = makeSequence(iterable); - flatSequence.__iterateUncached = function(fn, reverse) { - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterations = 0; - var stopped = false; - function flatDeep(iter, currentDepth) { - iter.__iterate(function(v, k) { - if ((!depth || currentDepth < depth) && isIterable(v)) { - flatDeep(v, currentDepth + 1); - } else if (fn(v, useKeys ? k : iterations++, flatSequence) === false) { - stopped = true; - } - return !stopped; - }, reverse); - } - flatDeep(iterable, 0); - return iterations; - } - flatSequence.__iteratorUncached = function(type, reverse) { - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = iterable.__iterator(type, reverse); - var stack = []; - var iterations = 0; - return new Iterator(function() { - while (iterator) { - var step = iterator.next(); - if (step.done !== false) { - iterator = stack.pop(); - continue; - } - var v = step.value; - if (type === ITERATE_ENTRIES) { - v = v[1]; - } - if ((!depth || stack.length < depth) && isIterable(v)) { - stack.push(iterator); - iterator = v.__iterator(type, reverse); - } else { - return useKeys ? step : iteratorValue(type, iterations++, v, step); - } - } - return iteratorDone(); - }); - } - return flatSequence; - } - - - function flatMapFactory(iterable, mapper, context) { - var coerce = iterableClass(iterable); - return iterable.toSeq().map( - function(v, k) {return coerce(mapper.call(context, v, k, iterable))} - ).flatten(true); - } - - - function interposeFactory(iterable, separator) { - var interposedSequence = makeSequence(iterable); - interposedSequence.size = iterable.size && iterable.size * 2 -1; - interposedSequence.__iterateUncached = function(fn, reverse) {var this$0 = this; - var iterations = 0; - iterable.__iterate(function(v, k) - {return (!iterations || fn(separator, iterations++, this$0) !== false) && - fn(v, iterations++, this$0) !== false}, - reverse - ); - return iterations; - }; - interposedSequence.__iteratorUncached = function(type, reverse) { - var iterator = iterable.__iterator(ITERATE_VALUES, reverse); - var iterations = 0; - var step; - return new Iterator(function() { - if (!step || iterations % 2) { - step = iterator.next(); - if (step.done) { - return step; - } - } - return iterations % 2 ? - iteratorValue(type, iterations++, separator) : - iteratorValue(type, iterations++, step.value, step); - }); - }; - return interposedSequence; - } - - - function sortFactory(iterable, comparator, mapper) { - if (!comparator) { - comparator = defaultComparator; - } - var isKeyedIterable = isKeyed(iterable); - var index = 0; - var entries = iterable.toSeq().map( - function(v, k) {return [k, v, index++, mapper ? mapper(v, k, iterable) : v]} - ).toArray(); - entries.sort(function(a, b) {return comparator(a[3], b[3]) || a[2] - b[2]}).forEach( - isKeyedIterable ? - function(v, i) { entries[i].length = 2; } : - function(v, i) { entries[i] = v[1]; } - ); - return isKeyedIterable ? KeyedSeq(entries) : - isIndexed(iterable) ? IndexedSeq(entries) : - SetSeq(entries); - } - - - function maxFactory(iterable, comparator, mapper) { - if (!comparator) { - comparator = defaultComparator; - } - if (mapper) { - var entry = iterable.toSeq() - .map(function(v, k) {return [v, mapper(v, k, iterable)]}) - .reduce(function(a, b) {return maxCompare(comparator, a[1], b[1]) ? b : a}); - return entry && entry[0]; - } else { - return iterable.reduce(function(a, b) {return maxCompare(comparator, a, b) ? b : a}); - } - } - - function maxCompare(comparator, a, b) { - var comp = comparator(b, a); - // b is considered the new max if the comparator declares them equal, but - // they are not equal and b is in fact a nullish value. - return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0; - } - - - function zipWithFactory(keyIter, zipper, iters) { - var zipSequence = makeSequence(keyIter); - zipSequence.size = new ArraySeq(iters).map(function(i ) {return i.size}).min(); - // Note: this a generic base implementation of __iterate in terms of - // __iterator which may be more generically useful in the future. - zipSequence.__iterate = function(fn, reverse) { - /* generic: - var iterator = this.__iterator(ITERATE_ENTRIES, reverse); - var step; - var iterations = 0; - while (!(step = iterator.next()).done) { - iterations++; - if (fn(step.value[1], step.value[0], this) === false) { - break; - } - } - return iterations; - */ - // indexed: - var iterator = this.__iterator(ITERATE_VALUES, reverse); - var step; - var iterations = 0; - while (!(step = iterator.next()).done) { - if (fn(step.value, iterations++, this) === false) { - break; - } - } - return iterations; - }; - zipSequence.__iteratorUncached = function(type, reverse) { - var iterators = iters.map(function(i ) - {return (i = Iterable(i), getIterator(reverse ? i.reverse() : i))} - ); - var iterations = 0; - var isDone = false; - return new Iterator(function() { - var steps; - if (!isDone) { - steps = iterators.map(function(i ) {return i.next()}); - isDone = steps.some(function(s ) {return s.done}); - } - if (isDone) { - return iteratorDone(); - } - return iteratorValue( - type, - iterations++, - zipper.apply(null, steps.map(function(s ) {return s.value})) - ); - }); - }; - return zipSequence - } - - - // #pragma Helper Functions - - function reify(iter, seq) { - return iter === seq ? iter : isSeq(iter) ? seq : iter.constructor(seq); - } - - function validateEntry(entry) { - if (entry !== Object(entry)) { - throw new TypeError('Expected [K, V] tuple: ' + entry); - } - } - - function iterableClass(iterable) { - return isKeyed(iterable) ? KeyedIterable : - isIndexed(iterable) ? IndexedIterable : - SetIterable; - } - - function makeSequence(iterable) { - return Object.create( - ( - isKeyed(iterable) ? KeyedSeq : - isIndexed(iterable) ? IndexedSeq : - SetSeq - ).prototype - ); - } - - function cacheResultThrough() { - if (this._iter.cacheResult) { - this._iter.cacheResult(); - this.size = this._iter.size; - return this; - } else { - return Seq.prototype.cacheResult.call(this); - } - } - - function defaultComparator(a, b) { - if (a === undefined && b === undefined) { - return 0; - } - - if (a === undefined) { - return 1; - } - - if (b === undefined) { - return -1; - } - - return a > b ? 1 : a < b ? -1 : 0; - } - - function forceIterator(keyPath) { - var iter = getIterator(keyPath); - if (!iter) { - // Array might not be iterable in this environment, so we need a fallback - // to our wrapped type. - if (!isArrayLike(keyPath)) { - throw new TypeError('Expected iterable or array-like: ' + keyPath); - } - iter = getIterator(Iterable(keyPath)); - } - return iter; - } - - createClass(Record, KeyedCollection); - - function Record(defaultValues, name) { - var hasInitialized; - - var RecordType = function Record(values) { - if (values instanceof RecordType) { - return values; - } - if (!(this instanceof RecordType)) { - return new RecordType(values); - } - if (!hasInitialized) { - hasInitialized = true; - var keys = Object.keys(defaultValues); - RecordTypePrototype.size = keys.length; - RecordTypePrototype._name = name; - RecordTypePrototype._keys = keys; - RecordTypePrototype._defaultValues = defaultValues; - for (var i = 0; i < keys.length; i++) { - var propName = keys[i]; - if (RecordTypePrototype[propName]) { - typeof console === 'object' && console.warn && console.warn( - 'Cannot define ' + recordName(this) + ' with property "' + - propName + '" since that property name is part of the Record API.' - ); - } else { - setProp(RecordTypePrototype, propName); - } - } - } - this._map = Map(values); - }; - - var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype); - RecordTypePrototype.constructor = RecordType; - - return RecordType; - } - - Record.prototype.toString = function() { - return this.__toString(recordName(this) + ' {', '}'); - }; - - // @pragma Access - - Record.prototype.has = function(k) { - return this._defaultValues.hasOwnProperty(k); - }; - - Record.prototype.get = function(k, notSetValue) { - if (!this.has(k)) { - return notSetValue; - } - var defaultVal = this._defaultValues[k]; - return this._map ? this._map.get(k, defaultVal) : defaultVal; - }; - - // @pragma Modification - - Record.prototype.clear = function() { - if (this.__ownerID) { - this._map && this._map.clear(); - return this; - } - var RecordType = this.constructor; - return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap())); - }; - - Record.prototype.set = function(k, v) { - if (!this.has(k)) { - return this; - } - if (this._map && !this._map.has(k)) { - var defaultVal = this._defaultValues[k]; - if (v === defaultVal) { - return this; - } - } - var newMap = this._map && this._map.set(k, v); - if (this.__ownerID || newMap === this._map) { - return this; - } - return makeRecord(this, newMap); - }; - - Record.prototype.remove = function(k) { - if (!this.has(k)) { - return this; - } - var newMap = this._map && this._map.remove(k); - if (this.__ownerID || newMap === this._map) { - return this; - } - return makeRecord(this, newMap); - }; - - Record.prototype.wasAltered = function() { - return this._map.wasAltered(); - }; - - Record.prototype.__iterator = function(type, reverse) {var this$0 = this; - return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterator(type, reverse); - }; - - Record.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return KeyedIterable(this._defaultValues).map(function(_, k) {return this$0.get(k)}).__iterate(fn, reverse); - }; - - Record.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - var newMap = this._map && this._map.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - return this; - } - return makeRecord(this, newMap, ownerID); - }; - - - Record.getDescriptiveName = recordName; - var RecordPrototype = Record.prototype; - RecordPrototype[DELETE] = RecordPrototype.remove; - RecordPrototype.deleteIn = - RecordPrototype.removeIn = MapPrototype.removeIn; - RecordPrototype.merge = MapPrototype.merge; - RecordPrototype.mergeWith = MapPrototype.mergeWith; - RecordPrototype.mergeIn = MapPrototype.mergeIn; - RecordPrototype.mergeDeep = MapPrototype.mergeDeep; - RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith; - RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; - RecordPrototype.setIn = MapPrototype.setIn; - RecordPrototype.update = MapPrototype.update; - RecordPrototype.updateIn = MapPrototype.updateIn; - RecordPrototype.withMutations = MapPrototype.withMutations; - RecordPrototype.asMutable = MapPrototype.asMutable; - RecordPrototype.asImmutable = MapPrototype.asImmutable; - - - function makeRecord(likeRecord, map, ownerID) { - var record = Object.create(Object.getPrototypeOf(likeRecord)); - record._map = map; - record.__ownerID = ownerID; - return record; - } - - function recordName(record) { - return record._name || record.constructor.name || 'Record'; - } - - function setProp(prototype, name) { - try { - Object.defineProperty(prototype, name, { - get: function() { - return this.get(name); - }, - set: function(value) { - invariant(this.__ownerID, 'Cannot set on an immutable record.'); - this.set(name, value); - } - }); - } catch (error) { - // Object.defineProperty failed. Probably IE8. - } - } - - createClass(Set, SetCollection); - - // @pragma Construction - - function Set(value) { - return value === null || value === undefined ? emptySet() : - isSet(value) && !isOrdered(value) ? value : - emptySet().withMutations(function(set ) { - var iter = SetIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v ) {return set.add(v)}); - }); - } - - Set.of = function(/*...values*/) { - return this(arguments); - }; - - Set.fromKeys = function(value) { - return this(KeyedIterable(value).keySeq()); - }; - - Set.prototype.toString = function() { - return this.__toString('Set {', '}'); - }; - - // @pragma Access - - Set.prototype.has = function(value) { - return this._map.has(value); - }; - - // @pragma Modification - - Set.prototype.add = function(value) { - return updateSet(this, this._map.set(value, true)); - }; - - Set.prototype.remove = function(value) { - return updateSet(this, this._map.remove(value)); - }; - - Set.prototype.clear = function() { - return updateSet(this, this._map.clear()); - }; - - // @pragma Composition - - Set.prototype.union = function() {var iters = SLICE$0.call(arguments, 0); - iters = iters.filter(function(x ) {return x.size !== 0}); - if (iters.length === 0) { - return this; - } - if (this.size === 0 && !this.__ownerID && iters.length === 1) { - return this.constructor(iters[0]); - } - return this.withMutations(function(set ) { - for (var ii = 0; ii < iters.length; ii++) { - SetIterable(iters[ii]).forEach(function(value ) {return set.add(value)}); - } - }); - }; - - Set.prototype.intersect = function() {var iters = SLICE$0.call(arguments, 0); - if (iters.length === 0) { - return this; - } - iters = iters.map(function(iter ) {return SetIterable(iter)}); - var toRemove = []; - this.forEach(function(value ) { - if (!iters.every(function(iter ) {return iter.includes(value)})) { - toRemove.push(value); - } - }); - return this.withMutations(function(set ) { - toRemove.forEach(function(value ) { - set.remove(value); - }); - }); - }; - - Set.prototype.subtract = function() {var iters = SLICE$0.call(arguments, 0); - if (iters.length === 0) { - return this; - } - var toRemove = []; - this.forEach(function(value ) { - if (iters.some(function(iter ) {return iter.includes(value)})) { - toRemove.push(value); - } - }); - return this.withMutations(function(set ) { - toRemove.forEach(function(value ) { - set.remove(value); - }); - }); - }; - - Set.prototype.merge = function() { - return this.union.apply(this, arguments); - }; - - Set.prototype.mergeWith = function(merger) {var iters = SLICE$0.call(arguments, 1); - return this.union.apply(this, iters); - }; - - Set.prototype.sort = function(comparator) { - // Late binding - return OrderedSet(sortFactory(this, comparator)); - }; - - Set.prototype.sortBy = function(mapper, comparator) { - // Late binding - return OrderedSet(sortFactory(this, comparator, mapper)); - }; - - Set.prototype.wasAltered = function() { - return this._map.wasAltered(); - }; - - Set.prototype.__iterate = function(fn, reverse) {var this$0 = this; - return this._map.__iterate(function(_, k) {return fn(k, k, this$0)}, reverse); - }; - - Set.prototype.__iterator = function(type, reverse) { - return this._map.map(function(_, k) {return k}).__iterator(type, reverse); - }; - - Set.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - var newMap = this._map.__ensureOwner(ownerID); - if (!ownerID) { - this.__ownerID = ownerID; - this._map = newMap; - return this; - } - return this.__make(newMap, ownerID); - }; - - - function isSet(maybeSet) { - return !!(maybeSet && maybeSet[IS_SET_SENTINEL]); - } - - Set.isSet = isSet; - - var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; - - var SetPrototype = Set.prototype; - SetPrototype[IS_SET_SENTINEL] = true; - SetPrototype[DELETE] = SetPrototype.remove; - SetPrototype.mergeDeep = SetPrototype.merge; - SetPrototype.mergeDeepWith = SetPrototype.mergeWith; - SetPrototype.withMutations = MapPrototype.withMutations; - SetPrototype.asMutable = MapPrototype.asMutable; - SetPrototype.asImmutable = MapPrototype.asImmutable; - - SetPrototype.__empty = emptySet; - SetPrototype.__make = makeSet; - - function updateSet(set, newMap) { - if (set.__ownerID) { - set.size = newMap.size; - set._map = newMap; - return set; - } - return newMap === set._map ? set : - newMap.size === 0 ? set.__empty() : - set.__make(newMap); - } - - function makeSet(map, ownerID) { - var set = Object.create(SetPrototype); - set.size = map ? map.size : 0; - set._map = map; - set.__ownerID = ownerID; - return set; - } - - var EMPTY_SET; - function emptySet() { - return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())); - } - - /** - * Contributes additional methods to a constructor - */ - function mixin(ctor, methods) { - var keyCopier = function(key ) { ctor.prototype[key] = methods[key]; }; - Object.keys(methods).forEach(keyCopier); - Object.getOwnPropertySymbols && - Object.getOwnPropertySymbols(methods).forEach(keyCopier); - return ctor; - } - - createClass(Stack, IndexedCollection); - - // @pragma Construction - - function Stack(value) { - return value === null || value === undefined ? emptyStack() : - isStack(value) ? value : - emptyStack().unshiftAll(value); - } - - Stack.of = function(/*...values*/) { - return this(arguments); - }; - - Stack.prototype.toString = function() { - return this.__toString('Stack [', ']'); - }; - - // @pragma Access - - Stack.prototype.get = function(index, notSetValue) { - var head = this._head; - index = wrapIndex(this, index); - while (head && index--) { - head = head.next; - } - return head ? head.value : notSetValue; - }; - - Stack.prototype.peek = function() { - return this._head && this._head.value; - }; - - // @pragma Modification - - Stack.prototype.push = function(/*...values*/) { - if (arguments.length === 0) { - return this; - } - var newSize = this.size + arguments.length; - var head = this._head; - for (var ii = arguments.length - 1; ii >= 0; ii--) { - head = { - value: arguments[ii], - next: head - }; - } - if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; - return this; - } - return makeStack(newSize, head); - }; - - Stack.prototype.pushAll = function(iter) { - iter = IndexedIterable(iter); - if (iter.size === 0) { - return this; - } - assertNotInfinite(iter.size); - var newSize = this.size; - var head = this._head; - iter.reverse().forEach(function(value ) { - newSize++; - head = { - value: value, - next: head - }; - }); - if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; - return this; - } - return makeStack(newSize, head); - }; - - Stack.prototype.pop = function() { - return this.slice(1); - }; - - Stack.prototype.unshift = function(/*...values*/) { - return this.push.apply(this, arguments); - }; - - Stack.prototype.unshiftAll = function(iter) { - return this.pushAll(iter); - }; - - Stack.prototype.shift = function() { - return this.pop.apply(this, arguments); - }; - - Stack.prototype.clear = function() { - if (this.size === 0) { - return this; - } - if (this.__ownerID) { - this.size = 0; - this._head = undefined; - this.__hash = undefined; - this.__altered = true; - return this; - } - return emptyStack(); - }; - - Stack.prototype.slice = function(begin, end) { - if (wholeSlice(begin, end, this.size)) { - return this; - } - var resolvedBegin = resolveBegin(begin, this.size); - var resolvedEnd = resolveEnd(end, this.size); - if (resolvedEnd !== this.size) { - // super.slice(begin, end); - return IndexedCollection.prototype.slice.call(this, begin, end); - } - var newSize = this.size - resolvedBegin; - var head = this._head; - while (resolvedBegin--) { - head = head.next; - } - if (this.__ownerID) { - this.size = newSize; - this._head = head; - this.__hash = undefined; - this.__altered = true; - return this; - } - return makeStack(newSize, head); - }; - - // @pragma Mutability - - Stack.prototype.__ensureOwner = function(ownerID) { - if (ownerID === this.__ownerID) { - return this; - } - if (!ownerID) { - this.__ownerID = ownerID; - this.__altered = false; - return this; - } - return makeStack(this.size, this._head, ownerID, this.__hash); - }; - - // @pragma Iteration - - Stack.prototype.__iterate = function(fn, reverse) {var this$0 = this; - if (reverse) { - return new ArraySeq(this.toArray()).__iterate(function(v, k) {return fn(v, k, this$0)}, reverse); - } - var iterations = 0; - var node = this._head; - while (node) { - if (fn(node.value, iterations++, this) === false) { - break; - } - node = node.next; - } - return iterations; - }; - - Stack.prototype.__iterator = function(type, reverse) { - if (reverse) { - return new ArraySeq(this.toArray()).__iterator(type, reverse); - } - var iterations = 0; - var node = this._head; - return new Iterator(function() { - if (node) { - var value = node.value; - node = node.next; - return iteratorValue(type, iterations++, value); - } - return iteratorDone(); - }); - }; - - - function isStack(maybeStack) { - return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]); - } - - Stack.isStack = isStack; - - var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; - - var StackPrototype = Stack.prototype; - StackPrototype[IS_STACK_SENTINEL] = true; - StackPrototype.withMutations = MapPrototype.withMutations; - StackPrototype.asMutable = MapPrototype.asMutable; - StackPrototype.asImmutable = MapPrototype.asImmutable; - StackPrototype.wasAltered = MapPrototype.wasAltered; - - - function makeStack(size, head, ownerID, hash) { - var map = Object.create(StackPrototype); - map.size = size; - map._head = head; - map.__ownerID = ownerID; - map.__hash = hash; - map.__altered = false; - return map; - } - - var EMPTY_STACK; - function emptyStack() { - return EMPTY_STACK || (EMPTY_STACK = makeStack(0)); - } - - Iterable.Iterator = Iterator; - - mixin(Iterable, { - - // ### Conversion to other types - - toArray: function() { - assertNotInfinite(this.size); - var array = new Array(this.size || 0); - this.valueSeq().__iterate(function(v, i) { array[i] = v; }); - return array; - }, - - toIndexedSeq: function() { - return new ToIndexedSequence(this); - }, - - toJS: function() { - return this.toSeq().map(toJS).__toJS(); - }, - - toJSON: function() { - return this.toSeq().map(toJSON).__toJS(); - }, - - toKeyedSeq: function() { - return new ToKeyedSequence(this, true); - }, - - toMap: function() { - // Use Late Binding here to solve the circular dependency. - return Map(this.toKeyedSeq()); - }, - - toObject: function() { - assertNotInfinite(this.size); - var object = {}; - this.__iterate(function(v, k) { object[k] = v; }); - return object; - }, - - toOrderedMap: function() { - // Use Late Binding here to solve the circular dependency. - return OrderedMap(this.toKeyedSeq()); - }, - - toOrderedSet: function() { - // Use Late Binding here to solve the circular dependency. - return OrderedSet(isKeyed(this) ? this.valueSeq() : this); - }, - - toSet: function() { - // Use Late Binding here to solve the circular dependency. - return Set(isKeyed(this) ? this.valueSeq() : this); - }, - - toSetSeq: function() { - return new ToSetSequence(this); - }, - - toSeq: function() { - return isIndexed(this) ? this.toIndexedSeq() : - isKeyed(this) ? this.toKeyedSeq() : - this.toSetSeq(); - }, - - toStack: function() { - // Use Late Binding here to solve the circular dependency. - return Stack(isKeyed(this) ? this.valueSeq() : this); - }, - - toList: function() { - // Use Late Binding here to solve the circular dependency. - return List(isKeyed(this) ? this.valueSeq() : this); - }, - - - // ### Common JavaScript methods and properties - - toString: function() { - return '[Iterable]'; - }, - - __toString: function(head, tail) { - if (this.size === 0) { - return head + tail; - } - return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail; - }, - - - // ### ES6 Collection methods (ES6 Array and Map) - - concat: function() {var values = SLICE$0.call(arguments, 0); - return reify(this, concatFactory(this, values)); - }, - - includes: function(searchValue) { - return this.some(function(value ) {return is(value, searchValue)}); - }, - - entries: function() { - return this.__iterator(ITERATE_ENTRIES); - }, - - every: function(predicate, context) { - assertNotInfinite(this.size); - var returnValue = true; - this.__iterate(function(v, k, c) { - if (!predicate.call(context, v, k, c)) { - returnValue = false; - return false; - } - }); - return returnValue; - }, - - filter: function(predicate, context) { - return reify(this, filterFactory(this, predicate, context, true)); - }, - - find: function(predicate, context, notSetValue) { - var entry = this.findEntry(predicate, context); - return entry ? entry[1] : notSetValue; - }, - - forEach: function(sideEffect, context) { - assertNotInfinite(this.size); - return this.__iterate(context ? sideEffect.bind(context) : sideEffect); - }, - - join: function(separator) { - assertNotInfinite(this.size); - separator = separator !== undefined ? '' + separator : ','; - var joined = ''; - var isFirst = true; - this.__iterate(function(v ) { - isFirst ? (isFirst = false) : (joined += separator); - joined += v !== null && v !== undefined ? v.toString() : ''; - }); - return joined; - }, - - keys: function() { - return this.__iterator(ITERATE_KEYS); - }, - - map: function(mapper, context) { - return reify(this, mapFactory(this, mapper, context)); - }, - - reduce: function(reducer, initialReduction, context) { - assertNotInfinite(this.size); - var reduction; - var useFirst; - if (arguments.length < 2) { - useFirst = true; - } else { - reduction = initialReduction; - } - this.__iterate(function(v, k, c) { - if (useFirst) { - useFirst = false; - reduction = v; - } else { - reduction = reducer.call(context, reduction, v, k, c); - } - }); - return reduction; - }, - - reduceRight: function(reducer, initialReduction, context) { - var reversed = this.toKeyedSeq().reverse(); - return reversed.reduce.apply(reversed, arguments); - }, - - reverse: function() { - return reify(this, reverseFactory(this, true)); - }, - - slice: function(begin, end) { - return reify(this, sliceFactory(this, begin, end, true)); - }, - - some: function(predicate, context) { - return !this.every(not(predicate), context); - }, - - sort: function(comparator) { - return reify(this, sortFactory(this, comparator)); - }, - - values: function() { - return this.__iterator(ITERATE_VALUES); - }, - - - // ### More sequential methods - - butLast: function() { - return this.slice(0, -1); - }, - - isEmpty: function() { - return this.size !== undefined ? this.size === 0 : !this.some(function() {return true}); - }, - - count: function(predicate, context) { - return ensureSize( - predicate ? this.toSeq().filter(predicate, context) : this - ); - }, - - countBy: function(grouper, context) { - return countByFactory(this, grouper, context); - }, - - equals: function(other) { - return deepEqual(this, other); - }, - - entrySeq: function() { - var iterable = this; - if (iterable._cache) { - // We cache as an entries array, so we can just return the cache! - return new ArraySeq(iterable._cache); - } - var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq(); - entriesSequence.fromEntrySeq = function() {return iterable.toSeq()}; - - // Entries are plain Array, which do not define toJS/toJSON, so it must - // manually converts keys and values before conversion. - entriesSequence.toJS = function () { - return this.map(function(entry ) {return [toJS(entry[0]), toJS(entry[1])]}).__toJS(); - }; - entriesSequence.toJSON = function () { - return this.map(function(entry ) {return [toJSON(entry[0]), toJSON(entry[1])]}).__toJS(); - }; - - return entriesSequence; - }, - - filterNot: function(predicate, context) { - return this.filter(not(predicate), context); - }, - - findEntry: function(predicate, context, notSetValue) { - var found = notSetValue; - this.__iterate(function(v, k, c) { - if (predicate.call(context, v, k, c)) { - found = [k, v]; - return false; - } - }); - return found; - }, - - findKey: function(predicate, context) { - var entry = this.findEntry(predicate, context); - return entry && entry[0]; - }, - - findLast: function(predicate, context, notSetValue) { - return this.toKeyedSeq().reverse().find(predicate, context, notSetValue); - }, - - findLastEntry: function(predicate, context, notSetValue) { - return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue); - }, - - findLastKey: function(predicate, context) { - return this.toKeyedSeq().reverse().findKey(predicate, context); - }, - - first: function() { - return this.find(returnTrue); - }, - - flatMap: function(mapper, context) { - return reify(this, flatMapFactory(this, mapper, context)); - }, - - flatten: function(depth) { - return reify(this, flattenFactory(this, depth, true)); - }, - - fromEntrySeq: function() { - return new FromEntriesSequence(this); - }, - - get: function(searchKey, notSetValue) { - return this.find(function(_, key) {return is(key, searchKey)}, undefined, notSetValue); - }, - - getIn: function(searchKeyPath, notSetValue) { - var nested = this; - // Note: in an ES6 environment, we would prefer: - // for (var key of searchKeyPath) { - var iter = forceIterator(searchKeyPath); - var step; - while (!(step = iter.next()).done) { - var key = step.value; - nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET; - if (nested === NOT_SET) { - return notSetValue; - } - } - return nested; - }, - - groupBy: function(grouper, context) { - return groupByFactory(this, grouper, context); - }, - - has: function(searchKey) { - return this.get(searchKey, NOT_SET) !== NOT_SET; - }, - - hasIn: function(searchKeyPath) { - return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET; - }, - - isSubset: function(iter) { - iter = typeof iter.includes === 'function' ? iter : Iterable(iter); - return this.every(function(value ) {return iter.includes(value)}); - }, - - isSuperset: function(iter) { - iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter); - return iter.isSubset(this); - }, - - keyOf: function(searchValue) { - return this.findKey(function(value ) {return is(value, searchValue)}); - }, - - keySeq: function() { - return this.toSeq().map(keyMapper).toIndexedSeq(); - }, - - last: function() { - return this.toSeq().reverse().first(); - }, - - lastKeyOf: function(searchValue) { - return this.toKeyedSeq().reverse().keyOf(searchValue); - }, - - max: function(comparator) { - return maxFactory(this, comparator); - }, - - maxBy: function(mapper, comparator) { - return maxFactory(this, comparator, mapper); - }, - - min: function(comparator) { - return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator); - }, - - minBy: function(mapper, comparator) { - return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper); - }, - - rest: function() { - return this.slice(1); - }, - - skip: function(amount) { - return amount === 0 ? this : this.slice(Math.max(0, amount)); - }, - - skipLast: function(amount) { - return amount === 0 ? this : this.slice(0, -Math.max(0, amount)); - }, - - skipWhile: function(predicate, context) { - return reify(this, skipWhileFactory(this, predicate, context, true)); - }, - - skipUntil: function(predicate, context) { - return this.skipWhile(not(predicate), context); - }, - - sortBy: function(mapper, comparator) { - return reify(this, sortFactory(this, comparator, mapper)); - }, - - take: function(amount) { - return this.slice(0, Math.max(0, amount)); - }, - - takeLast: function(amount) { - return this.slice(-Math.max(0, amount)); - }, - - takeWhile: function(predicate, context) { - return reify(this, takeWhileFactory(this, predicate, context)); - }, - - takeUntil: function(predicate, context) { - return this.takeWhile(not(predicate), context); - }, - - valueSeq: function() { - return this.toIndexedSeq(); - }, - - - // ### Hashable Object - - hashCode: function() { - return this.__hash || (this.__hash = hashIterable(this)); - } - - - // ### Internal - - // abstract __iterate(fn, reverse) - - // abstract __iterator(type, reverse) - }); - - // var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; - // var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; - // var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; - // var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; - - var IterablePrototype = Iterable.prototype; - IterablePrototype[IS_ITERABLE_SENTINEL] = true; - IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values; - IterablePrototype.__toJS = IterablePrototype.toArray; - IterablePrototype.__toStringMapper = quoteString; - IterablePrototype.inspect = - IterablePrototype.toSource = function() { return this.toString(); }; - IterablePrototype.chain = IterablePrototype.flatMap; - IterablePrototype.contains = IterablePrototype.includes; - - mixin(KeyedIterable, { - - // ### More sequential methods - - flip: function() { - return reify(this, flipFactory(this)); - }, - - mapEntries: function(mapper, context) {var this$0 = this; - var iterations = 0; - return reify(this, - this.toSeq().map( - function(v, k) {return mapper.call(context, [k, v], iterations++, this$0)} - ).fromEntrySeq() - ); - }, - - mapKeys: function(mapper, context) {var this$0 = this; - return reify(this, - this.toSeq().flip().map( - function(k, v) {return mapper.call(context, k, v, this$0)} - ).flip() - ); - } - - }); - - var KeyedIterablePrototype = KeyedIterable.prototype; - KeyedIterablePrototype[IS_KEYED_SENTINEL] = true; - KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries; - KeyedIterablePrototype.__toJS = IterablePrototype.toObject; - KeyedIterablePrototype.__toStringMapper = function(v, k) {return quoteString(k) + ': ' + quoteString(v)}; - - - - mixin(IndexedIterable, { - - // ### Conversion to other types - - toKeyedSeq: function() { - return new ToKeyedSequence(this, false); - }, - - - // ### ES6 Collection methods (ES6 Array and Map) - - filter: function(predicate, context) { - return reify(this, filterFactory(this, predicate, context, false)); - }, - - findIndex: function(predicate, context) { - var entry = this.findEntry(predicate, context); - return entry ? entry[0] : -1; - }, - - indexOf: function(searchValue) { - var key = this.keyOf(searchValue); - return key === undefined ? -1 : key; - }, - - lastIndexOf: function(searchValue) { - var key = this.lastKeyOf(searchValue); - return key === undefined ? -1 : key; - }, - - reverse: function() { - return reify(this, reverseFactory(this, false)); - }, - - slice: function(begin, end) { - return reify(this, sliceFactory(this, begin, end, false)); - }, - - splice: function(index, removeNum /*, ...values*/) { - var numArgs = arguments.length; - removeNum = Math.max(removeNum | 0, 0); - if (numArgs === 0 || (numArgs === 2 && !removeNum)) { - return this; - } - // If index is negative, it should resolve relative to the size of the - // collection. However size may be expensive to compute if not cached, so - // only call count() if the number is in fact negative. - index = resolveBegin(index, index < 0 ? this.count() : this.size); - var spliced = this.slice(0, index); - return reify( - this, - numArgs === 1 ? - spliced : - spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)) - ); - }, - - - // ### More collection methods - - findLastIndex: function(predicate, context) { - var entry = this.findLastEntry(predicate, context); - return entry ? entry[0] : -1; - }, - - first: function() { - return this.get(0); - }, - - flatten: function(depth) { - return reify(this, flattenFactory(this, depth, false)); - }, - - get: function(index, notSetValue) { - index = wrapIndex(this, index); - return (index < 0 || (this.size === Infinity || - (this.size !== undefined && index > this.size))) ? - notSetValue : - this.find(function(_, key) {return key === index}, undefined, notSetValue); - }, - - has: function(index) { - index = wrapIndex(this, index); - return index >= 0 && (this.size !== undefined ? - this.size === Infinity || index < this.size : - this.indexOf(index) !== -1 - ); - }, - - interpose: function(separator) { - return reify(this, interposeFactory(this, separator)); - }, - - interleave: function(/*...iterables*/) { - var iterables = [this].concat(arrCopy(arguments)); - var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables); - var interleaved = zipped.flatten(true); - if (zipped.size) { - interleaved.size = zipped.size * iterables.length; - } - return reify(this, interleaved); - }, - - keySeq: function() { - return Range(0, this.size); - }, - - last: function() { - return this.get(-1); - }, - - skipWhile: function(predicate, context) { - return reify(this, skipWhileFactory(this, predicate, context, false)); - }, - - zip: function(/*, ...iterables */) { - var iterables = [this].concat(arrCopy(arguments)); - return reify(this, zipWithFactory(this, defaultZipper, iterables)); - }, - - zipWith: function(zipper/*, ...iterables */) { - var iterables = arrCopy(arguments); - iterables[0] = this; - return reify(this, zipWithFactory(this, zipper, iterables)); - } - - }); - - var IndexedIterablePrototype = IndexedIterable.prototype; - IndexedIterablePrototype[IS_INDEXED_SENTINEL] = true; - IndexedIterablePrototype[IS_ORDERED_SENTINEL] = true; - - - - mixin(SetIterable, { - - // ### ES6 Collection methods (ES6 Array and Map) - - get: function(value, notSetValue) { - return this.has(value) ? value : notSetValue; - }, - - includes: function(value) { - return this.has(value); - }, - - - // ### More sequential methods - - keySeq: function() { - return this.valueSeq(); - } - - }); - - SetIterable.prototype.has = IterablePrototype.includes; - SetIterable.prototype.contains = SetIterable.prototype.includes; - - - // Mixin subclasses - - mixin(KeyedSeq, KeyedIterable.prototype); - mixin(IndexedSeq, IndexedIterable.prototype); - mixin(SetSeq, SetIterable.prototype); - - mixin(KeyedCollection, KeyedIterable.prototype); - mixin(IndexedCollection, IndexedIterable.prototype); - mixin(SetCollection, SetIterable.prototype); - - - // #pragma Helper functions - - function keyMapper(v, k) { - return k; - } - - function entryMapper(v, k) { - return [k, v]; - } - - function toJS(value) { - return value && typeof value.toJS === 'function' ? value.toJS() : value; - } - - function toJSON(value) { - return value && typeof value.toJSON === 'function' ? value.toJSON() : value; - } - - function not(predicate) { - return function() { - return !predicate.apply(this, arguments); - } - } - - function neg(predicate) { - return function() { - return -predicate.apply(this, arguments); - } - } - - function quoteString(value) { - return typeof value === 'string' ? JSON.stringify(value) : String(value); - } - - function defaultZipper() { - return arrCopy(arguments); - } - - function defaultNegComparator(a, b) { - return a < b ? 1 : a > b ? -1 : 0; - } - - function hashIterable(iterable) { - if (iterable.size === Infinity) { - return 0; - } - var ordered = isOrdered(iterable); - var keyed = isKeyed(iterable); - var h = ordered ? 1 : 0; - var size = iterable.__iterate( - keyed ? - ordered ? - function(v, k) { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } : - function(v, k) { h = h + hashMerge(hash(v), hash(k)) | 0; } : - ordered ? - function(v ) { h = 31 * h + hash(v) | 0; } : - function(v ) { h = h + hash(v) | 0; } - ); - return murmurHashOfSize(size, h); - } - - function murmurHashOfSize(size, h) { - h = imul(h, 0xCC9E2D51); - h = imul(h << 15 | h >>> -15, 0x1B873593); - h = imul(h << 13 | h >>> -13, 5); - h = (h + 0xE6546B64 | 0) ^ size; - h = imul(h ^ h >>> 16, 0x85EBCA6B); - h = imul(h ^ h >>> 13, 0xC2B2AE35); - h = smi(h ^ h >>> 16); - return h; - } - - function hashMerge(a, b) { - return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int - } - - createClass(OrderedSet, Set); - - // @pragma Construction - - function OrderedSet(value) { - return value === null || value === undefined ? emptyOrderedSet() : - isOrderedSet(value) ? value : - emptyOrderedSet().withMutations(function(set ) { - var iter = SetIterable(value); - assertNotInfinite(iter.size); - iter.forEach(function(v ) {return set.add(v)}); - }); - } - - OrderedSet.of = function(/*...values*/) { - return this(arguments); - }; - - OrderedSet.fromKeys = function(value) { - return this(KeyedIterable(value).keySeq()); - }; - - OrderedSet.prototype.toString = function() { - return this.__toString('OrderedSet {', '}'); - }; - - - function isOrderedSet(maybeOrderedSet) { - return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet); - } - - OrderedSet.isOrderedSet = isOrderedSet; - - var OrderedSetPrototype = OrderedSet.prototype; - OrderedSetPrototype[IS_ORDERED_SENTINEL] = true; - OrderedSetPrototype.zip = IndexedIterablePrototype.zip; - OrderedSetPrototype.zipWith = IndexedIterablePrototype.zipWith; - - OrderedSetPrototype.__empty = emptyOrderedSet; - OrderedSetPrototype.__make = makeOrderedSet; - - function makeOrderedSet(map, ownerID) { - var set = Object.create(OrderedSetPrototype); - set.size = map ? map.size : 0; - set._map = map; - set.__ownerID = ownerID; - return set; - } - - var EMPTY_ORDERED_SET; - function emptyOrderedSet() { - return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap())); - } - - var Immutable = { - - Iterable: Iterable, - - Seq: Seq, - Collection: Collection, - Map: Map, - OrderedMap: OrderedMap, - List: List, - Stack: Stack, - Set: Set, - OrderedSet: OrderedSet, - - Record: Record, - Range: Range, - Repeat: Repeat, - - is: is, - fromJS: fromJS, - hash: hash - - }; - - exports['default'] = Immutable; - exports.Iterable = Iterable; - exports.Seq = Seq; - exports.Collection = Collection; - exports.Map = Map; - exports.OrderedMap = OrderedMap; - exports.List = List; - exports.Stack = Stack; - exports.Set = Set; - exports.OrderedSet = OrderedSet; - exports.Record = Record; - exports.Range = Range; - exports.Repeat = Repeat; - exports.is = is; - exports.fromJS = fromJS; - exports.hash = hash; - -})); \ No newline at end of file diff --git a/dist/immutable.js.flow b/dist/immutable.js.flow deleted file mode 100644 index ac9551132b..0000000000 --- a/dist/immutable.js.flow +++ /dev/null @@ -1,1099 +0,0 @@ -/** - * This file provides type definitions for use with the Flow type checker. - * - * An important caveat when using these definitions is that the types for - * `Iterable.Keyed`, `Iterable.Indexed`, `Seq.Keyed`, and so on are stubs. - * When referring to those types, you can get the proper definitions by - * importing the types `KeyedIterable`, `IndexedIterable`, `KeyedSeq`, etc. - * For example, - * - * import { Seq } from 'immutable' - * import type { IndexedIterable, IndexedSeq } from 'immutable' - * - * const someSeq: IndexedSeq = Seq.Indexed.of(1, 2, 3) - * - * function takesASeq>(iter: TS): TS { - * return iter.butLast() - * } - * - * takesASeq(someSeq) - * - * @flow - */ - -/* - * Alias for ECMAScript `Iterable` type, declared in - * https://github.com/facebook/flow/blob/master/lib/core.js - * - * Note that Immutable values implement the `ESIterable` interface. - */ -type ESIterable<+T> = $Iterable; - -declare class _Iterable { - equals(other: mixed): boolean; - hashCode(): number; - get(key: K, _: empty): V | void; - get(key: K, notSetValue: NSV): V | NSV; - has(key: K): boolean; - includes(value: V): boolean; - contains(value: V): boolean; - first(): V | void; - last(): V | void; - - getIn(searchKeyPath: ESIterable, notSetValue?: mixed): any; - hasIn(searchKeyPath: ESIterable): boolean; - - toJS(): mixed; - toArray(): Array; - toObject(): { [key: string]: V }; - toMap(): Map; - toOrderedMap(): OrderedMap; - toSet(): Set; - toOrderedSet(): OrderedSet; - toList(): List; - toStack(): Stack; - toSeq(): Seq; - toKeyedSeq(): KeyedSeq; - toIndexedSeq(): IndexedSeq; - toSetSeq(): SetSeq; - - keys(): Iterator; - values(): Iterator; - entries(): Iterator<[K, V]>; - - keySeq(): IndexedSeq; - valueSeq(): IndexedSeq; - entrySeq(): IndexedSeq<[K, V]>; - - reverse(): this; - sort(comparator?: (valueA: V, valueB: V) => number): this; - - sortBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): this; - - groupBy( - grouper: (value: V, key: K, iter: this) => G, - context?: mixed - ): KeyedSeq; - - forEach( - sideEffect: (value: V, key: K, iter: this) => any, - context?: mixed - ): number; - - slice(begin?: number, end?: number): this; - rest(): this; - butLast(): this; - skip(amount: number): this; - skipLast(amount: number): this; - skipWhile(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this; - skipUntil(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this; - take(amount: number): this; - takeLast(amount: number): this; - takeWhile(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this; - takeUntil(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this; - - filter( - predicate: (value: V, key: K, iter: this) => mixed, - context?: mixed - ): this; - - filterNot( - predicate: (value: V, key: K, iter: this) => mixed, - context?: mixed - ): this; - - reduce( - reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: mixed, - ): R; - - reduceRight( - reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: mixed, - ): R; - - every(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): boolean; - some(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): boolean; - join(separator?: string): string; - isEmpty(): boolean; - count(predicate?: (value: V, key: K, iter: this) => mixed, context?: mixed): number; - countBy(grouper: (value: V, key: K, iter: this) => G, context?: mixed): Map; - - find( - predicate: (value: V, key: K, iter: this) => mixed, - context?: mixed, - notSetValue?: NSV - ): V | NSV; - findLast( - predicate: (value: V, key: K, iter: this) => mixed, - context?: mixed, - notSetValue?: NSV - ): V | NSV; - - findEntry(predicate: (value: V, key: K, iter: this) => mixed): [K, V] | void; - findLastEntry(predicate: (value: V, key: K, iter: this) => mixed): [K, V] | void; - - findKey(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): K | void; - findLastKey(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): K | void; - - keyOf(searchValue: V): K | void; - lastKeyOf(searchValue: V): K | void; - - max(comparator?: (valueA: V, valueB: V) => number): V; - maxBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): V; - min(comparator?: (valueA: V, valueB: V) => number): V; - minBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): V; - - isSubset(iter: ESIterable): boolean; - isSuperset(iter: ESIterable): boolean; -} - -declare function isIterable(maybeIterable: mixed): boolean %checks(maybeIterable instanceof Iterable); -declare function isKeyed(maybeKeyed: mixed): boolean %checks(maybeKeyed instanceof KeyedIterable); -declare function isIndexed(maybeIndexed: mixed): boolean %checks(maybeIndexed instanceof IndexedIterable); -declare function isAssociative(maybeAssociative: mixed): boolean %checks( - maybeAssociative instanceof KeyedIterable || - maybeAssociative instanceof IndexedIterable -); -declare function isOrdered(maybeOrdered: mixed): boolean %checks( - maybeOrdered instanceof IndexedIterable || - maybeOrdered instanceof OrderedMap || - maybeOrdered instanceof OrderedSet -); - -declare class Iterable extends _Iterable { - static Keyed: typeof KeyedIterable; - static Indexed: typeof IndexedIterable; - static Set: typeof SetIterable; - - static isIterable: typeof isIterable; - static isKeyed: typeof isKeyed; - static isIndexed: typeof isIndexed; - static isAssociative: typeof isAssociative; - static isOrdered: typeof isOrdered; -} - -declare class KeyedIterable extends Iterable { - static (iter?: ESIterable<[K, V]>): KeyedIterable; - static (obj?: { [key: K]: V }): KeyedIterable; - - toJS(): { [key: string]: mixed }; - @@iterator(): Iterator<[K, V]>; - toSeq(): KeyedSeq; - flip(): KeyedIterable; - - concat(...iters: ESIterable<[K, V]>[]): this; - - map( - mapper: (value: V, key: K, iter: this) => M, - context?: mixed - ): KeyedIterable; - - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: mixed - ): KeyedIterable; - - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: mixed - ): KeyedIterable; - - flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable<[KM, VM]>, - context?: mixed - ): KeyedIterable; - - flatten(depth?: number): KeyedIterable; - flatten(shallow?: boolean): KeyedIterable; -} - -Iterable.Keyed = KeyedIterable - -declare class IndexedIterable<+T> extends Iterable { - static (iter?: ESIterable): IndexedIterable; - - toJS(): Array; - @@iterator(): Iterator; - toSeq(): IndexedSeq; - fromEntrySeq(): KeyedSeq; - interpose(separator: T): this; - interleave(...iterables: ESIterable[]): this; - splice( - index: number, - removeNum: number, - ...values: T[] - ): this; - - zip( - a: ESIterable, - _: empty - ): IndexedIterable<[T, A]>; - zip( - a: ESIterable, - b: ESIterable, - _: empty - ): IndexedIterable<[T, A, B]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): IndexedIterable<[T, A, B, C]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): IndexedIterable<[T, A, B, C, D]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): IndexedIterable<[T, A, B, C, D, E]>; - - zipWith( - zipper: (value: T, a: A) => R, - a: ESIterable, - _: empty - ): IndexedIterable; - zipWith( - zipper: (value: T, a: A, b: B) => R, - a: ESIterable, - b: ESIterable, - _: empty - ): IndexedIterable; - zipWith( - zipper: (value: T, a: A, b: B, c: C) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): IndexedIterable; - zipWith( - zipper: (value: T, a: A, b: B, c: C, d: D) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): IndexedIterable; - zipWith( - zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): IndexedIterable; - - indexOf(searchValue: T): number; - lastIndexOf(searchValue: T): number; - findIndex( - predicate: (value: T, index: number, iter: this) => mixed, - context?: mixed - ): number; - findLastIndex( - predicate: (value: T, index: number, iter: this) => mixed, - context?: mixed - ): number; - - concat(...iters: ESIterable[]): this; - - map( - mapper: (value: T, index: number, iter: this) => M, - context?: mixed - ): IndexedIterable; - - flatMap( - mapper: (value: T, index: number, iter: this) => ESIterable, - context?: mixed - ): IndexedIterable; - - flatten(depth?: number): IndexedIterable; - flatten(shallow?: boolean): IndexedIterable; -} - -declare class SetIterable<+T> extends Iterable { - static (iter?: ESIterable): SetIterable; - - toJS(): Array; - @@iterator(): Iterator; - toSeq(): SetSeq; - - concat(...iters: ESIterable[]): this; - - // `map` and `flatMap` cannot be defined further up the hiearchy, because the - // implementation for `KeyedIterable` allows the value type to change without - // constraining the key type. That does not work for `SetIterable` - the value - // and key types *must* match. - map( - mapper: (value: T, value: T, iter: this) => M, - context?: mixed - ): SetIterable; - - flatMap( - mapper: (value: T, value: T, iter: this) => ESIterable, - context?: mixed - ): SetIterable; - - flatten(depth?: number): SetIterable; - flatten(shallow?: boolean): SetIterable; -} - -declare class Collection extends _Iterable { - static Keyed: typeof KeyedCollection; - static Indexed: typeof IndexedCollection; - static Set: typeof SetCollection; - - size: number; -} - -declare class KeyedCollection extends Collection mixins KeyedIterable { - toSeq(): KeyedSeq; -} - -declare class IndexedCollection<+T> extends Collection mixins IndexedIterable { - toSeq(): IndexedSeq; -} - -declare class SetCollection<+T> extends Collection mixins SetIterable { - toSeq(): SetSeq; -} - -declare function isSeq(maybeSeq: mixed): boolean %checks(maybeSeq instanceof Seq); -declare class Seq extends _Iterable { - static Keyed: typeof KeyedSeq; - static Indexed: typeof IndexedSeq; - static Set: typeof SetSeq; - - static (iter: KeyedSeq): KeyedSeq; - static (iter: SetSeq): SetSeq; - static (iter?: ESIterable): IndexedSeq; - static (iter: { [key: K]: V }): KeyedSeq; - - static of(...values: T[]): IndexedSeq; - - static isSeq: typeof isSeq; - - size?: number; - cacheResult(): this; - toSeq(): this; -} - -declare class KeyedSeq extends Seq mixins KeyedIterable { - static (iter?: ESIterable<[K, V]>): KeyedSeq; - static (iter?: { [key: K]: V }): KeyedSeq; - - // Override specialized return types - flip(): KeyedSeq; - - map( - mapper: (value: V, key: K, iter: this) => M, - context?: mixed - ): KeyedSeq; - - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: mixed - ): KeyedSeq; - - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: mixed - ): KeyedSeq; - - flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable<[KM, VM]>, - context?: mixed - ): KeyedSeq; - - flatten(depth?: number): KeyedSeq; - flatten(shallow?: boolean): KeyedSeq; -} - -declare class IndexedSeq<+T> extends Seq mixins IndexedIterable { - static (iter?: ESIterable): IndexedSeq; - - static of(...values: T[]): IndexedSeq; - - // Override specialized return types - map( - mapper: (value: T, index: number, iter: this) => M, - context?: mixed - ): IndexedSeq; - - flatMap( - mapper: (value: T, index: number, iter: this) => ESIterable, - context?: mixed - ): IndexedSeq; - - flatten(depth?: number): IndexedSeq; - flatten(shallow?: boolean): IndexedSeq; - - zip( - a: ESIterable, - _: empty - ): IndexedSeq<[T, A]>; - zip( - a: ESIterable, - b: ESIterable, - _: empty - ): IndexedSeq<[T, A, B]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): IndexedSeq<[T, A, B, C]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): IndexedSeq<[T, A, B, C, D]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): IndexedSeq<[T, A, B, C, D, E]>; - - zipWith( - zipper: (value: T, a: A) => R, - a: ESIterable, - _: empty - ): IndexedSeq; - zipWith( - zipper: (value: T, a: A, b: B) => R, - a: ESIterable, - b: ESIterable, - _: empty - ): IndexedSeq; - zipWith( - zipper: (value: T, a: A, b: B, c: C) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): IndexedSeq; - zipWith( - zipper: (value: T, a: A, b: B, c: C, d: D) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): IndexedSeq; - zipWith( - zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): IndexedSeq; -} - -declare class SetSeq<+T> extends Seq mixins SetIterable { - static (iter?: ESIterable): IndexedSeq; - - static of(...values: T[]): SetSeq; - - // Override specialized return types - map( - mapper: (value: T, value: T, iter: this) => M, - context?: mixed - ): SetSeq; - - flatMap( - mapper: (value: T, value: T, iter: this) => ESIterable, - context?: mixed - ): SetSeq; - - flatten(depth?: number): SetSeq; - flatten(shallow?: boolean): SetSeq; -} - -declare function isList(maybeList: mixed): boolean %checks(maybeList instanceof List); -declare class List<+T> extends IndexedCollection { - static (iterable?: ESIterable): List; - - static of(...values: T[]): List; - - static isList: typeof isList; - - set(index: number, value: U): List; - delete(index: number): this; - remove(index: number): this; - insert(index: number, value: U): List; - clear(): this; - push(...values: U[]): List; - pop(): this; - unshift(...values: U[]): List; - shift(): this; - - update(updater: (value: this) => List): List; - update(index: number, updater: (value: T) => U): List; - update(index: number, notSetValue: U, updater: (value: T) => U): List; - - merge(...iterables: ESIterable[]): List; - - mergeWith( - merger: (previous: T, next: U, key: number) => V, - ...iterables: ESIterable[] - ): List; - - mergeDeep(...iterables: ESIterable[]): List; - - mergeDeepWith( - merger: (previous: T, next: U, key: number) => V, - ...iterables: ESIterable[] - ): List; - - setSize(size: number): this; - setIn(keyPath: ESIterable, value: mixed): this; - deleteIn(keyPath: ESIterable, value: mixed): this; - removeIn(keyPath: ESIterable, value: mixed): this; - - updateIn( - keyPath: ESIterable, - notSetValue: mixed, - updater: (value: any) => mixed - ): this; - updateIn( - keyPath: ESIterable, - updater: (value: any) => mixed - ): this; - - mergeIn(keyPath: ESIterable, ...iterables: ESIterable[]): this; - mergeDeepIn(keyPath: ESIterable, ...iterables: ESIterable[]): this; - - withMutations(mutator: (mutable: this) => this | void): this; - asMutable(): this; - asImmutable(): this; - - // Override specialized return types - map( - mapper: (value: T, index: number, iter: this) => M, - context?: mixed - ): List; - - flatMap( - mapper: (value: T, index: number, iter: this) => ESIterable, - context?: mixed - ): List; - - flatten(depth?: number): List; - flatten(shallow?: boolean): List; - - zip( - a: ESIterable, - _: empty - ): List<[T, A]>; - zip( - a: ESIterable, - b: ESIterable, - _: empty - ): List<[T, A, B]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): List<[T, A, B, C]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): List<[T, A, B, C, D]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): List<[T, A, B, C, D, E]>; - - zipWith( - zipper: (value: T, a: A) => R, - a: ESIterable, - _: empty - ): List; - zipWith( - zipper: (value: T, a: A, b: B) => R, - a: ESIterable, - b: ESIterable, - _: empty - ): List; - zipWith( - zipper: (value: T, a: A, b: B, c: C) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): List; - zipWith( - zipper: (value: T, a: A, b: B, c: C, d: D) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): List; - zipWith( - zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): List; -} - -declare function isMap(maybeMap: mixed): boolean %checks(maybeMap instanceof Map); -declare class Map extends KeyedCollection { - static (obj?: {[key: K]: V}): Map; - static (iterable: ESIterable<[K, V]>): Map; - - static isMap: typeof isMap; - - set(key: K_, value: V_): Map; - delete(key: K): this; - remove(key: K): this; - clear(): this; - - deleteAll(keys: ESIterable): Map; - removeAll(keys: ESIterable): Map; - - update(updater: (value: this) => Map): Map; - update(key: K, updater: (value: V) => V_): Map; - update(key: K, notSetValue: V_, updater: (value: V) => V_): Map; - - merge( - ...iterables: (ESIterable<[K_, V_]> | { [key: K_]: V_ })[] - ): Map; - - mergeWith( - merger: (previous: V, next: W, key: K) => X, - ...iterables: (ESIterable<[K_, W]> | { [key: K_]: W })[] - ): Map; - - mergeDeep( - ...iterables: (ESIterable<[K_, V_]> | { [key: K_]: V_ })[] - ): Map; - - mergeDeepWith( - merger: (previous: V, next: W, key: K) => X, - ...iterables: (ESIterable<[K_, W]> | { [key: K_]: W })[] - ): Map; - - setIn(keyPath: ESIterable, value: mixed): this; - deleteIn(keyPath: ESIterable, value: mixed): this; - removeIn(keyPath: ESIterable, value: mixed): this; - - updateIn( - keyPath: ESIterable, - notSetValue: mixed, - updater: (value: any) => mixed - ): this; - updateIn( - keyPath: ESIterable, - updater: (value: any) => mixed - ): this; - - mergeIn( - keyPath: ESIterable, - ...iterables: (ESIterable | { [key: string]: mixed })[] - ): this; - mergeDeepIn( - keyPath: ESIterable, - ...iterables: (ESIterable | { [key: string]: mixed })[] - ): this; - - withMutations(mutator: (mutable: this) => this | void): this; - asMutable(): this; - asImmutable(): this; - - // Override specialized return types - flip(): Map; - - map( - mapper: (value: V, key: K, iter: this) => M, - context?: mixed - ): Map; - - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: mixed - ): Map; - - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: mixed - ): Map; - - flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable<[KM, VM]>, - context?: mixed - ): Map; - - flatten(depth?: number): Map; - flatten(shallow?: boolean): Map; -} - -declare function isOrderedMap(maybeOrderedMap: mixed): boolean %checks(maybeOrderedMap instanceof OrderedMap); -declare class OrderedMap extends KeyedCollection { - static (obj?: {[key: K]: V}): OrderedMap; - static (iterable: ESIterable<[K, V]>): OrderedMap; - - static isOrderedMap: typeof isOrderedMap; - - set(key: K_, value: V_): OrderedMap; - delete(key: K): this; - remove(key: K): this; - clear(): this; - - update(updater: (value: this) => OrderedMap): OrderedMap; - update(key: K, updater: (value: V) => V_): OrderedMap; - update(key: K, notSetValue: V_, updater: (value: V) => V_): OrderedMap; - - merge( - ...iterables: (ESIterable<[K_, V_]> | { [key: K_]: V_ })[] - ): OrderedMap; - - mergeWith( - merger: (previous: V, next: W, key: K) => X, - ...iterables: (ESIterable<[K_, W]> | { [key: K_]: W })[] - ): OrderedMap; - - mergeDeep( - ...iterables: (ESIterable<[K_, V_]> | { [key: K_]: V_ })[] - ): OrderedMap; - - mergeDeepWith( - merger: (previous: V, next: W, key: K) => X, - ...iterables: (ESIterable<[K_, W]> | { [key: K_]: W })[] - ): OrderedMap; - - setIn(keyPath: ESIterable, value: mixed): OrderedMap; - deleteIn(keyPath: ESIterable, value: mixed): this; - removeIn(keyPath: ESIterable, value: mixed): this; - - updateIn( - keyPath: ESIterable, - notSetValue: mixed, - updater: (value: any) => mixed - ): this; - updateIn( - keyPath: ESIterable, - updater: (value: any) => mixed - ): this; - - mergeIn( - keyPath: ESIterable, - ...iterables: (ESIterable | { [key: string]: mixed })[] - ): this; - mergeDeepIn( - keyPath: ESIterable, - ...iterables: (ESIterable | { [key: string]: mixed })[] - ): this; - - withMutations(mutator: (mutable: this) => this | void): this; - asMutable(): this; - asImmutable(): this; - - // Override specialized return types - flip(): OrderedMap; - - map( - mapper: (value: V, key: K, iter: this) => M, - context?: mixed - ): OrderedMap; - - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: mixed - ): OrderedMap; - - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: mixed - ): OrderedMap; - - flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable<[KM, VM]>, - context?: mixed - ): OrderedMap; - - flatten(depth?: number): OrderedMap; - flatten(shallow?: boolean): OrderedMap; -} - -declare function isSet(maybeSet: mixed): boolean %checks(maybeSet instanceof Set); -declare class Set<+T> extends SetCollection { - static (iterable?: ESIterable): Set; - - static of(...values: T[]): Set; - static fromKeys(iter: ESIterable<[T, mixed]>): Set; - static fromKeys(object: { [key: K]: V }): Set; - - static isSet: typeof isSet; - - add(value: U): Set; - delete(value: T): this; - remove(value: T): this; - clear(): this; - union(...iterables: ESIterable[]): Set; - merge(...iterables: ESIterable[]): Set; - intersect(...iterables: ESIterable[]): Set; - subtract(...iterables: ESIterable[]): this; - - withMutations(mutator: (mutable: this) => this | void): this; - asMutable(): this; - asImmutable(): this; - - // Override specialized return types - map( - mapper: (value: T, value: T, iter: this) => M, - context?: mixed - ): Set; - - flatMap( - mapper: (value: T, value: T, iter: this) => ESIterable, - context?: mixed - ): Set; - - flatten(depth?: number): Set; - flatten(shallow?: boolean): Set; -} - -// Overrides except for `isOrderedSet` are for specialized return types -declare function isOrderedSet(maybeOrderedSet: mixed): boolean %checks(maybeOrderedSet instanceof OrderedSet); -declare class OrderedSet<+T> extends Set { - static (iterable: ESIterable): OrderedSet; - static (_: void): OrderedSet; - - static of(...values: T[]): OrderedSet; - static fromKeys(iter: ESIterable<[T, mixed]>): OrderedSet; - static fromKeys(object: { [key: K]: V }): OrderedSet; - - static isOrderedSet: typeof isOrderedSet; - - add(value: U): OrderedSet; - union(...iterables: ESIterable[]): OrderedSet; - merge(...iterables: ESIterable[]): OrderedSet; - intersect(...iterables: ESIterable[]): OrderedSet; - - map( - mapper: (value: T, value: T, iter: this) => M, - context?: mixed - ): OrderedSet; - - flatMap( - mapper: (value: T, value: T, iter: this) => ESIterable, - context?: mixed - ): OrderedSet; - - flatten(depth?: number): OrderedSet; - flatten(shallow?: boolean): OrderedSet; - - zip( - a: ESIterable, - _: empty - ): OrderedSet<[T, A]>; - zip( - a: ESIterable, - b: ESIterable, - _: empty - ): OrderedSet<[T, A, B]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): OrderedSet<[T, A, B, C]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): OrderedSet<[T, A, B, C, D]>; - zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): OrderedSet<[T, A, B, C, D, E]>; - - zipWith( - zipper: (value: T, a: A) => R, - a: ESIterable, - _: empty - ): OrderedSet; - zipWith( - zipper: (value: T, a: A, b: B) => R, - a: ESIterable, - b: ESIterable, - _: empty - ): OrderedSet; - zipWith( - zipper: (value: T, a: A, b: B, c: C) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): OrderedSet; - zipWith( - zipper: (value: T, a: A, b: B, c: C, d: D) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): OrderedSet; - zipWith( - zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): OrderedSet; -} - -declare function isStack(maybeStack: mixed): boolean %checks(maybeStack instanceof Stack); -declare class Stack<+T> extends IndexedCollection { - static (iterable?: ESIterable): Stack; - - static isStack(maybeStack: mixed): boolean; - static of(...values: T[]): Stack; - - static isStack: typeof isStack; - - peek(): T; - clear(): this; - unshift(...values: U[]): Stack; - unshiftAll(iter: ESIterable): Stack; - shift(): this; - push(...values: U[]): Stack; - pushAll(iter: ESIterable): Stack; - pop(): this; - - withMutations(mutator: (mutable: this) => this | void): this; - asMutable(): this; - asImmutable(): this; - - // Override specialized return types - map( - mapper: (value: T, index: number, iter: this) => M, - context?: mixed - ): Stack; - - flatMap( - mapper: (value: T, index: number, iter: this) => ESIterable, - context?: mixed - ): Stack; - - flatten(depth?: number): Stack; - flatten(shallow?: boolean): Stack; -} - -declare function Range(start?: number, end?: number, step?: number): IndexedSeq; -declare function Repeat(value: T, times?: number): IndexedSeq; - -// TODO: Once flow can extend normal Objects we can change this back to actually reflect Record behavior. -// For now fallback to any to not break existing code -declare class Record { - static (spec: T, name?: string): /*T & Record*/any; - - static getDescriptiveName(record: Record): string; - - get(key: $Keys): A; - set(key: $Keys, value: A): /*T & Record*/this; - remove(key: $Keys): /*T & Record*/this; -} - -declare function fromJS(json: mixed, reviver?: (k: any, v: Iterable) => any): any; -declare function is(first: mixed, second: mixed): boolean; -declare function hash(value: mixed): number; - -export { - Iterable, - Collection, - Seq, - - List, - Map, - OrderedMap, - OrderedSet, - Range, - Repeat, - Record, - Set, - Stack, - - fromJS, - is, - hash, -} - -export default { - Iterable, - Collection, - Seq, - - List, - Map, - OrderedMap, - OrderedSet, - Range, - Repeat, - Record, - Set, - Stack, - - fromJS, - is, - hash, -} - -export type { - KeyedIterable, - IndexedIterable, - SetIterable, - KeyedCollection, - IndexedCollection, - SetCollection, - KeyedSeq, - IndexedSeq, - SetSeq, -} diff --git a/dist/immutable.min.js b/dist/immutable.min.js deleted file mode 100644 index adae26a3c6..0000000000 --- a/dist/immutable.min.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.Immutable={})}(this,function(t){"use strict";function e(t){return t>>>1&1073741824|3221225471&t}function r(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var r=typeof t;if("number"===r){if(t!==t||t===1/0)return 0;var u=0|t;for(u!==t&&(u^=4294967295*t);t>4294967295;)t/=4294967295,u^=t;return e(u)}if("string"===r)return t.length>lr?n(t):i(t);if("function"==typeof t.hashCode)return t.hashCode();if("object"===r)return o(t);if("function"==typeof t.toString)return i(""+t);throw Error("Value type "+r+" cannot be hashed.")}function n(t){var e=dr[t];return void 0===e&&(e=i(t),yr===vr&&(yr=0,dr={}),yr++,dr[t]=e),e}function i(t){for(var r=0,n=0;n0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function s(t,e){e&&(t.prototype=Object.create(e.prototype)),t.prototype.constructor=t}function a(t){return _(t)?t:K(t)}function h(t){return p(t)?t:L(t)}function f(t){ -return l(t)?t:T(t)}function c(t){return _(t)&&!v(t)?t:W(t)}function _(t){return!(!t||!t[mr])}function p(t){return!(!t||!t[gr])}function l(t){return!(!t||!t[wr])}function v(t){return p(t)||l(t)}function y(t){return!(!t||!t[Sr])}function d(t){return t.value=!1,t}function m(t){t&&(t.value=!0)}function g(){}function w(t,e){e=e||0;for(var r=Math.max(0,t.length-e),n=Array(r),i=0;i>>0;if(""+r!==e||4294967295===r)return NaN;e=r}return e<0?S(t)+e:e}function I(){return!0}function b(t,e,r){return(0===t||void 0!==r&&t<=-r)&&(void 0===e||void 0!==r&&e>=r)}function M(t,e){return q(t,e,0)}function D(t,e){return q(t,e,e)}function q(t,e,r){return void 0===t?r:t<0?e===1/0?e:0|Math.max(0,e+t):void 0===e||e===t?t:0|Math.min(e,t)}function E(t){this.next=t}function O(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function x(){return{value:void 0,done:!0}}function A(t){return!!R(t)}function k(t){return t&&"function"==typeof t.next}function j(t){var e=R(t);return e&&e.call(t)}function R(t){var e=t&&(Mr&&t[Mr]||t["@@iterator"]);if("function"==typeof e)return e}function U(t){return t&&"number"==typeof t.length}function K(t){return null===t||void 0===t?H():_(t)?t.toSeq():Y(t)}function L(t){return null===t||void 0===t?H().toKeyedSeq():_(t)?p(t)?t.toSeq():t.fromEntrySeq():V(t)}function T(t){return null===t||void 0===t?H():_(t)?p(t)?t.entrySeq():t.toIndexedSeq():Q(t)}function W(t){return(null===t||void 0===t?H():_(t)?p(t)?t.entrySeq():t:Q(t)).toSetSeq()}function B(t){this._array=t,this.size=t.length}function J(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function C(t){this._iterable=t,this.size=t.length||t.size}function N(t){this._iterator=t,this._iteratorCache=[]}function P(t){return!(!t||!t["@@__IMMUTABLE_SEQ__@@"])}function H(){return qr||(qr=new B([]))}function V(t){ -var e=Array.isArray(t)?new B(t).fromEntrySeq():k(t)?new N(t).fromEntrySeq():A(t)?new C(t).fromEntrySeq():"object"==typeof t?new J(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function Q(t){var e=X(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function Y(t){var e=X(t)||"object"==typeof t&&new J(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function X(t){return U(t)?new B(t):k(t)?new N(t):A(t)?new C(t):void 0}function F(t,e){return e?G(e,t,"",{"":t}):Z(t)}function G(t,e,r,n){return Array.isArray(e)?t.call(n,r,T(e).map(function(r,n){return G(t,r,n,e)})):$(e)?t.call(n,r,L(e).map(function(r,n){return G(t,r,n,e)})):e}function Z(t){return Array.isArray(t)?T(t).map(Z).toList():$(t)?L(t).map(Z).toMap():t}function $(t){return t&&(t.constructor===Object||void 0===t.constructor)}function tt(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function et(t,e){if(t===e)return!0;if(!_(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||p(t)!==p(e)||l(t)!==l(e)||y(t)!==y(e))return!1;if(0===t.size&&0===e.size)return!0;var r=!v(t);if(y(t)){var n=t.entries();return e.every(function(t,e){var i=n.next().value;return i&&tt(i[1],t)&&(r||tt(i[0],e))})&&n.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var o=t;t=e,e=o}var u=!0,s=e.__iterate(function(e,n){if(r?!t.has(e):i?!tt(e,t.get(n,zr)):!tt(t.get(n,zr),e))return u=!1,!1});return u&&t.size===s}function rt(t,e){if(!(this instanceof rt))return new rt(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(Er)return Er;Er=this}} -function nt(t,e){if(!t)throw Error(e)}function it(t,e,r){if(!(this instanceof it))return new it(t,e,r);if(nt(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),r=void 0===r?1:Math.abs(r),e>>r),s=31&(0===r?n:n>>>r);return new pt(e,1<>>=1)u[s]=1&r?e[o++]:void 0;return u[n]=i,new lt(t,o+1,u)}function Ot(t,e,r){for(var n=[],i=0;i>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function Ut(t,e,r,n){var i=n?t:w(t);return i[e]=r,i}function Kt(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var o=Array(i),u=0,s=0;s0&&n<32?Ct(0,n,5,null,new Bt(r.toArray())):e.withMutations(function(t){t.setSize(n),r.forEach(function(e,r){return t.set(r,e)})}))}function Wt(t){return!(!t||!t[Kr])}function Bt(t,e){this.array=t,this.ownerID=e} -function Jt(t,e){function r(t,e,r){return 0===e?n(t,r):i(t,e,r)}function n(t,r){var n=r===s?a&&a.array:t&&t.array,i=r>o?0:o-r,h=u-r;return h>32&&(h=32),function(){if(i===h)return Wr;var t=e?--h:i++;return n&&n[t]}}function i(t,n,i){var s,a=t&&t.array,h=i>o?0:o-i>>n,f=(u-i>>n)+1;return f>32&&(f=32),function(){for(;;){if(s){var t=s();if(t!==Wr)return t;s=null}if(h===f)return Wr;var o=e?--f:h++;s=r(a&&a[o],n-5,i+(o<=t.size||e<0)return t.withMutations(function(t){e<0?Yt(t,e).set(0,r):Yt(t,0,e+1).set(e,r)});e+=t._origin;var n=t._tail,i=t._root,o=d(br);return e>=Ft(t._capacity)?n=Ht(n,t.__ownerID,0,e,r,o):i=Ht(i,t.__ownerID,t._level,e,r,o),o.value?t.__ownerID?(t._root=i,t._tail=n,t.__hash=void 0,t.__altered=!0,t):Ct(t._origin,t._capacity,t._level,i,n):t}function Ht(t,e,r,n,i,o){var u=n>>>r&31,s=t&&u0){var h=t&&t.array[u],f=Ht(h,e,r-5,n,i,o);return f===h?t:(a=Vt(t,e),a.array[u]=f,a)}return s&&t.array[u]===i?t:(m(o),a=Vt(t,e),void 0===i&&u===a.array.length-1?a.array.pop():a.array[u]=i,a)}function Vt(t,e){return e&&t&&e===t.ownerID?t:new Bt(t?t.array.slice():[],e)}function Qt(t,e){if(e>=Ft(t._capacity))return t._tail;if(e<1<0;)r=r.array[e>>>n&31],n-=5;return r}}function Yt(t,e,r){void 0!==e&&(e|=0),void 0!==r&&(r|=0);var n=t.__ownerID||new g,i=t._origin,o=t._capacity,u=i+e,s=void 0===r?o:r<0?o+r:i+r;if(u===i&&s===o)return t;if(u>=s)return t.clear();for(var a=t._level,h=t._root,f=0;u+f<0;)h=new Bt(h&&h.array.length?[void 0,h]:[],n),a+=5,f+=1<=1<c?new Bt([],n):p;if(p&&_>c&&u5;y-=5){var d=c>>>y&31;v=v.array[d]=Vt(v.array[d],n)}v.array[c>>>5&31]=p}if(s=_)u-=_,s-=_,a=5,h=null,l=l&&l.removeBefore(n,0,u);else if(u>i||_>>a&31;if(m!==_>>>a&31)break;m&&(f+=(1<i&&(h=h.removeBefore(n,a,u-f)),h&&_i&&(i=s.size),_(u)||(s=s.map(function(t){return F(t)})),n.push(s)}return i>t.size&&(t=t.setSize(i)),kt(t,e,n)}function Ft(t){return t<32?0:t-1>>>5<<5}function Gt(t){return null===t||void 0===t?te():Zt(t)?t:te().withMutations(function(e){var r=h(t);ht(r.size),r.forEach(function(t,r){return e.set(r,t)})})}function Zt(t){return ct(t)&&y(t)}function $t(t,e,r,n){var i=Object.create(Gt.prototype);return i.size=t?t.size:0,i._map=t,i._list=e,i.__ownerID=r,i.__hash=n,i}function te(){return Br||(Br=$t(St(),Nt()))}function ee(t,e,r){var n,i,o=t._map,u=t._list,s=o.get(e),a=void 0!==s;if(r===zr){if(!a)return t;u.size>=32&&u.size>=2*o.size?(i=u.filter(function(t,e){return void 0!==t&&s!==e}),n=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(n.__ownerID=i.__ownerID=t.__ownerID)):(n=o.remove(e),i=s===u.size-1?u.pop():u.set(s,void 0))}else if(a){if(r===u.get(s)[1])return t;n=o,i=u.set(s,[e,r])}else n=o.set(e,u.size),i=u.set(u.size,[e,r]);return t.__ownerID?(t.size=n.size,t._map=n,t._list=i,t.__hash=void 0,t):$t(n,i)}function re(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function ne(t){this._iter=t,this.size=t.size}function ie(t){this._iter=t,this.size=t.size}function oe(t){this._iter=t,this.size=t.size}function ue(t){var e=De(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){ -var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=qe,e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e.__iteratorUncached=function(e,r){if(2===e){var n=t.__iterator(e,r);return new E(function(){var t=n.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(1===e?0:1,r)},e}function se(t,e,r){var n=De(t);return n.size=t.size,n.has=function(e){return t.has(e)},n.get=function(n,i){var o=t.get(n,zr);return o===zr?i:e.call(r,o,n,t)},n.__iterateUncached=function(n,i){var o=this;return t.__iterate(function(t,i,u){return n(e.call(r,t,i,u),i,o)!==!1},i)},n.__iteratorUncached=function(n,i){var o=t.__iterator(2,i);return new E(function(){var i=o.next();if(i.done)return i;var u=i.value,s=u[0];return O(n,s,e.call(r,u[1],s,t),i)})},n}function ae(t,e){var r=this,n=De(t);return n._iter=t,n.size=t.size,n.reverse=function(){return t},t.flip&&(n.flip=function(){var e=ue(t);return e.reverse=function(){return t.flip()},e}),n.get=function(r,n){return t.get(e?r:-1-r,n)},n.has=function(r){return t.has(e?r:-1-r)},n.includes=function(e){return t.includes(e)},n.cacheResult=qe,n.__iterate=function(r,n){var i=this,o=0;return n&&S(t),t.__iterate(function(t,u){return r(t,e?u:n?i.size-++o:o++,i)},!n)},n.__iterator=function(n,i){var o=0;i&&S(t);var u=t.__iterator(2,!i);return new E(function(){var t=u.next();if(t.done)return t;var s=t.value;return O(n,e?s[0]:i?r.size-++o:o++,s[1],t)})},n}function he(t,e,r,n){var i=De(t);return n&&(i.has=function(n){var i=t.get(n,zr);return i!==zr&&!!e.call(r,i,n,t)},i.get=function(n,i){var o=t.get(n,zr);return o!==zr&&e.call(r,o,n,t)?o:i}),i.__iterateUncached=function(i,o){var u=this,s=0;return t.__iterate(function(t,o,a){if(e.call(r,t,o,a))return s++,i(t,n?o:s-1,u)},o),s},i.__iteratorUncached=function(i,o){var u=t.__iterator(2,o),s=0;return new E(function(){for(;;){var o=u.next() -;if(o.done)return o;var a=o.value,h=a[0],f=a[1];if(e.call(r,f,h,t))return O(i,n?h:s++,f,o)}})},i}function fe(t,e,r){var n=ft().asMutable();return t.__iterate(function(i,o){n.update(e.call(r,i,o,t),0,function(t){return t+1})}),n.asImmutable()}function ce(t,e,r){var n=p(t),i=(y(t)?Gt():ft()).asMutable();t.__iterate(function(o,u){i.update(e.call(r,o,u,t),function(t){return t=t||[],t.push(n?[u,o]:o),t})});var o=Me(t);return i.map(function(e){return Ie(t,o(e))})}function _e(t,e,r,n){var i=t.size;if(b(e,r,i))return t;var o=M(e,i),u=D(r,i);if(o!==o||u!==u)return _e(t.toSeq().cacheResult(),e,r,n);var s,a=u-o;a===a&&(s=a<0?0:a);var h=De(t);return h.size=0===s?s:t.size&&s||void 0,!n&&P(t)&&s>=0&&(h.get=function(e,r){return e=z(this,e),e>=0&&es)return x();var t=i.next();return n||1===e?t:0===e?O(e,a-1,void 0,t):O(e,a-1,t.value[1],t)})},h}function pe(t,e,r){var n=De(t);return n.__iterateUncached=function(n,i){var o=this;if(i)return this.cacheResult().__iterate(n,i);var u=0;return t.__iterate(function(t,i,s){return e.call(r,t,i,s)&&++u&&n(t,i,o)}),u},n.__iteratorUncached=function(n,i){var o=this;if(i)return this.cacheResult().__iterator(n,i);var u=t.__iterator(2,i),s=!0;return new E(function(){if(!s)return x();var t=u.next();if(t.done)return t;var i=t.value,a=i[0],h=i[1];return e.call(r,h,a,o)?2===n?t:O(n,a,h,t):(s=!1,x())})},n}function le(t,e,r,n){var i=De(t);return i.__iterateUncached=function(i,o){var u=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,a=0;return t.__iterate(function(t,o,h){if(!s||!(s=e.call(r,t,o,h)))return a++,i(t,n?o:a-1,u)}),a},i.__iteratorUncached=function(i,o){var u=this -;if(o)return this.cacheResult().__iterator(i,o);var s=t.__iterator(2,o),a=!0,h=0;return new E(function(){var t,o,f;do{if(t=s.next(),t.done)return n||1===i?t:0===i?O(i,h++,void 0,t):O(i,h++,t.value[1],t);var c=t.value;o=c[0],f=c[1],a&&(a=e.call(r,f,o,u))}while(a);return 2===i?t:O(i,o,f,t)})},i}function ve(t,e){var r=p(t),n=[t].concat(e).map(function(t){return _(t)?r&&(t=h(t)):t=r?V(t):Q(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===n.length)return t;if(1===n.length){var i=n[0];if(i===t||r&&p(i)||l(t)&&l(i))return i}var o=new B(n);return r?o=o.toKeyedSeq():l(t)||(o=o.toSetSeq()),o=o.flatten(!0),o.size=n.reduce(function(t,e){if(void 0!==t){var r=e.size;if(void 0!==r)return t+r}},0),o}function ye(t,e,r){var n=De(t);return n.__iterateUncached=function(i,o){function u(t,h){t.__iterate(function(t,o){return(!e||h0}function ze(t,e,r){var n=De(t);return n.size=new B(r).map(function(t){return t.size}).min(),n.__iterate=function(t,e){for(var r,n=this.__iterator(1,e),i=0;!(r=n.next()).done&&t(r.value,i++,this)!==!1;);return i},n.__iteratorUncached=function(t,n){var i=r.map(function(t){return t=a(t),j(n?t.reverse():t)}),o=0,u=!1;return new E(function(){var r;return u||(r=i.map(function(t){return t.next()}),u=r.some(function(t){return t.done})),u?x():O(t,o++,e.apply(null,r.map(function(t){return t.value})))})},n}function Ie(t,e){return t===e?t:P(t)?e:t.constructor(e)}function be(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function Me(t){return p(t)?h:l(t)?f:c}function De(t){return Object.create((p(t)?L:l(t)?T:W).prototype)}function qe(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):K.prototype.cacheResult.call(this)}function Ee(t,e){return void 0===t&&void 0===e?0:void 0===t?1:void 0===e?-1:t>e?1:te?-1:0}function $e(t){if(t.size===1/0)return 0;var e=y(t),n=p(t),i=e?1:0;return tr(t.__iterate(n?e?function(t,e){i=31*i+er(r(t),r(e))|0}:function(t,e){i=i+er(r(t),r(e))|0}:e?function(t){i=31*i+r(t)|0}:function(t){i=i+r(t)|0}),i)}function tr(t,r){return r=ar(r,3432918353),r=ar(r<<15|r>>>-15,461845907),r=ar(r<<13|r>>>-13,5),r=(r+3864292196|0)^t,r=ar(r^r>>>16,2246822507),r=ar(r^r>>>13,3266489909),r=e(r^r>>>16)}function er(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}function rr(t){return null===t||void 0===t?or():nr(t)?t:or().withMutations(function(e){var r=c(t);ht(r.size),r.forEach(function(t){return e.add(t)}) -})}function nr(t){return Ue(t)&&y(t)}function ir(t,e){var r=Object.create(Gr);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function or(){return Zr||(Zr=ir(te()))}var ur,sr=Array.prototype.slice,ar="function"==typeof Math.imul&&Math.imul(4294967295,2)===-2?Math.imul:function(t,e){t|=0,e|=0;var r=65535&t,n=65535&e;return r*n+((t>>>16)*n+r*(e>>>16)<<16>>>0)|0},hr=Object.isExtensible,fr=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}(),cr="function"==typeof WeakMap;cr&&(ur=new WeakMap);var _r=0,pr="__immutablehash__";"function"==typeof Symbol&&(pr=Symbol(pr));var lr=16,vr=255,yr=0,dr={};s(h,a),s(f,a),s(c,a),a.isIterable=_,a.isKeyed=p,a.isIndexed=l,a.isAssociative=v,a.isOrdered=y,a.Keyed=h,a.Indexed=f,a.Set=c;var mr="@@__IMMUTABLE_ITERABLE__@@",gr="@@__IMMUTABLE_KEYED__@@",wr="@@__IMMUTABLE_INDEXED__@@",Sr="@@__IMMUTABLE_ORDERED__@@",zr={},Ir={value:!1},br={value:!1},Mr="function"==typeof Symbol&&Symbol.iterator,Dr=Mr||"@@iterator";E.prototype.toString=function(){return"[Iterator]"},E.KEYS=0,E.VALUES=1,E.ENTRIES=2,E.prototype.inspect=E.prototype.toSource=function(){return""+this},E.prototype[Dr]=function(){return this},s(K,a),K.of=function(){return K(arguments)},K.prototype.toSeq=function(){return this},K.prototype.toString=function(){return this.__toString("Seq {","}")},K.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},K.prototype.__iterate=function(t,e){var r=this._cache;if(r){for(var n=r.length,i=0;i!==n;){var o=r[e?n-++i:i++];if(t(o[1],o[0],this)===!1)break}return i}return this.__iterateUncached(t,e)},K.prototype.__iterator=function(t,e){var r=this._cache;if(r){var n=r.length,i=0;return new E(function(){if(i===n)return x();var o=r[e?n-++i:i++];return O(t,o[0],o[1])})}return this.__iteratorUncached(t,e)},s(L,K),L.prototype.toKeyedSeq=function(){return this},s(T,K),T.of=function(){return T(arguments)},T.prototype.toIndexedSeq=function(){return this}, -T.prototype.toString=function(){return this.__toString("Seq [","]")},s(W,K),W.of=function(){return W(arguments)},W.prototype.toSetSeq=function(){return this},K.isSeq=P,K.Keyed=L,K.Set=W,K.Indexed=T;K.prototype["@@__IMMUTABLE_SEQ__@@"]=!0,s(B,T),B.prototype.get=function(t,e){return this.has(t)?this._array[z(this,t)]:e},B.prototype.__iterate=function(t,e){for(var r=this._array,n=r.length,i=0;i!==n;){var o=e?n-++i:i++;if(t(r[o],o,this)===!1)break}return i},B.prototype.__iterator=function(t,e){var r=this._array,n=r.length,i=0;return new E(function(){if(i===n)return x();var o=e?n-++i:i++;return O(t,o,r[o])})},s(J,L),J.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},J.prototype.has=function(t){return this._object.hasOwnProperty(t)},J.prototype.__iterate=function(t,e){for(var r=this._object,n=this._keys,i=n.length,o=0;o!==i;){var u=n[e?i-++o:o++];if(t(r[u],u,this)===!1)break}return o},J.prototype.__iterator=function(t,e){var r=this._object,n=this._keys,i=n.length,o=0;return new E(function(){if(o===i)return x();var u=n[e?i-++o:o++];return O(t,u,r[u])})},J.prototype[Sr]=!0,s(C,T),C.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=j(r),i=0;if(k(n))for(var o;!(o=n.next()).done&&t(o.value,i++,this)!==!1;);return i},C.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=j(r);if(!k(n))return new E(x);var i=0;return new E(function(){var e=n.next();return e.done?e:O(t,i++,e.value)})},s(N,T),N.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;i=n.length){var e=r.next();if(e.done)return e -;n[i]=e.value}return O(t,i,n[i++])})};var qr;s(rt,T),rt.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},rt.prototype.get=function(t,e){return this.has(t)?this._value:e},rt.prototype.includes=function(t){return tt(this._value,t)},rt.prototype.slice=function(t,e){var r=this.size;return b(t,e,r)?this:new rt(this._value,D(e,r)-M(t,r))},rt.prototype.reverse=function(){return this},rt.prototype.indexOf=function(t){return tt(this._value,t)?0:-1},rt.prototype.lastIndexOf=function(t){return tt(this._value,t)?this.size:-1},rt.prototype.__iterate=function(t,e){for(var r=this.size,n=0;n!==r&&t(this._value,e?r-++n:n++,this)!==!1;);return n},rt.prototype.__iterator=function(t,e){var r=this,n=this.size,i=0;return new E(function(){return i===n?x():O(t,e?n-++i:i++,r._value)})},rt.prototype.equals=function(t){return t instanceof rt?tt(this._value,t._value):et(t)};var Er;s(it,T),it.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},it.prototype.get=function(t,e){return this.has(t)?this._start+z(this,t)*this._step:e},it.prototype.includes=function(t){var e=(t-this._start)/this._step;return e>=0&&e=0&&r=t.length)throw Error("Missing value for key: "+t[r]);e.set(t[r],t[r+1])}})},ft.prototype.toString=function(){return this.__toString("Map {","}")},ft.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},ft.prototype.set=function(t,e){return zt(this,t,e)},ft.prototype.setIn=function(t,e){return this.updateIn(t,zr,function(){return e})},ft.prototype.remove=function(t){return zt(this,t,zr)},ft.prototype.deleteIn=function(t){return this.updateIn(t,function(){return zr})},ft.prototype.deleteAll=function(t){var e=a(t);return 0===e.size?this:this.withMutations(function(t){e.forEach(function(e){return t.remove(e)})})},ft.prototype.update=function(t,e,r){return 1===arguments.length?t(this):this.updateIn([t],e,r)},ft.prototype.updateIn=function(t,e,r){r||(r=e,e=void 0);var n=jt(this,Oe(t),e,r);return n===zr?e:n},ft.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):St()},ft.prototype.merge=function(){return Ot(this,void 0,arguments)},ft.prototype.mergeWith=function(t){return Ot(this,t,sr.call(arguments,1))},ft.prototype.mergeIn=function(t){var e=sr.call(arguments,1);return this.updateIn(t,St(),function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]})},ft.prototype.mergeDeep=function(){return Ot(this,xt,arguments)},ft.prototype.mergeDeepWith=function(t){var e=sr.call(arguments,1);return Ot(this,At(t),e)},ft.prototype.mergeDeepIn=function(t){var e=sr.call(arguments,1);return this.updateIn(t,St(),function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]})},ft.prototype.sort=function(t){return Gt(ge(this,t))}, -ft.prototype.sortBy=function(t,e){return Gt(ge(this,e,t))},ft.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},ft.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new g)},ft.prototype.asImmutable=function(){return this.__ensureOwner()},ft.prototype.wasAltered=function(){return this.__altered},ft.prototype.__iterator=function(t,e){return new dt(this,t,e)},ft.prototype.__iterate=function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},ft.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?wt(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},ft.isMap=ct;var xr="@@__IMMUTABLE_MAP__@@",Ar=ft.prototype;Ar[xr]=!0,Ar.delete=Ar.remove,Ar.removeIn=Ar.deleteIn,Ar.removeAll=Ar.deleteAll,_t.prototype.get=function(t,e,r,n){for(var i=this.entries,o=0,u=i.length;o=jr)return Dt(t,a,n,i);var _=t&&t===this.ownerID,p=_?a:w(a);return c?s?h===f-1?p.pop():p[h]=p.pop():p[h]=[n,i]:p.push([n,i]),_?(this.entries=p,this):new _t(t,p)}},pt.prototype.get=function(t,e,n,i){void 0===e&&(e=r(n));var o=1<<(31&(0===t?e:e>>>t)),u=this.bitmap;return 0===(u&o)?i:this.nodes[Rt(u&o-1)].get(t+5,e,n,i)},pt.prototype.update=function(t,e,n,i,o,u,s){void 0===n&&(n=r(i));var a=31&(0===e?n:n>>>e),h=1<=Rr)return Et(t,p,f,a,v);if(c&&!v&&2===p.length&&bt(p[1^_]))return p[1^_];if(c&&v&&1===p.length&&bt(v))return v;var y=t&&t===this.ownerID,d=c?v?f:f^h:f|h,m=c?v?Ut(p,_,v,y):Lt(p,_,y):Kt(p,_,v,y);return y?(this.bitmap=d,this.nodes=m, -this):new pt(t,d,m)},lt.prototype.get=function(t,e,n,i){void 0===e&&(e=r(n));var o=31&(0===t?e:e>>>t),u=this.nodes[o];return u?u.get(t+5,e,n,i):i},lt.prototype.update=function(t,e,n,i,o,u,s){void 0===n&&(n=r(i));var a=31&(0===e?n:n>>>e),h=o===zr,f=this.nodes,c=f[a];if(h&&!c)return this;var _=It(c,t,e+5,n,i,o,u,s);if(_===c)return this;var p=this.count;if(c){if(!_&&(p--,p=0&&t>>e&31;if(n>=this.array.length)return new Bt([],t);var i,o=0===n;if(e>0){var u=this.array[n];if(i=u&&u.removeBefore(t,e-5,r),i===u&&o)return this}if(o&&!i)return this;var s=Vt(this,t);if(!o)for(var a=0;a>>e&31;if(n>=this.array.length)return this;var i;if(e>0){var o=this.array[n];if(i=o&&o.removeAfter(t,e-5,r),i===o&&n===this.array.length-1)return this}var u=Vt(this,t);return u.array.splice(n+1),i&&(u.array[n]=i),u};var Tr,Wr={};s(Gt,ft),Gt.of=function(){return this(arguments)},Gt.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Gt.prototype.get=function(t,e){var r=this._map.get(t);return void 0!==r?this._list.get(r)[1]:e},Gt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):te()},Gt.prototype.set=function(t,e){return ee(this,t,e)},Gt.prototype.remove=function(t){return ee(this,t,zr)},Gt.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Gt.prototype.__iterate=function(t,e){var r=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},Gt.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Gt.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this -;var e=this._map.__ensureOwner(t),r=this._list.__ensureOwner(t);return t?$t(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=r,this)},Gt.isOrderedMap=Zt,Gt.prototype[Sr]=!0,Gt.prototype.delete=Gt.prototype.remove;var Br;s(re,L),re.prototype.get=function(t,e){return this._iter.get(t,e)},re.prototype.has=function(t){return this._iter.has(t)},re.prototype.valueSeq=function(){return this._iter.valueSeq()},re.prototype.reverse=function(){var t=this,e=ae(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},re.prototype.map=function(t,e){var r=this,n=se(this,t,e);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(t,e)}),n},re.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e,n){return t(e,n,r)},e)},re.prototype.__iterator=function(t,e){return this._iter.__iterator(t,e)},re.prototype[Sr]=!0,s(ne,T),ne.prototype.includes=function(t){return this._iter.includes(t)},ne.prototype.__iterate=function(t,e){var r=this,n=0;return e&&S(this),this._iter.__iterate(function(i){return t(i,e?r.size-++n:n++,r)},e)},ne.prototype.__iterator=function(t,e){var r=this,n=this._iter.__iterator(1,e),i=0;return e&&S(this),new E(function(){var o=n.next();return o.done?o:O(t,e?r.size-++i:i++,o.value,o)})},s(ie,W),ie.prototype.has=function(t){return this._iter.includes(t)},ie.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){return t(e,e,r)},e)},ie.prototype.__iterator=function(t,e){var r=this._iter.__iterator(1,e);return new E(function(){var e=r.next();return e.done?e:O(t,e.value,e.value,e)})},s(oe,L),oe.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){if(e){be(e);var n=_(e);return t(n?e.get(1):e[1],n?e.get(0):e[0],r)}},e)},oe.prototype.__iterator=function(t,e){var r=this._iter.__iterator(1,e);return new E(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n){be(n);var i=_(n);return O(t,i?n.get(0):n[0],i?n.get(1):n[1],e)}}})}, -ne.prototype.cacheResult=re.prototype.cacheResult=ie.prototype.cacheResult=oe.prototype.cacheResult=qe,s(xe,ut),xe.prototype.toString=function(){return this.__toString(ke(this)+" {","}")},xe.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},xe.prototype.get=function(t,e){if(!this.has(t))return e;var r=this._defaultValues[t];return this._map?this._map.get(t,r):r},xe.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=Ae(this,St()))},xe.prototype.set=function(t,e){if(!this.has(t))return this;if(this._map&&!this._map.has(t)){if(e===this._defaultValues[t])return this}var r=this._map&&this._map.set(t,e);return this.__ownerID||r===this._map?this:Ae(this,r)},xe.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:Ae(this,e)},xe.prototype.wasAltered=function(){return this._map.wasAltered()},xe.prototype.__iterator=function(t,e){var r=this;return h(this._defaultValues).map(function(t,e){return r.get(e)}).__iterator(t,e)},xe.prototype.__iterate=function(t,e){var r=this;return h(this._defaultValues).map(function(t,e){return r.get(e)}).__iterate(t,e)},xe.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?Ae(this,e,t):(this.__ownerID=t,this._map=e,this)},xe.getDescriptiveName=ke;var Jr=xe.prototype;Jr.delete=Jr.remove,Jr.deleteIn=Jr.removeIn=Ar.removeIn,Jr.merge=Ar.merge,Jr.mergeWith=Ar.mergeWith,Jr.mergeIn=Ar.mergeIn,Jr.mergeDeep=Ar.mergeDeep,Jr.mergeDeepWith=Ar.mergeDeepWith,Jr.mergeDeepIn=Ar.mergeDeepIn,Jr.setIn=Ar.setIn,Jr.update=Ar.update,Jr.updateIn=Ar.updateIn,Jr.withMutations=Ar.withMutations,Jr.asMutable=Ar.asMutable,Jr.asImmutable=Ar.asImmutable,s(Re,at),Re.of=function(){return this(arguments)},Re.fromKeys=function(t){return this(h(t).keySeq())},Re.prototype.toString=function(){return this.__toString("Set {","}")},Re.prototype.has=function(t){ -return this._map.has(t)},Re.prototype.add=function(t){return Ke(this,this._map.set(t,!0))},Re.prototype.remove=function(t){return Ke(this,this._map.remove(t))},Re.prototype.clear=function(){return Ke(this,this._map.clear())},Re.prototype.union=function(){var t=sr.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var r=0;r=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Ce(t,e)},Be.prototype.pushAll=function(t){if(t=f(t),0===t.size)return this;ht(t.size);var e=this.size,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.size=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):Ce(e,r)},Be.prototype.pop=function(){return this.slice(1)},Be.prototype.unshift=function(){return this.push.apply(this,arguments)},Be.prototype.unshiftAll=function(t){return this.pushAll(t)},Be.prototype.shift=function(){return this.pop.apply(this,arguments)},Be.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Ne()},Be.prototype.slice=function(t,e){if(b(t,e,this.size))return this;var r=M(t,this.size);if(D(e,this.size)!==this.size)return st.prototype.slice.call(this,t,e);for(var n=this.size-r,i=this._head;r--;)i=i.next;return this.__ownerID?(this.size=n,this._head=i,this.__hash=void 0,this.__altered=!0,this):Ce(n,i)},Be.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Ce(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},Be.prototype.__iterate=function(t,e){var r=this;if(e)return new B(this.toArray()).__iterate(function(e,n){return t(e,n,r)},e);for(var n=0,i=this._head;i&&t(i.value,n++,this)!==!1;)i=i.next;return n},Be.prototype.__iterator=function(t,e){if(e)return new B(this.toArray()).__iterator(t,e);var r=0,n=this._head;return new E(function(){if(n){var e=n.value -;return n=n.next,O(t,r++,e)}return x()})},Be.isStack=Je;var Hr="@@__IMMUTABLE_STACK__@@",Vr=Be.prototype;Vr[Hr]=!0,Vr.withMutations=Ar.withMutations,Vr.asMutable=Ar.asMutable,Vr.asImmutable=Ar.asImmutable,Vr.wasAltered=Ar.wasAltered;var Qr;a.Iterator=E,We(a,{toArray:function(){ht(this.size);var t=Array(this.size||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toIndexedSeq:function(){return new ne(this)},toJS:function(){return this.toSeq().map(Ve).__toJS()},toJSON:function(){return this.toSeq().map(Qe).__toJS()},toKeyedSeq:function(){return new re(this,!0)},toMap:function(){return ft(this.toKeyedSeq())},toObject:function(){ht(this.size);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toOrderedMap:function(){return Gt(this.toKeyedSeq())},toOrderedSet:function(){return rr(p(this)?this.valueSeq():this)},toSet:function(){return Re(p(this)?this.valueSeq():this)},toSetSeq:function(){return new ie(this)},toSeq:function(){return l(this)?this.toIndexedSeq():p(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Be(p(this)?this.valueSeq():this)},toList:function(){return Tt(p(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){return Ie(this,ve(this,sr.call(arguments,0)))},includes:function(t){return this.some(function(e){return tt(e,t)})},entries:function(){return this.__iterator(2)},every:function(t,e){ht(this.size);var r=!0;return this.__iterate(function(n,i,o){if(!t.call(e,n,i,o))return r=!1,!1}),r},filter:function(t,e){return Ie(this,he(this,t,e,!0))},find:function(t,e,r){var n=this.findEntry(t,e);return n?n[1]:r},forEach:function(t,e){return ht(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){ht(this.size),t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!==n&&void 0!==n?""+n:""}),e},keys:function(){return this.__iterator(0)},map:function(t,e){return Ie(this,se(this,t,e))}, -reduce:function(t,e,r){ht(this.size);var n,i;return arguments.length<2?i=!0:n=e,this.__iterate(function(e,o,u){i?(i=!1,n=e):n=t.call(r,n,e,o,u)}),n},reduceRight:function(t,e,r){var n=this.toKeyedSeq().reverse();return n.reduce.apply(n,arguments)},reverse:function(){return Ie(this,ae(this,!0))},slice:function(t,e){return Ie(this,_e(this,t,e,!0))},some:function(t,e){return!this.every(Ye(t),e)},sort:function(t){return Ie(this,ge(this,t))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return S(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return fe(this,t,e)},equals:function(t){return et(this,t)},entrySeq:function(){var t=this;if(t._cache)return new B(t._cache);var e=t.toSeq().map(He).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e.toJS=function(){return this.map(function(t){return[Ve(t[0]),Ve(t[1])]}).__toJS()},e.toJSON=function(){return this.map(function(t){return[Qe(t[0]),Qe(t[1])]}).__toJS()},e},filterNot:function(t,e){return this.filter(Ye(t),e)},findEntry:function(t,e,r){var n=r;return this.__iterate(function(r,i,o){if(t.call(e,r,i,o))return n=[i,r],!1}),n},findKey:function(t,e){var r=this.findEntry(t,e);return r&&r[0]},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastEntry:function(t,e,r){return this.toKeyedSeq().reverse().findEntry(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(){return this.find(I)},flatMap:function(t,e){return Ie(this,de(this,t,e))},flatten:function(t){return Ie(this,ye(this,t,!0))},fromEntrySeq:function(){return new oe(this)},get:function(t,e){return this.find(function(e,r){return tt(r,t)},void 0,e)},getIn:function(t,e){for(var r,n=this,i=Oe(t);!(r=i.next()).done;){var o=r.value;if(n=n&&n.get?n.get(o,zr):zr,n===zr)return e}return n},groupBy:function(t,e){return ce(this,t,e)},has:function(t){return this.get(t,zr)!==zr}, -hasIn:function(t){return this.getIn(t,zr)!==zr},isSubset:function(t){return t="function"==typeof t.includes?t:a(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t="function"==typeof t.isSubset?t:a(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return tt(e,t)})},keySeq:function(){return this.toSeq().map(Pe).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return we(this,t)},maxBy:function(t,e){return we(this,e,t)},min:function(t){return we(this,t?Xe(t):Ze)},minBy:function(t,e){return we(this,e?Xe(e):Ze,t)},rest:function(){return this.slice(1)},skip:function(t){return 0===t?this:this.slice(Math.max(0,t))},skipLast:function(t){return 0===t?this:this.slice(0,-Math.max(0,t))},skipWhile:function(t,e){return Ie(this,le(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Ye(t),e)},sortBy:function(t,e){return Ie(this,ge(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return this.slice(-Math.max(0,t))},takeWhile:function(t,e){return Ie(this,pe(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Ye(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=$e(this))}});var Yr=a.prototype;Yr[mr]=!0,Yr[Dr]=Yr.values,Yr.__toJS=Yr.toArray,Yr.__toStringMapper=Fe,Yr.inspect=Yr.toSource=function(){return""+this},Yr.chain=Yr.flatMap,Yr.contains=Yr.includes,We(h,{flip:function(){return Ie(this,ue(this))},mapEntries:function(t,e){var r=this,n=0;return Ie(this,this.toSeq().map(function(i,o){return t.call(e,[o,i],n++,r)}).fromEntrySeq())},mapKeys:function(t,e){var r=this;return Ie(this,this.toSeq().flip().map(function(n,i){return t.call(e,n,i,r)}).flip())}});var Xr=h.prototype;Xr[gr]=!0,Xr[Dr]=Yr.entries,Xr.__toJS=Yr.toObject,Xr.__toStringMapper=function(t,e){return Fe(e)+": "+Fe(t)},We(f,{toKeyedSeq:function(){return new re(this,!1)},filter:function(t,e){ -return Ie(this,he(this,t,e,!1))},findIndex:function(t,e){var r=this.findEntry(t,e);return r?r[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return Ie(this,ae(this,!1))},slice:function(t,e){return Ie(this,_e(this,t,e,!1))},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=M(t,t<0?this.count():this.size);var n=this.slice(0,t);return Ie(this,1===r?n:n.concat(w(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.findLastEntry(t,e);return r?r[0]:-1},first:function(){return this.get(0)},flatten:function(t){return Ie(this,ye(this,t,!1))},get:function(t,e){return t=z(this,t),t<0||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,r){return r===t},void 0,e)},has:function(t){return t=z(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t/g, - function (_, component) { - var id = 'r' + components.length; - components.push(component); - try { - return ( - '
'+ - vm.runInNewContext( - fs.readFileSync(BUILD_DIR+subDir+'bundle.js') + // ugly - '\nrequire("react").renderToString('+ - 'require("react").createElement(require(component)))', - { - global: { - React: React, - Immutable: Immutable - }, - window: {}, - component: component, - console: console, - } - ) + - '
' - ); - } catch (error) { - return '
' + error.message + '
'; - } - } - ); - if (components.length) { - src = src.replace( - //g, - '' - ); - } - file.contents = new Buffer(src, enc); - this.push(file); - cb(); - }); -} - -function reactTransform() { - var parseError; - return through.obj(function(file, enc, cb) { - if (path.extname(file.path) !== '.js') { - this.push(file); - return cb(); - } - try { - file.contents = new Buffer(reactTools.transform( - file.contents.toString(enc), - {harmony: true} - ), enc); - this.push(file); - cb(); - } catch (error) { - parseError = new gutil.PluginError('transform', { - message: file.relative + ' : ' + error.message, - showStack: false - }); - cb(); - } - }, function (done) { - parseError && this.emit('error', parseError); - done(); - }); -} - - -function reactTransformify(filePath) { - if (path.extname(filePath) !== '.js') { - return through(); - } - var code = ''; - var parseError; - return through.obj(function(file, enc, cb) { - code += file; - cb(); - }, function (done) { - try { - this.push(reactTools.transform(code, {harmony:true})); - } catch (error) { - parseError = new gutil.PluginError('transform', { - message: error.message, - showStack: false - }); - } - parseError && this.emit('error', parseError); - done(); - }); -} diff --git a/jest.config.mjs b/jest.config.mjs new file mode 100644 index 0000000000..4bbd44198b --- /dev/null +++ b/jest.config.mjs @@ -0,0 +1,12 @@ +/** @type {import('jest').Config} */ +const config = { + moduleFileExtensions: ['js', 'ts'], + resolver: '/resources/jestResolver.js', + transform: { + '^.+\\.(js|ts)$': '/resources/jestPreprocessor.js', + }, + testRegex: ['/__tests__/.*\\.(ts|js)$', '/website/.*\\.test\\.(ts|js)$'], + testPathIgnorePatterns: ['/__tests__/ts-utils.ts'], +}; + +export default config; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000..803ef38aaf --- /dev/null +++ b/package-lock.json @@ -0,0 +1,22771 @@ +{ + "name": "immutable", + "version": "5.1.2", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "immutable", + "version": "5.1.2", + "license": "MIT", + "devDependencies": { + "@codemirror/commands": "^6.8.1", + "@codemirror/lang-javascript": "^6.2.3", + "@codemirror/state": "^6.5.2", + "@codemirror/theme-one-dark": "^6.1.2", + "@codemirror/view": "^6.36.5", + "@eslint/js": "^9.20.0", + "@jdeniau/immutable-devtools": "^0.2.0", + "@jest/globals": "^29.7.0", + "@mdx-js/loader": "^3.1.0", + "@mdx-js/react": "^3.1.0", + "@next/mdx": "^15.3.2", + "@rollup/plugin-buble": "1.0.3", + "@rollup/plugin-commonjs": "28.0.2", + "@rollup/plugin-json": "6.1.0", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^12.1.2", + "@size-limit/esbuild-why": "^11.2.0", + "@size-limit/preset-small-lib": "^11.2.0", + "@types/mdx": "^2.0.13", + "@types/node": "^22.15.17", + "@types/prismjs": "^1.26.3", + "@types/random-seed": "0.3.5", + "@types/react": "19.1.0", + "benchmark": "2.1.4", + "codemirror": "^6.0.1", + "colors": "1.4.0", + "cpy-cli": "^5.0.0", + "eslint": "^9.20.1", + "eslint-import-resolver-typescript": "^4.3.4", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-jest": "^28.11.0", + "eslint-plugin-react": "^7.37.4", + "fast-check": "^4.0.0", + "flow-bin": "0.160.0", + "globals": "^15.15.0", + "jest": "^29.0.0", + "jest-environment-jsdom": "^29.6.4", + "jsonml-html": "^1.2.0", + "make-synchronous": "0.1.1", + "marked": "^11.2.0", + "marked-highlight": "^2.1.0", + "microtime": "3.1.1", + "next": "^15.3.2", + "next-sitemap": "4.2.3", + "npm-run-all": "4.1.5", + "prettier": "^3.5.0", + "prismjs": "^1.29.0", + "random-seed": "0.3.0", + "react": "19.1.0", + "react-dom": "19.1.0", + "rimraf": "2.7.1", + "rollup": "4.34.8", + "size-limit": "^11.2.0", + "transducers-js": "0.4.174", + "ts-node": "^10.9.2", + "tslib": "^2.8.1", + "tstyche": "^3.5", + "typescript": "5.7", + "typescript-eslint": "^8.24.0" + }, + "engines": { + "npm": ">=7.0.0" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.8.tgz", + "integrity": "sha512-l+lkXCHS6tQEc5oUpK28xBOZ6+HwaH7YwoYQbLFiYb4nS2/l1tKnZEtEWkD0GuiYdvArf9qBS0XlQGXzPMsNqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.8", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.7", + "@babel/parser": "^7.26.8", + "@babel/template": "^7.26.8", + "@babel/traverse": "^7.26.8", + "@babel/types": "^7.26.8", + "@types/gensync": "^1.0.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/generator": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.8.tgz", + "integrity": "sha512-ef383X5++iZHWAXX0SXQR6ZyQhw/0KtTkrTz61WXRhFM6dhpHulO/RJz79L8S6ugZHJkOOkUrUdxgdF2YiPFnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.26.8", + "@babel/types": "^7.26.8", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.26.5", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.10" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", + "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.26.10" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", + "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.8.tgz", + "integrity": "sha512-nic9tRkjYH0oB2dzr/JoGIm+4Q6SuYeLEiIiZDwBscRMYFJ+tMAz98fuel9ZnbXViA2I0HVSSRRK8DW5fjXStA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.8", + "@babel/parser": "^7.26.8", + "@babel/template": "^7.26.8", + "@babel/types": "^7.26.8", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/types": { + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@codemirror/autocomplete": { + "version": "6.18.6", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.6.tgz", + "integrity": "sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@codemirror/commands": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.8.1.tgz", + "integrity": "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.4.0", + "@codemirror/view": "^6.27.0", + "@lezer/common": "^1.1.0" + } + }, + "node_modules/@codemirror/lang-javascript": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.3.tgz", + "integrity": "sha512-8PR3vIWg7pSu7ur8A07pGiYHgy3hHj+mRYRCSG8q+mPIrl0F02rgpGv+DsQTHRTc30rydOsf5PZ7yjKFg2Ackw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.6.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0", + "@lezer/javascript": "^1.0.0" + } + }, + "node_modules/@codemirror/language": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.11.0.tgz", + "integrity": "sha512-A7+f++LodNNc1wGgoRDTt78cOwWm9KVezApgjOMp1W4hM0898nsqBXwF+sbePE7ZRcjN7Sa1Z5m2oN27XkmEjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.23.0", + "@lezer/common": "^1.1.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0", + "style-mod": "^4.0.0" + } + }, + "node_modules/@codemirror/lint": { + "version": "6.8.5", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.8.5.tgz", + "integrity": "sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.35.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/search": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.10.tgz", + "integrity": "sha512-RMdPdmsrUf53pb2VwflKGHEe1XVM07hI7vV2ntgw1dmqhimpatSJKva4VA9h4TLUDOD4EIF02201oZurpnEFsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/state": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.2.tgz", + "integrity": "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@marijn/find-cluster-break": "^1.0.0" + } + }, + "node_modules/@codemirror/theme-one-dark": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@codemirror/theme-one-dark/-/theme-one-dark-6.1.2.tgz", + "integrity": "sha512-F+sH0X16j/qFLMAfbciKTxVOwkdAS336b7AXTKOZhy8BR3eH/RelsnLgLFINrpST63mmN2OuwUt0W2ndUgYwUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/highlight": "^1.0.0" + } + }, + "node_modules/@codemirror/view": { + "version": "6.36.5", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.36.5.tgz", + "integrity": "sha512-cd+FZEUlu3GQCYnguYm3EkhJ8KJVisqqUsCOKedBoAt/d9c76JUUap6U0UrpElln5k6VyrEOYliMuDAKIeDQLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.5.0", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, + "node_modules/@corex/deepmerge": { + "version": "4.0.43", + "resolved": "https://registry.npmjs.org/@corex/deepmerge/-/deepmerge-4.0.43.tgz", + "integrity": "sha512-N8uEMrMPL0cu/bdboEWpQYb/0i2K5Qn8eCsxzOmxSggJbbQte7ljMRoXm917AbntqTGOzdTu+vP3KOOzoC70HQ==", + "dev": true + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@emnapi/core": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.4.3.tgz", + "integrity": "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.0.2", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.3.tgz", + "integrity": "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.0.2.tgz", + "integrity": "sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.1.tgz", + "integrity": "sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.1.tgz", + "integrity": "sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.1.tgz", + "integrity": "sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.1.tgz", + "integrity": "sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.1.tgz", + "integrity": "sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.1.tgz", + "integrity": "sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.1.tgz", + "integrity": "sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.1.tgz", + "integrity": "sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.1.tgz", + "integrity": "sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.1.tgz", + "integrity": "sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.1.tgz", + "integrity": "sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.1.tgz", + "integrity": "sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.1.tgz", + "integrity": "sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.1.tgz", + "integrity": "sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.1.tgz", + "integrity": "sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.1.tgz", + "integrity": "sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.1.tgz", + "integrity": "sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.1.tgz", + "integrity": "sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.1.tgz", + "integrity": "sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.1.tgz", + "integrity": "sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.1.tgz", + "integrity": "sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.1.tgz", + "integrity": "sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.1.tgz", + "integrity": "sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.1.tgz", + "integrity": "sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.1.tgz", + "integrity": "sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.2.tgz", + "integrity": "sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.11.0.tgz", + "integrity": "sha512-DWUB2pksgNEb6Bz2fggIy1wh6fGgZP4Xyy/Mt0QZPiloKKXerbqq9D3SBQTlCRYOrcRPu4vuz+CGjwdfqxnoWA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/js": { + "version": "9.20.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.20.0.tgz", + "integrity": "sha512-iZA07H9io9Wn836aVTytRaNqh00Sad+EamwOVJT12GTLw1VGMFV/4JaME+JjLtr9fiGaoWgYnS54wrfWsSs4oQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz", + "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.10.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz", + "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.1.tgz", + "integrity": "sha512-pn44xgBtgpEbZsu+lWf2KNb6OAf70X68k+yk69Ic2Xz11zHR/w24/U49XT7AeRwJ0Px+mhALhU5LPci1Aymk7A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.1.0" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.1.tgz", + "integrity": "sha512-VfuYgG2r8BpYiOUN+BfYeFo69nP/MIwAtSJ7/Zpxc5QF3KS22z8Pvg3FkrSFJBPNQ7mmcUcYQFBmEQp7eu1F8Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.1.0" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.1.0.tgz", + "integrity": "sha512-HZ/JUmPwrJSoM4DIQPv/BfNh9yrOA8tlBbqbLz4JZ5uew2+o22Ik+tHQJcih7QJuSa0zo5coHTfD5J8inqj9DA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.1.0.tgz", + "integrity": "sha512-Xzc2ToEmHN+hfvsl9wja0RlnXEgpKNmftriQp6XzY/RaSfwD9th+MSh0WQKzUreLKKINb3afirxW7A0fz2YWuQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.1.0.tgz", + "integrity": "sha512-s8BAd0lwUIvYCJyRdFqvsj+BJIpDBSxs6ivrOPm/R7piTs5UIwY5OjXrP2bqXC9/moGsyRa37eYWYCOGVXxVrA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.1.0.tgz", + "integrity": "sha512-IVfGJa7gjChDET1dK9SekxFFdflarnUB8PwW8aGwEoF3oAsSDuNUTYS+SKDOyOJxQyDC1aPFMuRYLoDInyV9Ew==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.1.0.tgz", + "integrity": "sha512-tiXxFZFbhnkWE2LA8oQj7KYR+bWBkiV2nilRldT7bqoEZ4HiDOcePr9wVDAZPi/Id5fT1oY9iGnDq20cwUz8lQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.1.0.tgz", + "integrity": "sha512-xukSwvhguw7COyzvmjydRb3x/09+21HykyapcZchiCUkTThEQEOMtBj9UhkaBRLuBrgLFzQ2wbxdeCCJW/jgJA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.1.0.tgz", + "integrity": "sha512-yRj2+reB8iMg9W5sULM3S74jVS7zqSzHG3Ol/twnAAkAhnGQnpjj6e4ayUz7V+FpKypwgs82xbRdYtchTTUB+Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.1.0.tgz", + "integrity": "sha512-jYZdG+whg0MDK+q2COKbYidaqW/WTz0cc1E+tMAusiDygrM4ypmSCjOJPmFTvHHJ8j/6cAGyeDWZOsK06tP33w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.1.0.tgz", + "integrity": "sha512-wK7SBdwrAiycjXdkPnGCPLjYb9lD4l6Ze2gSdAGVZrEL05AOUJESWU2lhlC+Ffn5/G+VKuSm6zzbQSzFX/P65A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.1.tgz", + "integrity": "sha512-anKiszvACti2sGy9CirTlNyk7BjjZPiML1jt2ZkTdcvpLU1YH6CXwRAZCA2UmRXnhiIftXQ7+Oh62Ji25W72jA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.1.0" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.1.tgz", + "integrity": "sha512-kX2c+vbvaXC6vly1RDf/IWNXxrlxLNpBVWkdpRq5Ka7OOKj6nr66etKy2IENf6FtOgklkg9ZdGpEu9kwdlcwOQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.1.0" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.1.tgz", + "integrity": "sha512-7s0KX2tI9mZI2buRipKIw2X1ufdTeaRgwmRabt5bi9chYfhur+/C1OXg3TKg/eag1W+6CCWLVmSauV1owmRPxA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.1.0" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.1.tgz", + "integrity": "sha512-wExv7SH9nmoBW3Wr2gvQopX1k8q2g5V5Iag8Zk6AVENsjwd+3adjwxtp3Dcu2QhOXr8W9NusBU6XcQUohBZ5MA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.1.0" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.1.tgz", + "integrity": "sha512-DfvyxzHxw4WGdPiTF0SOHnm11Xv4aQexvqhRDAoD00MzHekAj9a/jADXeXYCDFH/DzYruwHbXU7uz+H+nWmSOQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.1.tgz", + "integrity": "sha512-pax/kTR407vNb9qaSIiWVnQplPcGU8LRIJpDT5o8PdAx5aAA7AS3X9PS8Isw1/WfqgQorPotjrZL3Pqh6C5EBg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.1.0" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.1.tgz", + "integrity": "sha512-YDybQnYrLQfEpzGOQe7OKcyLUCML4YOXl428gOOzBgN6Gw0rv8dpsJ7PqTHxBnXnwXr8S1mYFSLSa727tpz0xg==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.4.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.1.tgz", + "integrity": "sha512-WKf/NAZITnonBf3U1LfdjoMgNO5JYRSlhovhRhMxXVdvWYveM4kM3L8m35onYIdh75cOMCo1BexgVQcCDzyoWw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.1.tgz", + "integrity": "sha512-hw1iIAHpNE8q3uMIRCgGOeDoz9KtFNarFLQclLxr/LK1VBkj8nby18RjFvr6aP7USRYAjTZW6yisnBWMX571Tw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jdeniau/immutable-devtools": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@jdeniau/immutable-devtools/-/immutable-devtools-0.2.0.tgz", + "integrity": "sha512-kncZLhyszWkGz0wAr8eoHFvhczuZz5Ud71OiLIhe5PFQ05nnLgsFdr520Qy+eHhMSL6roJYFrZ73ZJTv48/fUg==", + "dev": true, + "license": "BSD" + }, + "node_modules/@jest/console": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.6.4.tgz", + "integrity": "sha512-wNK6gC0Ha9QeEPSkeJedQuTQqxZYnDPuDcDhVuVatRvMkL4D0VTvFVZj+Yuh6caG2aOfzkUZ36KtCmLNtR02hw==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.6.4.tgz", + "integrity": "sha512-U/vq5ccNTSVgYH7mHnodHmCffGWHJnz/E1BEWlLuK5pM4FZmGfBn/nrJGLjUsSmyx3otCeqc1T31F4y08AMDLg==", + "dev": true, + "dependencies": { + "@jest/console": "^29.6.4", + "@jest/reporters": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.6.3", + "jest-config": "^29.6.4", + "jest-haste-map": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-resolve-dependencies": "^29.6.4", + "jest-runner": "^29.6.4", + "jest-runtime": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "jest-watcher": "^29.6.4", + "micromatch": "^4.0.4", + "pretty-format": "^29.6.3", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.6.4.tgz", + "integrity": "sha512-sxUjWxm7QdchdrD3NfWKrL8FBsortZeibSJv4XLjESOOjSUOkjQcb0ZHJwfhEGIvBvTluTzfG2yZWZhkrXJu8g==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", + "jest-worker": "^29.6.4", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@jest/reporters/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.6.4.tgz", + "integrity": "sha512-uQ1C0AUEN90/dsyEirgMLlouROgSY+Wc/JanVVk0OiUKa5UFh7sJpMEM3aoUBAz2BRNvUJ8j3d294WFuRxSyOQ==", + "dev": true, + "dependencies": { + "@jest/console": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.6.4.tgz", + "integrity": "sha512-E84M6LbpcRq3fT4ckfKs9ryVanwkaIB0Ws9bw3/yP4seRLg/VaCZ/LgW0MCq5wwk4/iP/qnilD41aj2fsw2RMg==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.6.4", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.4", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@lezer/common": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", + "integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@lezer/highlight": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.1.tgz", + "integrity": "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@lezer/javascript": { + "version": "1.4.21", + "resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.4.21.tgz", + "integrity": "sha512-lL+1fcuxWYPURMM/oFZLEDm0XuLN128QPV+VuGtKpeaOGdcl9F2LYC3nh1S9LkPqx9M0mndZFdXCipNAZpzIkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.1.3", + "@lezer/lr": "^1.3.0" + } + }, + "node_modules/@lezer/lr": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.2.tgz", + "integrity": "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@marijn/find-cluster-break": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@mdx-js/loader": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mdx-js/loader/-/loader-3.1.0.tgz", + "integrity": "sha512-xU/lwKdOyfXtQGqn3VnJjlDrmKXEvMi1mgYxVmukEUtVycIz1nh7oQ40bKTd4cA7rLStqu0740pnhGYxGoqsCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@mdx-js/mdx": "^3.0.0", + "source-map": "^0.7.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "webpack": ">=5" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + } + } + }, + "node_modules/@mdx-js/loader/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@mdx-js/mdx": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.1.0.tgz", + "integrity": "sha512-/QxEhPAvGwbQmy1Px8F899L5Uc2KZ6JtXwlCgJmjSTBedwOZkByYcBG4GceIGPXRDsmfxhHazuS+hlOShRLeDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdx": "^2.0.0", + "collapse-white-space": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-util-scope": "^1.0.0", + "estree-walker": "^3.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "markdown-extensions": "^2.0.0", + "recma-build-jsx": "^1.0.0", + "recma-jsx": "^1.0.0", + "recma-stringify": "^1.0.0", + "rehype-recma": "^1.0.0", + "remark-mdx": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "source-map": "^0.7.0", + "unified": "^11.0.0", + "unist-util-position-from-estree": "^2.0.0", + "unist-util-stringify-position": "^4.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/@mdx-js/mdx/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/@mdx-js/mdx/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@mdx-js/react": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mdx-js/react/-/react-3.1.0.tgz", + "integrity": "sha512-QjHtSaoameoalGnKDT3FoIl4+9RwyTmo9ZJGBdLOks/YOiWHoRDI3PUwEzOE7kEmGcV3AFcp9K6dYu9rEuKLAQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdx": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=16", + "react": ">=16" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.9.tgz", + "integrity": "sha512-OKRBiajrrxB9ATokgEQoG87Z25c67pCpYcCwmXYX8PBftC9pBfN18gnm/fh1wurSLEKIAt+QRFLFCQISrb66Jg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.4.0", + "@emnapi/runtime": "^1.4.0", + "@tybys/wasm-util": "^0.9.0" + } + }, + "node_modules/@next/env": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.3.2.tgz", + "integrity": "sha512-xURk++7P7qR9JG1jJtLzPzf0qEvqCN0A/T3DXf8IPMKo9/6FfjxtEffRJIIew/bIL4T3C2jLLqBor8B/zVlx6g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@next/mdx": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/mdx/-/mdx-15.3.2.tgz", + "integrity": "sha512-D6lSSbVzn1EiPwrBKG5QzXClcgdqiNCL8a3/6oROinzgZnYSxbVmnfs0UrqygtGSOmgW7sdJJSEOy555DoAwvw==", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "^0.7.0" + }, + "peerDependencies": { + "@mdx-js/loader": ">=0.15.0", + "@mdx-js/react": ">=0.15.0" + }, + "peerDependenciesMeta": { + "@mdx-js/loader": { + "optional": true + }, + "@mdx-js/react": { + "optional": true + } + } + }, + "node_modules/@next/mdx/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.3.2.tgz", + "integrity": "sha512-2DR6kY/OGcokbnCsjHpNeQblqCZ85/1j6njYSkzRdpLn5At7OkSdmk7WyAmB9G0k25+VgqVZ/u356OSoQZ3z0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.3.2.tgz", + "integrity": "sha512-ro/fdqaZWL6k1S/5CLv1I0DaZfDVJkWNaUU3un8Lg6m0YENWlDulmIWzV96Iou2wEYyEsZq51mwV8+XQXqMp3w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.3.2.tgz", + "integrity": "sha512-covwwtZYhlbRWK2HlYX9835qXum4xYZ3E2Mra1mdQ+0ICGoMiw1+nVAn4d9Bo7R3JqSmK1grMq/va+0cdh7bJA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.3.2.tgz", + "integrity": "sha512-KQkMEillvlW5Qk5mtGA/3Yz0/tzpNlSw6/3/ttsV1lNtMuOHcGii3zVeXZyi4EJmmLDKYcTcByV2wVsOhDt/zg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.3.2.tgz", + "integrity": "sha512-uRBo6THWei0chz+Y5j37qzx+BtoDRFIkDzZjlpCItBRXyMPIg079eIkOCl3aqr2tkxL4HFyJ4GHDes7W8HuAUg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.3.2.tgz", + "integrity": "sha512-+uxFlPuCNx/T9PdMClOqeE8USKzj8tVz37KflT3Kdbx/LOlZBRI2yxuIcmx1mPNK8DwSOMNCr4ureSet7eyC0w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.3.2.tgz", + "integrity": "sha512-LLTKmaI5cfD8dVzh5Vt7+OMo+AIOClEdIU/TSKbXXT2iScUTSxOGoBhfuv+FU8R9MLmrkIL1e2fBMkEEjYAtPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.3.2.tgz", + "integrity": "sha512-aW5B8wOPioJ4mBdMDXkt5f3j8pUr9W8AnlX0Df35uRWNT1Y6RIybxjnSUe+PhM+M1bwgyY8PHLmXZC6zT1o5tA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@rollup/plugin-buble": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-buble/-/plugin-buble-1.0.3.tgz", + "integrity": "sha512-QYD9BKkJoof0FdCFeSYYhF6/Y8e0Mnf+098xGgmWOFJ4UPHlWujjqOYeVwEm2hJPOmlR5k7HPUdAjqtOWhN64Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/buble": "^0.19.2", + "buble": "^0.20.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-buble/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@rollup/plugin-buble/node_modules/buble": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/buble/-/buble-0.20.0.tgz", + "integrity": "sha512-/1gnaMQE8xvd5qsNBl+iTuyjJ9XxeaVxAMF86dQ4EyxFJOZtsgOS8Ra+7WHgZTam5IFDtt4BguN0sH0tVTKrOw==", + "dev": true, + "dependencies": { + "acorn": "^6.4.1", + "acorn-dynamic-import": "^4.0.0", + "acorn-jsx": "^5.2.0", + "chalk": "^2.4.2", + "magic-string": "^0.25.7", + "minimist": "^1.2.5", + "regexpu-core": "4.5.4" + }, + "bin": { + "buble": "bin/buble" + } + }, + "node_modules/@rollup/plugin-buble/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@rollup/plugin-buble/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@rollup/plugin-buble/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@rollup/plugin-buble/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@rollup/plugin-buble/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@rollup/plugin-buble/node_modules/regexpu-core": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz", + "integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.0.2", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@rollup/plugin-buble/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.2.tgz", + "integrity": "sha512-BEFI2EDqzl+vA1rl97IDRZ61AIwGH093d9nz8+dThxJNH8oSoB7MjWvPCX3dkaK1/RCJ/1v/R1XB15FuSs0fQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "fdir": "^6.2.0", + "is-reference": "1.2.1", + "magic-string": "^0.30.3", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=16.0.0 || 14 >= 14.17" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/fdir": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", + "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@rollup/plugin-json": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz", + "integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.1.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-terser": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "serialize-javascript": "^6.0.1", + "smob": "^1.0.0", + "terser": "^5.17.4" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-typescript": { + "version": "12.1.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.2.tgz", + "integrity": "sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.1.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.14.0||^3.0.0||^4.0.0", + "tslib": "*", + "typescript": ">=3.7.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "tslib": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", + "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz", + "integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz", + "integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz", + "integrity": "sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz", + "integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz", + "integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz", + "integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz", + "integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz", + "integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz", + "integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz", + "integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz", + "integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz", + "integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz", + "integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz", + "integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz", + "integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz", + "integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz", + "integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz", + "integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz", + "integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@size-limit/esbuild-why": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@size-limit/esbuild-why/-/esbuild-why-11.2.0.tgz", + "integrity": "sha512-VtoQbbkvFbF314LWEaEp1+IjG0DH+9w6nP//D6Gd48SEAPLoBgqk287mjYTF9WYxg9N5lo8KjpXxEFk4gOXNpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild-visualizer": "^0.7.0", + "open": "^10.1.0" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "size-limit": "11.2.0" + } + }, + "node_modules/@size-limit/preset-small-lib": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@size-limit/preset-small-lib/-/preset-small-lib-11.2.0.tgz", + "integrity": "sha512-RFbbIVfv8/QDgTPyXzjo5NKO6CYyK5Uq5xtNLHLbw5RgSKrgo8WpiB/fNivZuNd/5Wk0s91PtaJ9ThNcnFuI3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@size-limit/esbuild": "11.2.0", + "@size-limit/file": "11.2.0", + "size-limit": "11.2.0" + }, + "peerDependencies": { + "size-limit": "11.2.0" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@size-limit/esbuild": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@size-limit/esbuild/-/esbuild-11.2.0.tgz", + "integrity": "sha512-vSg9H0WxGQPRzDnBzeDyD9XT0Zdq0L+AI3+77/JhxznbSCMJMMr8ndaWVQRhOsixl97N0oD4pRFw2+R1Lcvi6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "nanoid": "^5.1.0" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "size-limit": "11.2.0" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/@size-limit/file": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@size-limit/file/-/file-11.2.0.tgz", + "integrity": "sha512-OZHE3putEkQ/fgzz3Tp/0hSmfVo3wyTpOJSRNm6AmcwX4Nm9YtTfbQQ/hZRwbBFR23S7x2Sd9EbqYzngKwbRoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "size-limit": "11.2.0" + } + }, + "node_modules/@size-limit/preset-small-lib/node_modules/nanoid": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.4.tgz", + "integrity": "sha512-GTFcMIDgR7tqji/LpSY8rtg464VnJl/j6ypoehYnuGb+Y8qZUdtKB8WVCXon0UEZgFDbuUxpIl//6FHLHgXSNA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.js" + }, + "engines": { + "node": "^18 || >=20" + } + }, + "node_modules/@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/@swc/helpers": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tybys/wasm-util": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", + "integrity": "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", + "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/buble": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@types/buble/-/buble-0.19.2.tgz", + "integrity": "sha512-uUD8zIfXMKThmFkahTXDGI3CthFH1kMg2dOm3KLi4GlC5cbARA64bEcUMbbWdWdE73eoc/iBB9PiTMqH0dNS2Q==", + "dev": true, + "dependencies": { + "magic-string": "^0.25.0" + } + }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/gensync": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/gensync/-/gensync-1.0.4.tgz", + "integrity": "sha512-C3YYeRQWp2fmq9OryX+FoDy8nXS6scQ7dPptD8LnFDAUNcKWJjXQKDNJD3HVm+kOUsXhTOkpi69vI4EuAr95bA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jsdom": { + "version": "20.0.1", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", + "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", + "dev": true, + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/mdx": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.13.tgz", + "integrity": "sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.15.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.17.tgz", + "integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/prismjs": { + "version": "1.26.3", + "resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.3.tgz", + "integrity": "sha512-A0D0aTXvjlqJ5ZILMz3rNfDBOx9hHxLZYv2by47Sm/pqW35zzjusrZTryatjN/Rf8Us2gZrJD+KeHbUSTux1Cw==", + "dev": true + }, + "node_modules/@types/random-seed": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@types/random-seed/-/random-seed-0.3.5.tgz", + "integrity": "sha512-CftxcDPAHgs0SLHU2dt+ZlDPJfGqLW3sZlC/ATr5vJDSe5tRLeOne7HMvCOJnFyF8e1U41wqzs3h6AMC613xtA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.0.tgz", + "integrity": "sha512-UaicktuQI+9UKyA4njtDOGBD/67t8YEBt2xdfqu8+gP9hqPUPsiXlNPcpS2gVdjmis5GKPG3fCxbQLVgxsQZ8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.0.2" + } + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "dev": true + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz", + "integrity": "sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==", + "dev": true + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.24.0.tgz", + "integrity": "sha512-aFcXEJJCI4gUdXgoo/j9udUYIHgF23MFkg09LFz2dzEmU0+1Plk4rQWv/IYKvPHAtlkkGoB3m5e6oUp+JPsNaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.24.0", + "@typescript-eslint/type-utils": "8.24.0", + "@typescript-eslint/utils": "8.24.0", + "@typescript-eslint/visitor-keys": "8.24.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.24.0.tgz", + "integrity": "sha512-MFDaO9CYiard9j9VepMNa9MTcqVvSny2N4hkY6roquzj8pdCBRENhErrteaQuu7Yjn1ppk0v1/ZF9CG3KIlrTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.24.0", + "@typescript-eslint/types": "8.24.0", + "@typescript-eslint/typescript-estree": "8.24.0", + "@typescript-eslint/visitor-keys": "8.24.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.24.0.tgz", + "integrity": "sha512-HZIX0UByphEtdVBKaQBgTDdn9z16l4aTUz8e8zPQnyxwHBtf5vtl1L+OhH+m1FGV9DrRmoDuYKqzVrvWDcDozw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.24.0", + "@typescript-eslint/visitor-keys": "8.24.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.24.0.tgz", + "integrity": "sha512-8fitJudrnY8aq0F1wMiPM1UUgiXQRJ5i8tFjq9kGfRajU+dbPyOuHbl0qRopLEidy0MwqgTHDt6CnSeXanNIwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "8.24.0", + "@typescript-eslint/utils": "8.24.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.24.0.tgz", + "integrity": "sha512-VacJCBTyje7HGAw7xp11q439A+zeGG0p0/p2zsZwpnMzjPB5WteaWqt4g2iysgGFafrqvyLWqq6ZPZAOCoefCw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.24.0.tgz", + "integrity": "sha512-ITjYcP0+8kbsvT9bysygfIfb+hBj6koDsu37JZG7xrCiy3fPJyNmfVtaGsgTUSEuTzcvME5YI5uyL5LD1EV5ZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.24.0", + "@typescript-eslint/visitor-keys": "8.24.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.24.0.tgz", + "integrity": "sha512-07rLuUBElvvEb1ICnafYWr4hk8/U7X9RDCOqd9JcAMtjh/9oRmcfN4yGzbPVirgMR0+HLVHehmu19CWeh7fsmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.24.0", + "@typescript-eslint/types": "8.24.0", + "@typescript-eslint/typescript-estree": "8.24.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.24.0.tgz", + "integrity": "sha512-kArLq83QxGLbuHrTMoOEWO+l2MwsNS2TGISEdx8xgqpkbytB07XmlQyQdNDrCc1ecSqx0cnmhGvpX+VBwqqSkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.24.0", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true, + "license": "ISC" + }, + "node_modules/@unrs/resolver-binding-darwin-arm64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.7.2.tgz", + "integrity": "sha512-vxtBno4xvowwNmO/ASL0Y45TpHqmNkAaDtz4Jqb+clmcVSSl8XCG/PNFFkGsXXXS6AMjP+ja/TtNCFFa1QwLRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-x64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.7.2.tgz", + "integrity": "sha512-qhVa8ozu92C23Hsmv0BF4+5Dyyd5STT1FolV4whNgbY6mj3kA0qsrGPe35zNR3wAN7eFict3s4Rc2dDTPBTuFQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-freebsd-x64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.7.2.tgz", + "integrity": "sha512-zKKdm2uMXqLFX6Ac7K5ElnnG5VIXbDlFWzg4WJ8CGUedJryM5A3cTgHuGMw1+P5ziV8CRhnSEgOnurTI4vpHpg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.7.2.tgz", + "integrity": "sha512-8N1z1TbPnHH+iDS/42GJ0bMPLiGK+cUqOhNbMKtWJ4oFGzqSJk/zoXFzcQkgtI63qMcUI7wW1tq2usZQSb2jxw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-musleabihf": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.7.2.tgz", + "integrity": "sha512-tjYzI9LcAXR9MYd9rO45m1s0B/6bJNuZ6jeOxo1pq1K6OBuRMMmfyvJYval3s9FPPGmrldYA3mi4gWDlWuTFGA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.7.2.tgz", + "integrity": "sha512-jon9M7DKRLGZ9VYSkFMflvNqu9hDtOCEnO2QAryFWgT6o6AXU8du56V7YqnaLKr6rAbZBWYsYpikF226v423QA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-musl": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.7.2.tgz", + "integrity": "sha512-c8Cg4/h+kQ63pL43wBNaVMmOjXI/X62wQmru51qjfTvI7kmCy5uHTJvK/9LrF0G8Jdx8r34d019P1DVJmhXQpA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-ppc64-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.7.2.tgz", + "integrity": "sha512-A+lcwRFyrjeJmv3JJvhz5NbcCkLQL6Mk16kHTNm6/aGNc4FwPHPE4DR9DwuCvCnVHvF5IAd9U4VIs/VvVir5lg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.7.2.tgz", + "integrity": "sha512-hQQ4TJQrSQW8JlPm7tRpXN8OCNP9ez7PajJNjRD1ZTHQAy685OYqPrKjfaMw/8LiHCt8AZ74rfUVHP9vn0N69Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-musl": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.7.2.tgz", + "integrity": "sha512-NoAGbiqrxtY8kVooZ24i70CjLDlUFI7nDj3I9y54U94p+3kPxwd2L692YsdLa+cqQ0VoqMWoehDFp21PKRUoIQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-s390x-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.7.2.tgz", + "integrity": "sha512-KaZByo8xuQZbUhhreBTW+yUnOIHUsv04P8lKjQ5otiGoSJ17ISGYArc+4vKdLEpGaLbemGzr4ZeUbYQQsLWFjA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.7.2.tgz", + "integrity": "sha512-dEidzJDubxxhUCBJ/SHSMJD/9q7JkyfBMT77Px1npl4xpg9t0POLvnWywSk66BgZS/b2Hy9Y1yFaoMTFJUe9yg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-musl": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.7.2.tgz", + "integrity": "sha512-RvP+Ux3wDjmnZDT4XWFfNBRVG0fMsc+yVzNFUqOflnDfZ9OYujv6nkh+GOr+watwrW4wdp6ASfG/e7bkDradsw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-wasm32-wasi": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.7.2.tgz", + "integrity": "sha512-y797JBmO9IsvXVRCKDXOxjyAE4+CcZpla2GSoBQ33TVb3ILXuFnMrbR/QQZoauBYeOFuu4w3ifWLw52sdHGz6g==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^0.2.9" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@unrs/resolver-binding-win32-arm64-msvc": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.7.2.tgz", + "integrity": "sha512-gtYTh4/VREVSLA+gHrfbWxaMO/00y+34htY7XpioBTy56YN2eBjkPrY1ML1Zys89X3RJDKVaogzwxlM1qU7egg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-ia32-msvc": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.7.2.tgz", + "integrity": "sha512-Ywv20XHvHTDRQs12jd3MY8X5C8KLjDbg/jyaal/QLKx3fAShhJyD4blEANInsjxW3P7isHx1Blt56iUDDJO3jg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-x64-msvc": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.7.2.tgz", + "integrity": "sha512-friS8NEQfHaDbkThxopGk+LuE5v3iY0StruifjQEt7SLbA46OnfgMO15sOTkbpJkol6RB+1l1TYPXh0sCddpvA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "dev": true + }, + "node_modules/acorn": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", + "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-dynamic-import": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz", + "integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0" + } + }, + "node_modules/acorn-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", + "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", + "dev": true, + "dependencies": { + "acorn": "^8.1.0", + "acorn-walk": "^8.0.2" + } + }, + "node_modules/acorn-globals/node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", + "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", + "dev": true, + "license": "MIT", + "dependencies": { + "clean-stack": "^4.0.0", + "indent-string": "^5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlast": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", + "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", + "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", + "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3", + "es-errors": "^1.3.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/arrify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-3.0.0.tgz", + "integrity": "sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/astring": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz", + "integrity": "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==", + "dev": true, + "license": "MIT", + "bin": { + "astring": "bin/astring" + } + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/babel-jest": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.4.tgz", + "integrity": "sha512-meLj23UlSLddj6PC+YTOFRgDAtjnZom8w/ACsrx0gtPtv5cJZk0A5Unk5bV4wixD7XaPCN1fQvpww8czkZURmw==", + "dev": true, + "dependencies": { + "@jest/transform": "^29.6.4", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/benchmark": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", + "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", + "dev": true, + "dependencies": { + "lodash": "^4.17.4", + "platform": "^1.3.3" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "run-applescript": "^7.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dev": true, + "dependencies": { + "streamsearch": "^1.1.0" + }, + "engines": { + "node": ">=10.16.0" + } + }, + "node_modules/bytes-iec": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes-iec/-/bytes-iec-3.1.1.tgz", + "integrity": "sha512-fey6+4jDK7TFtFg/klGSvNKJctyU7n2aQdnM+CO0ruLPbqqMOM8Tio0Pc+deqUeVKX1tL5DQep1zQ7+37aTAsA==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", + "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", + "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001699", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001699.tgz", + "integrity": "sha512-b+uH5BakXZ9Do9iK+CkDmctUSEqZl+SP056vc5usa0PL+ev5OHw003rZXcnjNDv3L8P5j6rwT6C0BPKSikW08w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "dev": true + }, + "node_modules/clean-stack": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-4.2.0.tgz", + "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "5.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clean-stack/node_modules/escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/cliui/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/codemirror": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.1.tgz", + "integrity": "sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/commands": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/search": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0" + } + }, + "node_modules/collapse-white-space": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz", + "integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, + "node_modules/color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "color-convert": "^2.0.1", + "color-string": "^1.9.0" + }, + "engines": { + "node": ">=12.5.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true, + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "node_modules/cp-file": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-10.0.0.tgz", + "integrity": "sha512-vy2Vi1r2epK5WqxOLnskeKeZkdZvTKfFZQCplE3XWsP+SUJyd5XAUFC9lFgTjjXJF2GMne/UML14iEmkAaDfFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.10", + "nested-error-stacks": "^2.1.1", + "p-event": "^5.0.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cpy": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/cpy/-/cpy-10.1.0.tgz", + "integrity": "sha512-VC2Gs20JcTyeQob6UViBLnyP0bYHkBh6EiKzot9vi2DmeGlFT9Wd7VG3NBrkNx/jYvFBeyDOMMHdHQhbtKLgHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "arrify": "^3.0.0", + "cp-file": "^10.0.0", + "globby": "^13.1.4", + "junk": "^4.0.1", + "micromatch": "^4.0.5", + "nested-error-stacks": "^2.1.1", + "p-filter": "^3.0.0", + "p-map": "^6.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cpy-cli": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cpy-cli/-/cpy-cli-5.0.0.tgz", + "integrity": "sha512-fb+DZYbL9KHc0BC4NYqGRrDIJZPXUmjjtqdw4XRRg8iV8dIfghUX/WiL+q4/B/KFTy3sK6jsbUhBaz0/Hxg7IQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "cpy": "^10.1.0", + "meow": "^12.0.1" + }, + "bin": { + "cpy": "cli.js" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cpy/node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cpy/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/crelt": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", + "dev": true + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + }, + "node_modules/csstype": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.8.tgz", + "integrity": "sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==", + "dev": true + }, + "node_modules/data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "dev": true + }, + "node_modules/decode-named-character-reference": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz", + "integrity": "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dedent": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-browser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", + "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/default-browser-id": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", + "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "dev": true, + "dependencies": { + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.97", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.97.tgz", + "integrity": "sha512-HKLtaH02augM7ZOdYRuO19rWDeY+QSJ1VxnXFa/XDFLf07HvM90pALIJFgrO+UVaajI3+aJMMpojoUTLZyQ7JQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.23.9", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.9.tgz", + "integrity": "sha512-py07lI0wjxAC/DcfK1S6G7iANonniZwTISvdPzk9hzeH0IZIshbuuFxLIU96OyF89Yb9hiqWn8M/bY83KY5vzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.0", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-regex": "^1.2.1", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.0", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.3", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.18" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.1.tgz", + "integrity": "sha512-uDn+FE1yrDzyC0pCo961B2IHbdM8y/ACZsKD4dG6WqrjV53BADjwa7D+1aom2rsNVfLyDgU/eigvlJGJ08OQ4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.0.3", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.6", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.4", + "safe-array-concat": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/esast-util-from-estree": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/esast-util-from-estree/-/esast-util-from-estree-2.0.0.tgz", + "integrity": "sha512-4CyanoAudUSBAn5K13H4JhsMH6L9ZP7XbLVe/dKybkxMO7eDyLsT8UHl9TRNrU2Gr9nz+FovfSIjuXWJ81uVwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-visit": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/esast-util-from-js": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/esast-util-from-js/-/esast-util-from-js-2.0.1.tgz", + "integrity": "sha512-8Ja+rNJ0Lt56Pcf3TAmpBZjmx8ZcK5Ts4cAzIOjsjevg9oSXJnl6SUQ2EevU8tv3h6ZLWmoKL5H4fgWvdvfETw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "acorn": "^8.0.0", + "esast-util-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/esast-util-from-js/node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/esbuild": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", + "integrity": "sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.1", + "@esbuild/android-arm": "0.25.1", + "@esbuild/android-arm64": "0.25.1", + "@esbuild/android-x64": "0.25.1", + "@esbuild/darwin-arm64": "0.25.1", + "@esbuild/darwin-x64": "0.25.1", + "@esbuild/freebsd-arm64": "0.25.1", + "@esbuild/freebsd-x64": "0.25.1", + "@esbuild/linux-arm": "0.25.1", + "@esbuild/linux-arm64": "0.25.1", + "@esbuild/linux-ia32": "0.25.1", + "@esbuild/linux-loong64": "0.25.1", + "@esbuild/linux-mips64el": "0.25.1", + "@esbuild/linux-ppc64": "0.25.1", + "@esbuild/linux-riscv64": "0.25.1", + "@esbuild/linux-s390x": "0.25.1", + "@esbuild/linux-x64": "0.25.1", + "@esbuild/netbsd-arm64": "0.25.1", + "@esbuild/netbsd-x64": "0.25.1", + "@esbuild/openbsd-arm64": "0.25.1", + "@esbuild/openbsd-x64": "0.25.1", + "@esbuild/sunos-x64": "0.25.1", + "@esbuild/win32-arm64": "0.25.1", + "@esbuild/win32-ia32": "0.25.1", + "@esbuild/win32-x64": "0.25.1" + } + }, + "node_modules/esbuild-visualizer": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/esbuild-visualizer/-/esbuild-visualizer-0.7.0.tgz", + "integrity": "sha512-Vz22k+G2WT7GuCo7rbhaQwGbZ26lEhwzsctkEdQlu2SVrshoM4hzQeRpu/3DP596a9+9K2JyYsinuC6AC896Og==", + "dev": true, + "license": "MIT", + "dependencies": { + "open": "^8.4.0", + "picomatch": "^4.0.0", + "yargs": "^17.6.2" + }, + "bin": { + "esbuild-visualizer": "dist/bin/cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/esbuild-visualizer/node_modules/define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/esbuild-visualizer/node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/esbuild-visualizer/node_modules/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, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/esbuild-visualizer/node_modules/open": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", + "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/esbuild-visualizer/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/eslint": { + "version": "9.20.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.20.1.tgz", + "integrity": "sha512-m1mM33o6dBUjxl2qb6wv6nGNwCAsns1eKtaQ4l/NPHeTvhiUPbtdfMyktxN4B3fgHIgsYh1VT3V9txblpQHq+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.11.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.20.0", + "@eslint/plugin-kit": "^0.2.5", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.3.4.tgz", + "integrity": "sha512-buzw5z5VtiQMysYLH9iW9BV04YyZebsw+gPi+c4FCjfS9i6COYOrEWw9t3m3wA9PFBfqcBCqWf32qrXLbwafDw==", + "dev": true, + "license": "ISC", + "dependencies": { + "debug": "^4.4.0", + "get-tsconfig": "^4.10.0", + "is-bun-module": "^2.0.0", + "stable-hash": "^0.0.5", + "tinyglobby": "^0.2.13", + "unrs-resolver": "^1.6.3" + }, + "engines": { + "node": "^16.17.0 || >=18.6.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-resolver-typescript" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz", + "integrity": "sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz", + "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.8", + "array.prototype.findlastindex": "^1.2.5", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.0", + "hasown": "^2.0.2", + "is-core-module": "^2.15.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.0", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.8", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-jest": { + "version": "28.11.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.11.0.tgz", + "integrity": "sha512-QAfipLcNCWLVocVbZW8GimKn5p5iiMcgGbRzz8z/P5q7xw+cNEpYqyzFMtIF/ZgF2HLOyy+dYBut+DoYolvqig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "engines": { + "node": "^16.10.0 || ^18.12.0 || >=20.0.0" + }, + "peerDependencies": { + "@typescript-eslint/eslint-plugin": "^6.0.0 || ^7.0.0 || ^8.0.0", + "eslint": "^7.0.0 || ^8.0.0 || ^9.0.0", + "jest": "*" + }, + "peerDependenciesMeta": { + "@typescript-eslint/eslint-plugin": { + "optional": true + }, + "jest": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.37.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.4.tgz", + "integrity": "sha512-BGP0jRmfYyvOyvMoRX/uoUeW+GqNj9y16bPQzqAHf3AYII/tDs+jMN0dBVkl88/OZwNGwrVFxE7riHsXVfy/LQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.8", + "array.prototype.findlast": "^1.2.5", + "array.prototype.flatmap": "^1.3.3", + "array.prototype.tosorted": "^1.1.4", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.2.1", + "estraverse": "^5.3.0", + "hasown": "^2.0.2", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.8", + "object.fromentries": "^2.0.8", + "object.values": "^1.2.1", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.12", + "string.prototype.repeat": "^1.0.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" + } + }, + "node_modules/eslint-plugin-react/node_modules/resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/eslint-scope": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree/node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-util-attach-comments": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-attach-comments/-/estree-util-attach-comments-3.0.0.tgz", + "integrity": "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-build-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/estree-util-build-jsx/-/estree-util-build-jsx-3.0.1.tgz", + "integrity": "sha512-8U5eiL6BTrPxp/CHbs2yMgP8ftMhR5ww1eIKoWRMlqvltHF8fZn5LRDvTKuxD3DUn+shRbLGqXemcP51oFCsGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-walker": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-build-jsx/node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-scope": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/estree-util-scope/-/estree-util-scope-1.0.0.tgz", + "integrity": "sha512-2CAASclonf+JFWBNJPndcOpA8EMJwa0Q8LUFJEKqXLW6+qBvbFZuF5gItbQOs/umBUkjviCSDCbBwU2cXbmrhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-to-js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-to-js/-/estree-util-to-js-2.0.0.tgz", + "integrity": "sha512-WDF+xj5rRWmD5tj6bIqRi6CkLIXbbNQUcxQHzGysQzvHmdYG2G7p/Tf0J0gpxGgkeMZNTIjT/AoSvC9Xehcgdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "astring": "^1.8.0", + "source-map": "^0.7.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-util-to-js/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/estree-util-visit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz", + "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-check": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.0.0.tgz", + "integrity": "sha512-aXLyLemZ7qhLNn2oq+YpjT2Xed21+i29WGAYuyrGbU4r8oinB3i4XR4e62O3NY6qmm5qHEDoc/7d+gMsri3AfA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT", + "dependencies": { + "pure-rand": "^7.0.0" + }, + "engines": { + "node": ">=12.17.0" + } + }, + "node_modules/fast-check/node_modules/pure-rand": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-7.0.1.tgz", + "integrity": "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "dev": true, + "license": "ISC" + }, + "node_modules/flow-bin": { + "version": "0.160.0", + "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.160.0.tgz", + "integrity": "sha512-hqb/1z7U9Jv+2hDdslAgdab6D4AUDrYIcF2zH/CKx9YgQtCeHfnzCcypzCNU7xmBm2+Mi9+1hqeB4OQX2adh0A==", + "dev": true, + "bin": { + "flow": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", + "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "function-bind": "^1.1.2", + "get-proto": "^1.0.0", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-tsconfig": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz", + "integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, + "node_modules/has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hast-util-to-estree": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz", + "integrity": "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-attach-comments": "^3.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "node_modules/html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "dependencies": { + "whatwg-encoding": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/import-local/node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/inline-style-parser": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz", + "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bun-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz", + "integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.7.1" + } + }, + "node_modules/is-bun-module/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/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, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz", + "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-report/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/iterator.prototype": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/jest": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.6.4.tgz", + "integrity": "sha512-tEFhVQFF/bzoYV1YuGyzLPZ6vlPrdfvDmmAxudA1dLEuiztqg2Rkx20vkKY32xiDROcD2KXlgZ7Cu8RPeEHRKw==", + "dev": true, + "dependencies": { + "@jest/core": "^29.6.4", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.6.4" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.6.3.tgz", + "integrity": "sha512-G5wDnElqLa4/c66ma5PG9eRjE342lIbF6SUnTJi26C3J28Fv2TVY2rOyKB9YGbSA5ogwevgmxc4j4aVjrEK6Yg==", + "dev": true, + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.6.3", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.6.4.tgz", + "integrity": "sha512-YXNrRyntVUgDfZbjXWBMPslX1mQ8MrSG0oM/Y06j9EYubODIyHWP8hMUbjbZ19M3M+zamqEur7O80HODwACoJw==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.4", + "@jest/expect": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.6.3", + "jest-matcher-utils": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-runtime": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", + "p-limit": "^3.1.0", + "pretty-format": "^29.6.3", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.6.4.tgz", + "integrity": "sha512-+uMCQ7oizMmh8ZwRfZzKIEszFY9ksjjEQnTEMTaL7fYiL3Kw4XhqT9bYh+A4DQKUb67hZn2KbtEnDuHvcgK4pQ==", + "dev": true, + "dependencies": { + "@jest/core": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "import-local": "^3.0.2", + "jest-config": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "prompts": "^2.0.1", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.6.4.tgz", + "integrity": "sha512-JWohr3i9m2cVpBumQFv2akMEnFEPVOh+9L2xIBJhJ0zOaci2ZXuKJj0tgMKQCBZAKA09H049IR4HVS/43Qb19A==", + "dev": true, + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.6.4", + "@jest/types": "^29.6.3", + "babel-jest": "^29.6.4", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.6.4", + "jest-environment-node": "^29.6.4", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-runner": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.6.3", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-config/node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.6.3.tgz", + "integrity": "sha512-2+H+GOTQBEm2+qFSQ7Ma+BvyV+waiIFxmZF5LdpBsAEjWX8QYjSCa4FrkIYtbfXUJJJnFCYrOtt6TZ+IAiTjBQ==", + "dev": true, + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.6.3.tgz", + "integrity": "sha512-KoXfJ42k8cqbkfshW7sSHcdfnv5agDdHCPA87ZBdmHP+zJstTJc0ttQaJ/x7zK6noAL76hOuTIJ6ZkQRS5dcyg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.6.3", + "pretty-format": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-jsdom": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.6.4.tgz", + "integrity": "sha512-K6wfgUJ16DoMs02JYFid9lOsqfpoVtyJxpRlnTxUHzvZWBnnh2VNGRB9EC1Cro96TQdq5TtSjb3qUjNaJP9IyA==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/jsdom": "^20.0.0", + "@types/node": "*", + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3", + "jsdom": "^20.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jest-environment-node": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.6.4.tgz", + "integrity": "sha512-i7SbpH2dEIFGNmxGCpSc2w9cA4qVD+wfvg2ZnfQ7XVrKL0NA5uDVBIiGH8SR4F0dKEv/0qI5r+aDomDf04DpEQ==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.6.3.tgz", + "integrity": "sha512-0kfbESIHXYdhAdpLsW7xdwmYhLf1BRu4AA118/OxFm0Ho1b2RcTmO4oF6aAMaxpxdxnJ3zve2rgwzNBD4Zbm7Q==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.6.4.tgz", + "integrity": "sha512-fPRq+0vcxsuGlG0O3gyoqGTAxasagOxEuyoxHeyxaZbc9QNek0AmJWSkhjlMG+mTsj+8knc/mWb3fXlRNVih7Q==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.4", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.4.tgz", + "integrity": "sha512-7+6eAmr1ZBF3vOAJVsfLj1QdqeXG+WYhidfLHBRZqGN24MFRIiKG20ItpLw2qRAsW/D2ZUUmCNf6irUr/v6KHA==", + "dev": true, + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.6.4" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.6.4.tgz", + "integrity": "sha512-SDaLrMmtVlQYDuG0iSPYLycG8P9jLI+fRm8AF/xPKhYDB2g6xDWjXBrR5M8gEWsK6KVFlebpZ4QsrxdyIX1Jaw==", + "dev": true, + "dependencies": { + "@jest/console": "^29.6.4", + "@jest/environment": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.6.3", + "jest-environment-node": "^29.6.4", + "jest-haste-map": "^29.6.4", + "jest-leak-detector": "^29.6.3", + "jest-message-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-runtime": "^29.6.4", + "jest-util": "^29.6.3", + "jest-watcher": "^29.6.4", + "jest-worker": "^29.6.4", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner/node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.6.4.tgz", + "integrity": "sha512-s/QxMBLvmwLdchKEjcLfwzP7h+jsHvNEtxGP5P+Fl1FMaJX2jMiIqe4rJw4tFprzCwuSvVUo9bn0uj4gNRXsbA==", + "dev": true, + "dependencies": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/globals": "^29.6.4", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-mock": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.6.3.tgz", + "integrity": "sha512-e7KWZcAIX+2W1o3cHfnqpGajdCs1jSM3DkXjGeLSNmCazv1EeI1ggTeK5wdZhF+7N+g44JI2Od3veojoaumlfg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.6.4.tgz", + "integrity": "sha512-oqUWvx6+On04ShsT00Ir9T4/FvBeEh2M9PTubgITPxDa739p4hoQweWPRGyYeaojgT0xTpZKF0Y/rSY1UgMxvQ==", + "dev": true, + "dependencies": { + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.6.3", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/jiti": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz", + "integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "dependencies": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/jsdom/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jsdom/node_modules/tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "dev": true, + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsdom/node_modules/universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true, + "license": "ISC" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonml-html": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/jsonml-html/-/jsonml-html-1.2.0.tgz", + "integrity": "sha512-vg30gQFD5X+1nY3do43BW9Iiq4F5BZcysXc+ydPNu7O5AxaqxnaI9ikjTjlE9y9KaAvgTwTP6nOpifDqDoYmjg==", + "dev": true, + "license": "ISC" + }, + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/junk": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/junk/-/junk-4.0.1.tgz", + "integrity": "sha512-Qush0uP+G8ZScpGMZvHUiRfI0YBWuB3gVBYlI0v0vvOJt5FLicco+IkP0a50LqTTQhmts/m6tP5SWE+USyIvcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true, + "license": "ISC" + }, + "node_modules/make-synchronous": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/make-synchronous/-/make-synchronous-0.1.1.tgz", + "integrity": "sha512-Y4SxxqhaoyMDokJQ0AZz0E+bLhRkOSR7Z/IQoTKPdS6HYi3aobal2kMHoHHoqBadPWjf07P4K1FQLXOx3wf9Yw==", + "dev": true, + "dependencies": { + "subsume": "^3.0.0", + "type-fest": "^0.16.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-synchronous/node_modules/type-fest": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.16.0.tgz", + "integrity": "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/markdown-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz", + "integrity": "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/marked": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-11.2.0.tgz", + "integrity": "sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/marked-highlight": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/marked-highlight/-/marked-highlight-2.1.0.tgz", + "integrity": "sha512-peBvgGZZqUw074Vy/N8Y7/6JQhSnR54/T0Ozq2/fAIBzcYfVfExFdQJptIhQxreR1elpwvJRrqhp6S/Prk8prA==", + "dev": true, + "peerDependencies": { + "marked": ">=4 <12" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", + "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", + "dev": true, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16.10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-mdx-expression": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.1.tgz", + "integrity": "sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-mdx-expression": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-extension-mdx-jsx": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.2.tgz", + "integrity": "sha512-e5+q1DjMh62LZAJOnDraSSbDMvGJ8x3cbjygy2qFEi7HCeUT4BDKCvMozPozcD6WmOt6sVvYDNBKhFSz3kjOVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "micromark-factory-mdx-expression": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdx-md": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz", + "integrity": "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdxjs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz", + "integrity": "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.0.0", + "acorn-jsx": "^5.0.0", + "micromark-extension-mdx-expression": "^3.0.0", + "micromark-extension-mdx-jsx": "^3.0.0", + "micromark-extension-mdx-md": "^2.0.0", + "micromark-extension-mdxjs-esm": "^3.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdxjs-esm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz", + "integrity": "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-mdxjs/node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-mdx-expression": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.3.tgz", + "integrity": "sha512-kQnEtA3vzucU2BkrIa8/VaSAsP+EJ3CKOvhMuJgOEGg9KDC6OAY6nSnNDVRiVNRqj7Y4SlSzcStaH/5jge8JdQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-events-to-acorn": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.3.tgz", + "integrity": "sha512-jmsiEIiZ1n7X1Rr5k8wVExBQCg5jy4UXVADItHmNk1zkwEVhBuIUKRu3fqv+hs4nxLISi2DQGlqIOGiFxgbfHg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/unist": "^3.0.0", + "devlop": "^1.0.0", + "estree-util-visit": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "dev": true, + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/microtime": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/microtime/-/microtime-3.1.1.tgz", + "integrity": "sha512-to1r7o24cDsud9IhN6/8wGmMx5R2kT0w2Xwm5okbYI3d1dk6Xv0m+Z+jg2vS9pt+ocgQHTCtgs/YuyJhySzxNg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-addon-api": "^5.0.0", + "node-gyp-build": "^4.4.0" + }, + "engines": { + "node": ">= 14.13.0" + } + }, + "node_modules/mime-db": { + "version": "1.49.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", + "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.32", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", + "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", + "dev": true, + "dependencies": { + "mime-db": "1.49.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/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, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.10.tgz", + "integrity": "sha512-vSJJTG+t/dIKAUhUDw/dLdZ9s//5OxcHqLaDWWrW4Cdq7o6tdLIczUkMXt2MBNmk6sJRZBZRXVixs7URY1CmIg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/nanospinner": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/nanospinner/-/nanospinner-1.2.2.tgz", + "integrity": "sha512-Zt/AmG6qRU3e+WnzGGLuMCEAO/dAu45stNbHY223tUxldaDAeE+FxSPsd9Q+j+paejmm0ZbrNVs5Sraqy3dRxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^1.1.1" + } + }, + "node_modules/napi-postinstall": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.2.3.tgz", + "integrity": "sha512-Mi7JISo/4Ij2tDZ2xBE2WH+/KvVlkhA6juEjpEeRAVPNCpN3nxJo/5FhDNKgBcdmcmhaH6JjgST4xY/23ZYK0w==", + "dev": true, + "license": "MIT", + "bin": { + "napi-postinstall": "lib/cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/napi-postinstall" + } + }, + "node_modules/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 + }, + "node_modules/nested-error-stacks": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.1.tgz", + "integrity": "sha512-9iN1ka/9zmX1ZvLV9ewJYEk9h7RyRRtqdK0woXcqohu8EWIerfPUjYJPg0ULy0UqP7cslmdGc8xKDJcojlKiaw==", + "dev": true, + "license": "MIT" + }, + "node_modules/next": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/next/-/next-15.3.2.tgz", + "integrity": "sha512-CA3BatMyHkxZ48sgOCLdVHjFU36N7TF1HhqAHLFOkV6buwZnvMI84Cug8xD56B9mCuKrqXnLn94417GrZ/jjCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@next/env": "15.3.2", + "@swc/counter": "0.1.3", + "@swc/helpers": "0.5.15", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001579", + "postcss": "8.4.31", + "styled-jsx": "5.1.6" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "15.3.2", + "@next/swc-darwin-x64": "15.3.2", + "@next/swc-linux-arm64-gnu": "15.3.2", + "@next/swc-linux-arm64-musl": "15.3.2", + "@next/swc-linux-x64-gnu": "15.3.2", + "@next/swc-linux-x64-musl": "15.3.2", + "@next/swc-win32-arm64-msvc": "15.3.2", + "@next/swc-win32-x64-msvc": "15.3.2", + "sharp": "^0.34.1" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.41.2", + "babel-plugin-react-compiler": "*", + "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "@playwright/test": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/next-sitemap": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/next-sitemap/-/next-sitemap-4.2.3.tgz", + "integrity": "sha512-vjdCxeDuWDzldhCnyFCQipw5bfpl4HmZA7uoo3GAaYGjGgfL4Cxb1CiztPuWGmS+auYs7/8OekRS8C2cjdAsjQ==", + "dev": true, + "funding": [ + { + "url": "https://github.com/iamvishnusankar/next-sitemap.git" + } + ], + "dependencies": { + "@corex/deepmerge": "^4.0.43", + "@next/env": "^13.4.3", + "fast-glob": "^3.2.12", + "minimist": "^1.2.8" + }, + "bin": { + "next-sitemap": "bin/next-sitemap.mjs", + "next-sitemap-cjs": "bin/next-sitemap.cjs" + }, + "engines": { + "node": ">=14.18" + }, + "peerDependencies": { + "next": "*" + } + }, + "node_modules/next-sitemap/node_modules/@next/env": { + "version": "13.5.8", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.8.tgz", + "integrity": "sha512-YmiG58BqyZ2FjrF2+5uZExL2BrLr8RTQzLXNDJ8pJr0O+rPlOeDPXp1p1/4OrR3avDidzZo3D8QO2cuDv1KCkw==", + "dev": true, + "license": "MIT" + }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node_modules/node-addon-api": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-gyp-build": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", + "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", + "dev": true, + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", + "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "chalk": "^2.4.1", + "cross-spawn": "^6.0.5", + "memorystream": "^0.3.1", + "minimatch": "^3.0.4", + "pidtree": "^0.3.0", + "read-pkg": "^3.0.0", + "shell-quote": "^1.6.1", + "string.prototype.padend": "^3.0.0" + }, + "bin": { + "npm-run-all": "bin/npm-run-all/index.js", + "run-p": "bin/run-p/index.js", + "run-s": "bin/run-s/index.js" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/npm-run-all/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/npm-run-all/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/npm-run-all/node_modules/cross-spawn": { + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "dev": true, + "license": "MIT", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/npm-run-all/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/npm-run-all/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/npm-run-all/node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all/node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-all/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nwsapi": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", + "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", + "dev": true + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.8.tgz", + "integrity": "sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/open": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", + "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^3.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "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.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/p-event": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-5.0.1.tgz", + "integrity": "sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-timeout": "^5.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-filter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-3.0.0.tgz", + "integrity": "sha512-QtoWLjXAW++uTX67HZQz1dbTpqBfiidsB6VtQUC9iR85S120+s0T5sO6s+B5MLzFcZkrEd/DGMmCjR+f2Qpxwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-map": "^5.1.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-filter/node_modules/p-map": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-5.5.0.tgz", + "integrity": "sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-6.0.0.tgz", + "integrity": "sha512-T8BatKGY+k5rU+Q/GTYgrEf2r4xRMevAN5mtXc2aPc4rS1j3s+vWTaO2Wag94neXuCAUAs8cxBL9EeB5EA6diw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-timeout": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", + "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "dev": true, + "license": "MIT" + }, + "node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "license": "MIT", + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pidtree": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", + "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/platform": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", + "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==", + "dev": true + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.0.tgz", + "integrity": "sha512-quyMrVt6svPS7CjQ9gKb3GLEX/rl3BCL2oa/QkNcXv4YNVBC9olt3s+H7ukto06q7B1Qz46PbrKLO34PR6vXcA==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/pretty-format/node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true, + "license": "MIT" + }, + "node_modules/prismjs": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", + "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/property-information": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.0.0.tgz", + "integrity": "sha512-7D/qOz/+Y4X/rzSB6jKxKUsQnphO046ei8qxG59mtM3RG3DHgTK81HrxrmoDVINJb8NKT5ZsRbwHvQ6B68Iyhg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pure-rand": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", + "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ] + }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/random-seed": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/random-seed/-/random-seed-0.3.0.tgz", + "integrity": "sha512-y13xtn3kcTlLub3HKWXxJNeC2qK4mB59evwZ5EkeRlolx+Bp2ztF7LbcZmyCnOqlHQrLnfuNbi1sVmm9lPDlDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-stringify-safe": "^5.0.1" + }, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/react": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", + "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", + "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "scheduler": "^0.26.0" + }, + "peerDependencies": { + "react": "^19.1.0" + } + }, + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg/node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/recma-build-jsx": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-build-jsx/-/recma-build-jsx-1.0.0.tgz", + "integrity": "sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-util-build-jsx": "^3.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/recma-jsx": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-jsx/-/recma-jsx-1.0.0.tgz", + "integrity": "sha512-5vwkv65qWwYxg+Atz95acp8DMu1JDSqdGkA2Of1j6rCreyFUE/gp15fC8MnGEuG1W68UKjM6x6+YTWIh7hZM/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn-jsx": "^5.0.0", + "estree-util-to-js": "^2.0.0", + "recma-parse": "^1.0.0", + "recma-stringify": "^1.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/recma-parse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-parse/-/recma-parse-1.0.0.tgz", + "integrity": "sha512-OYLsIGBB5Y5wjnSnQW6t3Xg7q3fQ7FWbw/vcXtORTnyaSFscOtABg+7Pnz6YZ6c27fG1/aN8CjfwoUEUIdwqWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "esast-util-from-js": "^2.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/recma-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-stringify/-/recma-stringify-1.0.0.tgz", + "integrity": "sha512-cjwII1MdIIVloKvC9ErQ+OgAtwHBmcZ0Bg4ciz78FtbT8In39aAYbaA7zvxQ61xVMSPE8WxhLwLbhif4Js2C+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-util-to-js": "^2.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "node_modules/regenerate-unicode-properties": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", + "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", + "dev": true + }, + "node_modules/regjsparser": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.9.tgz", + "integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==", + "dev": true, + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/rehype-recma": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rehype-recma/-/rehype-recma-1.0.0.tgz", + "integrity": "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "hast-util-to-estree": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-mdx": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.0.tgz", + "integrity": "sha512-Ngl/H3YXyBV9RcRNdlYsZujAmhsxwzxpDzpDEhFBVAGthS4GDgnctpDjgFl/ULx5UEDzqtW1cyBSNKqYYrqLBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdast-util-mdx": "^3.0.0", + "micromark-extension-mdxjs": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, + "node_modules/resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-cwd/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-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, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/rollup": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz", + "integrity": "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.6" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.34.8", + "@rollup/rollup-android-arm64": "4.34.8", + "@rollup/rollup-darwin-arm64": "4.34.8", + "@rollup/rollup-darwin-x64": "4.34.8", + "@rollup/rollup-freebsd-arm64": "4.34.8", + "@rollup/rollup-freebsd-x64": "4.34.8", + "@rollup/rollup-linux-arm-gnueabihf": "4.34.8", + "@rollup/rollup-linux-arm-musleabihf": "4.34.8", + "@rollup/rollup-linux-arm64-gnu": "4.34.8", + "@rollup/rollup-linux-arm64-musl": "4.34.8", + "@rollup/rollup-linux-loongarch64-gnu": "4.34.8", + "@rollup/rollup-linux-powerpc64le-gnu": "4.34.8", + "@rollup/rollup-linux-riscv64-gnu": "4.34.8", + "@rollup/rollup-linux-s390x-gnu": "4.34.8", + "@rollup/rollup-linux-x64-gnu": "4.34.8", + "@rollup/rollup-linux-x64-musl": "4.34.8", + "@rollup/rollup-win32-arm64-msvc": "4.34.8", + "@rollup/rollup-win32-ia32-msvc": "4.34.8", + "@rollup/rollup-win32-x64-msvc": "4.34.8", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-applescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", + "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-array-concat/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-push-apply/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/scheduler": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz", + "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/sharp": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.1.tgz", + "integrity": "sha512-1j0w61+eVxu7DawFJtnfYcvSv6qPFvfTaqzTQ2BLknVhHTwGS8sc63ZBF4rzkWMBVKybo4S5OBtDdZahh2A1xg==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.7.1" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.34.1", + "@img/sharp-darwin-x64": "0.34.1", + "@img/sharp-libvips-darwin-arm64": "1.1.0", + "@img/sharp-libvips-darwin-x64": "1.1.0", + "@img/sharp-libvips-linux-arm": "1.1.0", + "@img/sharp-libvips-linux-arm64": "1.1.0", + "@img/sharp-libvips-linux-ppc64": "1.1.0", + "@img/sharp-libvips-linux-s390x": "1.1.0", + "@img/sharp-libvips-linux-x64": "1.1.0", + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0", + "@img/sharp-libvips-linuxmusl-x64": "1.1.0", + "@img/sharp-linux-arm": "0.34.1", + "@img/sharp-linux-arm64": "0.34.1", + "@img/sharp-linux-s390x": "0.34.1", + "@img/sharp-linux-x64": "0.34.1", + "@img/sharp-linuxmusl-arm64": "0.34.1", + "@img/sharp-linuxmusl-x64": "0.34.1", + "@img/sharp-wasm32": "0.34.1", + "@img/sharp-win32-ia32": "0.34.1", + "@img/sharp-win32-x64": "0.34.1" + } + }, + "node_modules/sharp/node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "optional": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/shell-quote": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.2.tgz", + "integrity": "sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/simple-swizzle/node_modules/is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "node_modules/size-limit": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-11.2.0.tgz", + "integrity": "sha512-2kpQq2DD/pRpx3Tal/qRW1SYwcIeQ0iq8li5CJHQgOC+FtPn2BVmuDtzUCgNnpCrbgtfEHqh+iWzxK+Tq6C+RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^4.0.3", + "jiti": "^2.4.2", + "lilconfig": "^3.1.3", + "nanospinner": "^1.2.2", + "picocolors": "^1.1.1", + "tinyglobby": "^0.2.11" + }, + "bin": { + "size-limit": "bin.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/smob": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/smob/-/smob-1.4.0.tgz", + "integrity": "sha512-MqR3fVulhjWuRNSMydnTlweu38UhQ0HXM4buStD/S3mc/BzX3CuM9OmhyQpmtYCvoYdl5ris6TI0ZqH355Ymqg==", + "dev": true + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/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==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.9.tgz", + "integrity": "sha512-Ki212dKK4ogX+xDo4CtOZBVIwhsKBEfsEEcwmJfLQzirgc2jIWdzg40Unxz/HzEUqM1WFzVlQSMF9kZZ2HboLQ==", + "dev": true + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "node_modules/stable-hash": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz", + "integrity": "sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string.prototype.matchall": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", + "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.3", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.padend": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.2.tgz", + "integrity": "sha512-/AQFLdYvePENU3W5rgurfWSMU6n+Ww8n/3cUt7E+vPBB/D7YDG8x+qjoFs4M/alR2bW7Qg6xMjVwWUOvuQ0XpQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.repeat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", + "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dev": true, + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/style-mod": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz", + "integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==", + "dev": true, + "license": "MIT" + }, + "node_modules/style-to-js": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.16.tgz", + "integrity": "sha512-/Q6ld50hKYPH3d/r6nr117TZkHR0w0kGGIVfpG9N6D8NymRPM9RqCUv4pRpJ62E5DqOYx2AFpbZMyCPnjQCnOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "style-to-object": "1.0.8" + } + }, + "node_modules/style-to-object": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.8.tgz", + "integrity": "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.4" + } + }, + "node_modules/styled-jsx": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", + "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/subsume": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/subsume/-/subsume-3.0.0.tgz", + "integrity": "sha512-6n/UfV8UWKwJNO8OAOiKntwEMihuBeeoJfzpL542C+OuvT4iWG9SwjrXkOmsxjb4SteHUsos9SvrdqZ9+ICwTQ==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^2.0.0", + "unique-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/subsume/node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true + }, + "node_modules/terser": { + "version": "5.19.2", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz", + "integrity": "sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==", + "dev": true, + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser/node_modules/acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", + "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", + "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/transducers-js": { + "version": "0.4.174", + "resolved": "https://registry.npmjs.org/transducers-js/-/transducers-js-0.4.174.tgz", + "integrity": "sha1-1YYsEO/0vj0zIqv2u3QuMPG7b8Q=", + "dev": true, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ts-api-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.1.tgz", + "integrity": "sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tsconfig-paths/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/tstyche": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/tstyche/-/tstyche-3.5.0.tgz", + "integrity": "sha512-N4SUp/ZWaMGEcglpVFIzKez0GQEiBdfFDgcnqwv9O1mePZgos8N1cZCzNgGtPGo/w0ym04MjJcDnsw1sorEzgA==", + "dev": true, + "license": "MIT", + "bin": { + "tstyche": "build/bin.js" + }, + "engines": { + "node": ">=18.19" + }, + "funding": { + "url": "https://github.com/tstyche/tstyche?sponsor=1" + }, + "peerDependencies": { + "typescript": "4.x || 5.x" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.24.0.tgz", + "integrity": "sha512-/lmv4366en/qbB32Vz5+kCNZEMf6xYHwh1z48suBwZvAtnXKbP+YhGe8OLE2BqC67LMqKkCNLtjejdwsdW6uOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.24.0", + "@typescript-eslint/parser": "8.24.0", + "@typescript-eslint/utils": "8.24.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "dev": true, + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", + "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", + "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position-from-estree": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-2.0.0.tgz", + "integrity": "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unrs-resolver": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/unrs-resolver/-/unrs-resolver-1.7.2.tgz", + "integrity": "sha512-BBKpaylOW8KbHsu378Zky/dGh4ckT/4NW/0SHRABdqRLcQJ2dAOjDo9g97p04sWflm0kqPqpUatxReNV/dqI5A==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "napi-postinstall": "^0.2.2" + }, + "funding": { + "url": "https://github.com/sponsors/JounQin" + }, + "optionalDependencies": { + "@unrs/resolver-binding-darwin-arm64": "1.7.2", + "@unrs/resolver-binding-darwin-x64": "1.7.2", + "@unrs/resolver-binding-freebsd-x64": "1.7.2", + "@unrs/resolver-binding-linux-arm-gnueabihf": "1.7.2", + "@unrs/resolver-binding-linux-arm-musleabihf": "1.7.2", + "@unrs/resolver-binding-linux-arm64-gnu": "1.7.2", + "@unrs/resolver-binding-linux-arm64-musl": "1.7.2", + "@unrs/resolver-binding-linux-ppc64-gnu": "1.7.2", + "@unrs/resolver-binding-linux-riscv64-gnu": "1.7.2", + "@unrs/resolver-binding-linux-riscv64-musl": "1.7.2", + "@unrs/resolver-binding-linux-s390x-gnu": "1.7.2", + "@unrs/resolver-binding-linux-x64-gnu": "1.7.2", + "@unrs/resolver-binding-linux-x64-musl": "1.7.2", + "@unrs/resolver-binding-wasm32-wasi": "1.7.2", + "@unrs/resolver-binding-win32-arm64-msvc": "1.7.2", + "@unrs/resolver-binding-win32-ia32-msvc": "1.7.2", + "@unrs/resolver-binding-win32-x64-msvc": "1.7.2" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", + "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dev": true, + "dependencies": { + "xml-name-validator": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "dependencies": { + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "dependencies": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.18.tgz", + "integrity": "sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true, + "engines": { + "node": ">=12" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + }, + "dependencies": { + "@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + } + }, + "@babel/compat-data": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", + "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", + "dev": true + }, + "@babel/core": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.8.tgz", + "integrity": "sha512-l+lkXCHS6tQEc5oUpK28xBOZ6+HwaH7YwoYQbLFiYb4nS2/l1tKnZEtEWkD0GuiYdvArf9qBS0XlQGXzPMsNqQ==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.8", + "@babel/helper-compilation-targets": "^7.26.5", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.7", + "@babel/parser": "^7.26.8", + "@babel/template": "^7.26.8", + "@babel/traverse": "^7.26.8", + "@babel/types": "^7.26.8", + "@types/gensync": "^1.0.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "dependencies": { + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + } + } + }, + "@babel/generator": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.8.tgz", + "integrity": "sha512-ef383X5++iZHWAXX0SXQR6ZyQhw/0KtTkrTz61WXRhFM6dhpHulO/RJz79L8S6ugZHJkOOkUrUdxgdF2YiPFnA==", + "dev": true, + "requires": { + "@babel/parser": "^7.26.8", + "@babel/types": "^7.26.8", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.26.5", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.26.5.tgz", + "integrity": "sha512-IXuyn5EkouFJscIDuFF5EsiSolseme1s0CZB+QxVugqJLYmKdxI1VfIBOst0SUu4rnk2Z7kqTwmoO1lp3HIfnA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.26.5", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } + } + }, + "@babel/helper-module-imports": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", + "dev": true, + "requires": { + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" + } + }, + "@babel/helper-module-transforms": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "dev": true + }, + "@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", + "dev": true + }, + "@babel/helpers": { + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", + "dev": true, + "requires": { + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.10" + } + }, + "@babel/parser": { + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", + "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", + "dev": true, + "requires": { + "@babel/types": "^7.26.10" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "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==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz", + "integrity": "sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "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==", + "dev": true, + "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==", + "dev": true, + "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==", + "dev": true, + "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==", + "dev": true, + "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==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.22.5.tgz", + "integrity": "sha512-1mS2o03i7t1c6VzH6fdQ3OA8tcEIxwG18zIPRp+UY1Ihv6W+XZzBCVxExF9upussPXJ0xE9XRHwMoNs1ep/nRQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + } + }, + "@babel/template": { + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", + "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9" + } + }, + "@babel/traverse": { + "version": "7.26.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.8.tgz", + "integrity": "sha512-nic9tRkjYH0oB2dzr/JoGIm+4Q6SuYeLEiIiZDwBscRMYFJ+tMAz98fuel9ZnbXViA2I0HVSSRRK8DW5fjXStA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.8", + "@babel/parser": "^7.26.8", + "@babel/template": "^7.26.8", + "@babel/types": "^7.26.8", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "dependencies": { + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "@codemirror/autocomplete": { + "version": "6.18.6", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.6.tgz", + "integrity": "sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg==", + "dev": true, + "requires": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0" + } + }, + "@codemirror/commands": { + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.8.1.tgz", + "integrity": "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==", + "dev": true, + "requires": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.4.0", + "@codemirror/view": "^6.27.0", + "@lezer/common": "^1.1.0" + } + }, + "@codemirror/lang-javascript": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.3.tgz", + "integrity": "sha512-8PR3vIWg7pSu7ur8A07pGiYHgy3hHj+mRYRCSG8q+mPIrl0F02rgpGv+DsQTHRTc30rydOsf5PZ7yjKFg2Ackw==", + "dev": true, + "requires": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.6.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0", + "@lezer/javascript": "^1.0.0" + } + }, + "@codemirror/language": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.11.0.tgz", + "integrity": "sha512-A7+f++LodNNc1wGgoRDTt78cOwWm9KVezApgjOMp1W4hM0898nsqBXwF+sbePE7ZRcjN7Sa1Z5m2oN27XkmEjQ==", + "dev": true, + "requires": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.23.0", + "@lezer/common": "^1.1.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0", + "style-mod": "^4.0.0" + } + }, + "@codemirror/lint": { + "version": "6.8.5", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.8.5.tgz", + "integrity": "sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA==", + "dev": true, + "requires": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.35.0", + "crelt": "^1.0.5" + } + }, + "@codemirror/search": { + "version": "6.5.10", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.10.tgz", + "integrity": "sha512-RMdPdmsrUf53pb2VwflKGHEe1XVM07hI7vV2ntgw1dmqhimpatSJKva4VA9h4TLUDOD4EIF02201oZurpnEFsg==", + "dev": true, + "requires": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "crelt": "^1.0.5" + } + }, + "@codemirror/state": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.2.tgz", + "integrity": "sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==", + "dev": true, + "requires": { + "@marijn/find-cluster-break": "^1.0.0" + } + }, + "@codemirror/theme-one-dark": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@codemirror/theme-one-dark/-/theme-one-dark-6.1.2.tgz", + "integrity": "sha512-F+sH0X16j/qFLMAfbciKTxVOwkdAS336b7AXTKOZhy8BR3eH/RelsnLgLFINrpST63mmN2OuwUt0W2ndUgYwUA==", + "dev": true, + "requires": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/highlight": "^1.0.0" + } + }, + "@codemirror/view": { + "version": "6.36.5", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.36.5.tgz", + "integrity": "sha512-cd+FZEUlu3GQCYnguYm3EkhJ8KJVisqqUsCOKedBoAt/d9c76JUUap6U0UrpElln5k6VyrEOYliMuDAKIeDQLg==", + "dev": true, + "requires": { + "@codemirror/state": "^6.5.0", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, + "@corex/deepmerge": { + "version": "4.0.43", + "resolved": "https://registry.npmjs.org/@corex/deepmerge/-/deepmerge-4.0.43.tgz", + "integrity": "sha512-N8uEMrMPL0cu/bdboEWpQYb/0i2K5Qn8eCsxzOmxSggJbbQte7ljMRoXm917AbntqTGOzdTu+vP3KOOzoC70HQ==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "dependencies": { + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + } + } + }, + "@emnapi/core": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.4.3.tgz", + "integrity": "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g==", + "dev": true, + "optional": true, + "requires": { + "@emnapi/wasi-threads": "1.0.2", + "tslib": "^2.4.0" + } + }, + "@emnapi/runtime": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.4.3.tgz", + "integrity": "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ==", + "dev": true, + "optional": true, + "requires": { + "tslib": "^2.4.0" + } + }, + "@emnapi/wasi-threads": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.0.2.tgz", + "integrity": "sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA==", + "dev": true, + "optional": true, + "requires": { + "tslib": "^2.4.0" + } + }, + "@esbuild/aix-ppc64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.1.tgz", + "integrity": "sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.1.tgz", + "integrity": "sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.1.tgz", + "integrity": "sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==", + "dev": true, + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.1.tgz", + "integrity": "sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.1.tgz", + "integrity": "sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.1.tgz", + "integrity": "sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.1.tgz", + "integrity": "sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.1.tgz", + "integrity": "sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.1.tgz", + "integrity": "sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.1.tgz", + "integrity": "sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.1.tgz", + "integrity": "sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.1.tgz", + "integrity": "sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.1.tgz", + "integrity": "sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.1.tgz", + "integrity": "sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.1.tgz", + "integrity": "sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.1.tgz", + "integrity": "sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.1.tgz", + "integrity": "sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.1.tgz", + "integrity": "sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.1.tgz", + "integrity": "sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.1.tgz", + "integrity": "sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.1.tgz", + "integrity": "sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==", + "dev": true, + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.1.tgz", + "integrity": "sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==", + "dev": true, + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.1.tgz", + "integrity": "sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==", + "dev": true, + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.1.tgz", + "integrity": "sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==", + "dev": true, + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.1.tgz", + "integrity": "sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==", + "dev": true, + "optional": true + }, + "@eslint-community/eslint-utils": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz", + "integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.4.3" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true + } + } + }, + "@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true + }, + "@eslint/config-array": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.2.tgz", + "integrity": "sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==", + "dev": true, + "requires": { + "@eslint/object-schema": "^2.1.6", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + } + }, + "@eslint/core": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.11.0.tgz", + "integrity": "sha512-DWUB2pksgNEb6Bz2fggIy1wh6fGgZP4Xyy/Mt0QZPiloKKXerbqq9D3SBQTlCRYOrcRPu4vuz+CGjwdfqxnoWA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.15" + } + }, + "@eslint/eslintrc": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "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 + }, + "globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true + }, + "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" + } + } + } + }, + "@eslint/js": { + "version": "9.20.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.20.0.tgz", + "integrity": "sha512-iZA07H9io9Wn836aVTytRaNqh00Sad+EamwOVJT12GTLw1VGMFV/4JaME+JjLtr9fiGaoWgYnS54wrfWsSs4oQ==", + "dev": true + }, + "@eslint/object-schema": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", + "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "dev": true + }, + "@eslint/plugin-kit": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz", + "integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==", + "dev": true, + "requires": { + "@eslint/core": "^0.10.0", + "levn": "^0.4.1" + }, + "dependencies": { + "@eslint/core": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz", + "integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.15" + } + } + } + }, + "@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true + }, + "@humanfs/node": { + "version": "0.16.6", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", + "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "dev": true, + "requires": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.3.0" + }, + "dependencies": { + "@humanwhocodes/retry": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", + "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "dev": true + } + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true + }, + "@humanwhocodes/retry": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", + "dev": true + }, + "@img/sharp-darwin-arm64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.1.tgz", + "integrity": "sha512-pn44xgBtgpEbZsu+lWf2KNb6OAf70X68k+yk69Ic2Xz11zHR/w24/U49XT7AeRwJ0Px+mhALhU5LPci1Aymk7A==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-libvips-darwin-arm64": "1.1.0" + } + }, + "@img/sharp-darwin-x64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.1.tgz", + "integrity": "sha512-VfuYgG2r8BpYiOUN+BfYeFo69nP/MIwAtSJ7/Zpxc5QF3KS22z8Pvg3FkrSFJBPNQ7mmcUcYQFBmEQp7eu1F8Q==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-libvips-darwin-x64": "1.1.0" + } + }, + "@img/sharp-libvips-darwin-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.1.0.tgz", + "integrity": "sha512-HZ/JUmPwrJSoM4DIQPv/BfNh9yrOA8tlBbqbLz4JZ5uew2+o22Ik+tHQJcih7QJuSa0zo5coHTfD5J8inqj9DA==", + "dev": true, + "optional": true + }, + "@img/sharp-libvips-darwin-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.1.0.tgz", + "integrity": "sha512-Xzc2ToEmHN+hfvsl9wja0RlnXEgpKNmftriQp6XzY/RaSfwD9th+MSh0WQKzUreLKKINb3afirxW7A0fz2YWuQ==", + "dev": true, + "optional": true + }, + "@img/sharp-libvips-linux-arm": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.1.0.tgz", + "integrity": "sha512-s8BAd0lwUIvYCJyRdFqvsj+BJIpDBSxs6ivrOPm/R7piTs5UIwY5OjXrP2bqXC9/moGsyRa37eYWYCOGVXxVrA==", + "dev": true, + "optional": true + }, + "@img/sharp-libvips-linux-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.1.0.tgz", + "integrity": "sha512-IVfGJa7gjChDET1dK9SekxFFdflarnUB8PwW8aGwEoF3oAsSDuNUTYS+SKDOyOJxQyDC1aPFMuRYLoDInyV9Ew==", + "dev": true, + "optional": true + }, + "@img/sharp-libvips-linux-ppc64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.1.0.tgz", + "integrity": "sha512-tiXxFZFbhnkWE2LA8oQj7KYR+bWBkiV2nilRldT7bqoEZ4HiDOcePr9wVDAZPi/Id5fT1oY9iGnDq20cwUz8lQ==", + "dev": true, + "optional": true + }, + "@img/sharp-libvips-linux-s390x": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.1.0.tgz", + "integrity": "sha512-xukSwvhguw7COyzvmjydRb3x/09+21HykyapcZchiCUkTThEQEOMtBj9UhkaBRLuBrgLFzQ2wbxdeCCJW/jgJA==", + "dev": true, + "optional": true + }, + "@img/sharp-libvips-linux-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.1.0.tgz", + "integrity": "sha512-yRj2+reB8iMg9W5sULM3S74jVS7zqSzHG3Ol/twnAAkAhnGQnpjj6e4ayUz7V+FpKypwgs82xbRdYtchTTUB+Q==", + "dev": true, + "optional": true + }, + "@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.1.0.tgz", + "integrity": "sha512-jYZdG+whg0MDK+q2COKbYidaqW/WTz0cc1E+tMAusiDygrM4ypmSCjOJPmFTvHHJ8j/6cAGyeDWZOsK06tP33w==", + "dev": true, + "optional": true + }, + "@img/sharp-libvips-linuxmusl-x64": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.1.0.tgz", + "integrity": "sha512-wK7SBdwrAiycjXdkPnGCPLjYb9lD4l6Ze2gSdAGVZrEL05AOUJESWU2lhlC+Ffn5/G+VKuSm6zzbQSzFX/P65A==", + "dev": true, + "optional": true + }, + "@img/sharp-linux-arm": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.1.tgz", + "integrity": "sha512-anKiszvACti2sGy9CirTlNyk7BjjZPiML1jt2ZkTdcvpLU1YH6CXwRAZCA2UmRXnhiIftXQ7+Oh62Ji25W72jA==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-libvips-linux-arm": "1.1.0" + } + }, + "@img/sharp-linux-arm64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.1.tgz", + "integrity": "sha512-kX2c+vbvaXC6vly1RDf/IWNXxrlxLNpBVWkdpRq5Ka7OOKj6nr66etKy2IENf6FtOgklkg9ZdGpEu9kwdlcwOQ==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-libvips-linux-arm64": "1.1.0" + } + }, + "@img/sharp-linux-s390x": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.1.tgz", + "integrity": "sha512-7s0KX2tI9mZI2buRipKIw2X1ufdTeaRgwmRabt5bi9chYfhur+/C1OXg3TKg/eag1W+6CCWLVmSauV1owmRPxA==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-libvips-linux-s390x": "1.1.0" + } + }, + "@img/sharp-linux-x64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.1.tgz", + "integrity": "sha512-wExv7SH9nmoBW3Wr2gvQopX1k8q2g5V5Iag8Zk6AVENsjwd+3adjwxtp3Dcu2QhOXr8W9NusBU6XcQUohBZ5MA==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-libvips-linux-x64": "1.1.0" + } + }, + "@img/sharp-linuxmusl-arm64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.1.tgz", + "integrity": "sha512-DfvyxzHxw4WGdPiTF0SOHnm11Xv4aQexvqhRDAoD00MzHekAj9a/jADXeXYCDFH/DzYruwHbXU7uz+H+nWmSOQ==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0" + } + }, + "@img/sharp-linuxmusl-x64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.1.tgz", + "integrity": "sha512-pax/kTR407vNb9qaSIiWVnQplPcGU8LRIJpDT5o8PdAx5aAA7AS3X9PS8Isw1/WfqgQorPotjrZL3Pqh6C5EBg==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-libvips-linuxmusl-x64": "1.1.0" + } + }, + "@img/sharp-wasm32": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.1.tgz", + "integrity": "sha512-YDybQnYrLQfEpzGOQe7OKcyLUCML4YOXl428gOOzBgN6Gw0rv8dpsJ7PqTHxBnXnwXr8S1mYFSLSa727tpz0xg==", + "dev": true, + "optional": true, + "requires": { + "@emnapi/runtime": "^1.4.0" + } + }, + "@img/sharp-win32-ia32": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.1.tgz", + "integrity": "sha512-WKf/NAZITnonBf3U1LfdjoMgNO5JYRSlhovhRhMxXVdvWYveM4kM3L8m35onYIdh75cOMCo1BexgVQcCDzyoWw==", + "dev": true, + "optional": true + }, + "@img/sharp-win32-x64": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.1.tgz", + "integrity": "sha512-hw1iIAHpNE8q3uMIRCgGOeDoz9KtFNarFLQclLxr/LK1VBkj8nby18RjFvr6aP7USRYAjTZW6yisnBWMX571Tw==", + "dev": true, + "optional": true + }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@jdeniau/immutable-devtools": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@jdeniau/immutable-devtools/-/immutable-devtools-0.2.0.tgz", + "integrity": "sha512-kncZLhyszWkGz0wAr8eoHFvhczuZz5Ud71OiLIhe5PFQ05nnLgsFdr520Qy+eHhMSL6roJYFrZ73ZJTv48/fUg==", + "dev": true + }, + "@jest/console": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.6.4.tgz", + "integrity": "sha512-wNK6gC0Ha9QeEPSkeJedQuTQqxZYnDPuDcDhVuVatRvMkL4D0VTvFVZj+Yuh6caG2aOfzkUZ36KtCmLNtR02hw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", + "slash": "^3.0.0" + } + }, + "@jest/core": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.6.4.tgz", + "integrity": "sha512-U/vq5ccNTSVgYH7mHnodHmCffGWHJnz/E1BEWlLuK5pM4FZmGfBn/nrJGLjUsSmyx3otCeqc1T31F4y08AMDLg==", + "dev": true, + "requires": { + "@jest/console": "^29.6.4", + "@jest/reporters": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.6.3", + "jest-config": "^29.6.4", + "jest-haste-map": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-resolve-dependencies": "^29.6.4", + "jest-runner": "^29.6.4", + "jest-runtime": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "jest-watcher": "^29.6.4", + "micromatch": "^4.0.4", + "pretty-format": "^29.6.3", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "requires": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + } + }, + "@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "requires": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + } + }, + "@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3" + } + }, + "@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + } + }, + "@jest/reporters": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.6.4.tgz", + "integrity": "sha512-sxUjWxm7QdchdrD3NfWKrL8FBsortZeibSJv4XLjESOOjSUOkjQcb0ZHJwfhEGIvBvTluTzfG2yZWZhkrXJu8g==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.6.3", + "jest-util": "^29.6.3", + "jest-worker": "^29.6.4", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "dependencies": { + "istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "requires": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + } + }, + "semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true + } + } + }, + "@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "requires": { + "@sinclair/typebox": "^0.27.8" + } + }, + "@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + } + }, + "@jest/test-result": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.6.4.tgz", + "integrity": "sha512-uQ1C0AUEN90/dsyEirgMLlouROgSY+Wc/JanVVk0OiUKa5UFh7sJpMEM3aoUBAz2BRNvUJ8j3d294WFuRxSyOQ==", + "dev": true, + "requires": { + "@jest/console": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + } + }, + "@jest/test-sequencer": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.6.4.tgz", + "integrity": "sha512-E84M6LbpcRq3fT4ckfKs9ryVanwkaIB0Ws9bw3/yP4seRLg/VaCZ/LgW0MCq5wwk4/iP/qnilD41aj2fsw2RMg==", + "dev": true, + "requires": { + "@jest/test-result": "^29.6.4", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.4", + "slash": "^3.0.0" + } + }, + "@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "dependencies": { + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + } + } + }, + "@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + } + }, + "@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true + }, + "@jridgewell/source-map": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", + "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "@lezer/common": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", + "integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==", + "dev": true + }, + "@lezer/highlight": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.1.tgz", + "integrity": "sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==", + "dev": true, + "requires": { + "@lezer/common": "^1.0.0" + } + }, + "@lezer/javascript": { + "version": "1.4.21", + "resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.4.21.tgz", + "integrity": "sha512-lL+1fcuxWYPURMM/oFZLEDm0XuLN128QPV+VuGtKpeaOGdcl9F2LYC3nh1S9LkPqx9M0mndZFdXCipNAZpzIkQ==", + "dev": true, + "requires": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.1.3", + "@lezer/lr": "^1.3.0" + } + }, + "@lezer/lr": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.2.tgz", + "integrity": "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==", + "dev": true, + "requires": { + "@lezer/common": "^1.0.0" + } + }, + "@marijn/find-cluster-break": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", + "dev": true + }, + "@mdx-js/loader": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mdx-js/loader/-/loader-3.1.0.tgz", + "integrity": "sha512-xU/lwKdOyfXtQGqn3VnJjlDrmKXEvMi1mgYxVmukEUtVycIz1nh7oQ40bKTd4cA7rLStqu0740pnhGYxGoqsCg==", + "dev": true, + "requires": { + "@mdx-js/mdx": "^3.0.0", + "source-map": "^0.7.0" + }, + "dependencies": { + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + } + } + }, + "@mdx-js/mdx": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mdx-js/mdx/-/mdx-3.1.0.tgz", + "integrity": "sha512-/QxEhPAvGwbQmy1Px8F899L5Uc2KZ6JtXwlCgJmjSTBedwOZkByYcBG4GceIGPXRDsmfxhHazuS+hlOShRLeDw==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdx": "^2.0.0", + "collapse-white-space": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-util-scope": "^1.0.0", + "estree-walker": "^3.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "markdown-extensions": "^2.0.0", + "recma-build-jsx": "^1.0.0", + "recma-jsx": "^1.0.0", + "recma-stringify": "^1.0.0", + "rehype-recma": "^1.0.0", + "remark-mdx": "^3.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "source-map": "^0.7.0", + "unified": "^11.0.0", + "unist-util-position-from-estree": "^2.0.0", + "unist-util-stringify-position": "^4.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "dependencies": { + "estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0" + } + }, + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + } + } + }, + "@mdx-js/react": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@mdx-js/react/-/react-3.1.0.tgz", + "integrity": "sha512-QjHtSaoameoalGnKDT3FoIl4+9RwyTmo9ZJGBdLOks/YOiWHoRDI3PUwEzOE7kEmGcV3AFcp9K6dYu9rEuKLAQ==", + "dev": true, + "requires": { + "@types/mdx": "^2.0.0" + } + }, + "@napi-rs/wasm-runtime": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.9.tgz", + "integrity": "sha512-OKRBiajrrxB9ATokgEQoG87Z25c67pCpYcCwmXYX8PBftC9pBfN18gnm/fh1wurSLEKIAt+QRFLFCQISrb66Jg==", + "dev": true, + "optional": true, + "requires": { + "@emnapi/core": "^1.4.0", + "@emnapi/runtime": "^1.4.0", + "@tybys/wasm-util": "^0.9.0" + } + }, + "@next/env": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.3.2.tgz", + "integrity": "sha512-xURk++7P7qR9JG1jJtLzPzf0qEvqCN0A/T3DXf8IPMKo9/6FfjxtEffRJIIew/bIL4T3C2jLLqBor8B/zVlx6g==", + "dev": true + }, + "@next/mdx": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/mdx/-/mdx-15.3.2.tgz", + "integrity": "sha512-D6lSSbVzn1EiPwrBKG5QzXClcgdqiNCL8a3/6oROinzgZnYSxbVmnfs0UrqygtGSOmgW7sdJJSEOy555DoAwvw==", + "dev": true, + "requires": { + "source-map": "^0.7.0" + }, + "dependencies": { + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + } + } + }, + "@next/swc-darwin-arm64": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.3.2.tgz", + "integrity": "sha512-2DR6kY/OGcokbnCsjHpNeQblqCZ85/1j6njYSkzRdpLn5At7OkSdmk7WyAmB9G0k25+VgqVZ/u356OSoQZ3z0g==", + "dev": true, + "optional": true + }, + "@next/swc-darwin-x64": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.3.2.tgz", + "integrity": "sha512-ro/fdqaZWL6k1S/5CLv1I0DaZfDVJkWNaUU3un8Lg6m0YENWlDulmIWzV96Iou2wEYyEsZq51mwV8+XQXqMp3w==", + "dev": true, + "optional": true + }, + "@next/swc-linux-arm64-gnu": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.3.2.tgz", + "integrity": "sha512-covwwtZYhlbRWK2HlYX9835qXum4xYZ3E2Mra1mdQ+0ICGoMiw1+nVAn4d9Bo7R3JqSmK1grMq/va+0cdh7bJA==", + "dev": true, + "optional": true + }, + "@next/swc-linux-arm64-musl": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.3.2.tgz", + "integrity": "sha512-KQkMEillvlW5Qk5mtGA/3Yz0/tzpNlSw6/3/ttsV1lNtMuOHcGii3zVeXZyi4EJmmLDKYcTcByV2wVsOhDt/zg==", + "dev": true, + "optional": true + }, + "@next/swc-linux-x64-gnu": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.3.2.tgz", + "integrity": "sha512-uRBo6THWei0chz+Y5j37qzx+BtoDRFIkDzZjlpCItBRXyMPIg079eIkOCl3aqr2tkxL4HFyJ4GHDes7W8HuAUg==", + "dev": true, + "optional": true + }, + "@next/swc-linux-x64-musl": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.3.2.tgz", + "integrity": "sha512-+uxFlPuCNx/T9PdMClOqeE8USKzj8tVz37KflT3Kdbx/LOlZBRI2yxuIcmx1mPNK8DwSOMNCr4ureSet7eyC0w==", + "dev": true, + "optional": true + }, + "@next/swc-win32-arm64-msvc": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.3.2.tgz", + "integrity": "sha512-LLTKmaI5cfD8dVzh5Vt7+OMo+AIOClEdIU/TSKbXXT2iScUTSxOGoBhfuv+FU8R9MLmrkIL1e2fBMkEEjYAtPQ==", + "dev": true, + "optional": true + }, + "@next/swc-win32-x64-msvc": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.3.2.tgz", + "integrity": "sha512-aW5B8wOPioJ4mBdMDXkt5f3j8pUr9W8AnlX0Df35uRWNT1Y6RIybxjnSUe+PhM+M1bwgyY8PHLmXZC6zT1o5tA==", + "dev": true, + "optional": true + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@rollup/plugin-buble": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-buble/-/plugin-buble-1.0.3.tgz", + "integrity": "sha512-QYD9BKkJoof0FdCFeSYYhF6/Y8e0Mnf+098xGgmWOFJ4UPHlWujjqOYeVwEm2hJPOmlR5k7HPUdAjqtOWhN64Q==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^5.0.1", + "@types/buble": "^0.19.2", + "buble": "^0.20.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "buble": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/buble/-/buble-0.20.0.tgz", + "integrity": "sha512-/1gnaMQE8xvd5qsNBl+iTuyjJ9XxeaVxAMF86dQ4EyxFJOZtsgOS8Ra+7WHgZTam5IFDtt4BguN0sH0tVTKrOw==", + "dev": true, + "requires": { + "acorn": "^6.4.1", + "acorn-dynamic-import": "^4.0.0", + "acorn-jsx": "^5.2.0", + "chalk": "^2.4.2", + "magic-string": "^0.25.7", + "minimist": "^1.2.5", + "regexpu-core": "4.5.4" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "regexpu-core": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz", + "integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==", + "dev": true, + "requires": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.0.2", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@rollup/plugin-commonjs": { + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.2.tgz", + "integrity": "sha512-BEFI2EDqzl+vA1rl97IDRZ61AIwGH093d9nz8+dThxJNH8oSoB7MjWvPCX3dkaK1/RCJ/1v/R1XB15FuSs0fQw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "fdir": "^6.2.0", + "is-reference": "1.2.1", + "magic-string": "^0.30.3", + "picomatch": "^4.0.2" + }, + "dependencies": { + "fdir": { + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", + "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", + "dev": true, + "requires": {} + }, + "magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "requires": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, + "picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true + } + } + }, + "@rollup/plugin-json": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz", + "integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^5.1.0" + } + }, + "@rollup/plugin-terser": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@rollup/plugin-terser/-/plugin-terser-0.4.4.tgz", + "integrity": "sha512-XHeJC5Bgvs8LfukDwWZp7yeqin6ns8RTl2B9avbejt6tZqsqvVoWI7ZTQrcNsfKEDWBTnTxM8nMDkO2IFFbd0A==", + "dev": true, + "requires": { + "serialize-javascript": "^6.0.1", + "smob": "^1.0.0", + "terser": "^5.17.4" + } + }, + "@rollup/plugin-typescript": { + "version": "12.1.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.2.tgz", + "integrity": "sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^5.1.0", + "resolve": "^1.22.1" + } + }, + "@rollup/pluginutils": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", + "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "dependencies": { + "picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true + } + } + }, + "@rollup/rollup-android-arm-eabi": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz", + "integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==", + "dev": true, + "optional": true + }, + "@rollup/rollup-android-arm64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz", + "integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==", + "dev": true, + "optional": true + }, + "@rollup/rollup-darwin-arm64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz", + "integrity": "sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q==", + "dev": true, + "optional": true + }, + "@rollup/rollup-darwin-x64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz", + "integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==", + "dev": true, + "optional": true + }, + "@rollup/rollup-freebsd-arm64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz", + "integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==", + "dev": true, + "optional": true + }, + "@rollup/rollup-freebsd-x64": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz", + "integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz", + "integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-arm-musleabihf": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz", + "integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-arm64-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz", + "integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-arm64-musl": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz", + "integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz", + "integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz", + "integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-riscv64-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz", + "integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-s390x-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz", + "integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-x64-gnu": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz", + "integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==", + "dev": true, + "optional": true + }, + "@rollup/rollup-linux-x64-musl": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz", + "integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==", + "dev": true, + "optional": true + }, + "@rollup/rollup-win32-arm64-msvc": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz", + "integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==", + "dev": true, + "optional": true + }, + "@rollup/rollup-win32-ia32-msvc": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz", + "integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==", + "dev": true, + "optional": true + }, + "@rollup/rollup-win32-x64-msvc": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz", + "integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==", + "dev": true, + "optional": true + }, + "@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true + }, + "@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, + "@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.0" + } + }, + "@size-limit/esbuild-why": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@size-limit/esbuild-why/-/esbuild-why-11.2.0.tgz", + "integrity": "sha512-VtoQbbkvFbF314LWEaEp1+IjG0DH+9w6nP//D6Gd48SEAPLoBgqk287mjYTF9WYxg9N5lo8KjpXxEFk4gOXNpw==", + "dev": true, + "requires": { + "esbuild-visualizer": "^0.7.0", + "open": "^10.1.0" + } + }, + "@size-limit/preset-small-lib": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@size-limit/preset-small-lib/-/preset-small-lib-11.2.0.tgz", + "integrity": "sha512-RFbbIVfv8/QDgTPyXzjo5NKO6CYyK5Uq5xtNLHLbw5RgSKrgo8WpiB/fNivZuNd/5Wk0s91PtaJ9ThNcnFuI3g==", + "dev": true, + "requires": { + "@size-limit/esbuild": "11.2.0", + "@size-limit/file": "11.2.0", + "size-limit": "11.2.0" + }, + "dependencies": { + "@size-limit/esbuild": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@size-limit/esbuild/-/esbuild-11.2.0.tgz", + "integrity": "sha512-vSg9H0WxGQPRzDnBzeDyD9XT0Zdq0L+AI3+77/JhxznbSCMJMMr8ndaWVQRhOsixl97N0oD4pRFw2+R1Lcvi6A==", + "dev": true, + "requires": { + "esbuild": "^0.25.0", + "nanoid": "^5.1.0" + } + }, + "@size-limit/file": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/@size-limit/file/-/file-11.2.0.tgz", + "integrity": "sha512-OZHE3putEkQ/fgzz3Tp/0hSmfVo3wyTpOJSRNm6AmcwX4Nm9YtTfbQQ/hZRwbBFR23S7x2Sd9EbqYzngKwbRoA==", + "dev": true, + "requires": {} + }, + "nanoid": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.1.4.tgz", + "integrity": "sha512-GTFcMIDgR7tqji/LpSY8rtg464VnJl/j6ypoehYnuGb+Y8qZUdtKB8WVCXon0UEZgFDbuUxpIl//6FHLHgXSNA==", + "dev": true + } + } + }, + "@swc/counter": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", + "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", + "dev": true + }, + "@swc/helpers": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", + "dev": true, + "requires": { + "tslib": "^2.8.0" + } + }, + "@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "dev": true + }, + "@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, + "@tybys/wasm-util": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.9.0.tgz", + "integrity": "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw==", + "dev": true, + "optional": true, + "requires": { + "tslib": "^2.4.0" + } + }, + "@types/babel__core": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.1.tgz", + "integrity": "sha512-aACu/U/omhdk15O4Nfb+fHgH/z3QsfQzpnvRZhYhThms83ZnAOZz7zZAWO7mn2yyNQaA4xTO8GLK3uqFU4bYYw==", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.4", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.4.tgz", + "integrity": "sha512-tFkciB9j2K755yrTALxD44McOrk+gfpIpvC3sxHjRawj6PfnQxrse4Clq5y/Rq+G3mrBurMax/lG8Qn2t9mSsg==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.1.tgz", + "integrity": "sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.1.tgz", + "integrity": "sha512-MitHFXnhtgwsGZWtT68URpOvLN4EREih1u3QtQiN4VdAxWKRVvGCSvw/Qth0M0Qq3pJpnGOu5JaM/ydK7OGbqg==", + "dev": true, + "requires": { + "@babel/types": "^7.20.7" + } + }, + "@types/buble": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@types/buble/-/buble-0.19.2.tgz", + "integrity": "sha512-uUD8zIfXMKThmFkahTXDGI3CthFH1kMg2dOm3KLi4GlC5cbARA64bEcUMbbWdWdE73eoc/iBB9PiTMqH0dNS2Q==", + "dev": true, + "requires": { + "magic-string": "^0.25.0" + } + }, + "@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "dev": true, + "requires": { + "@types/ms": "*" + } + }, + "@types/estree": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", + "dev": true + }, + "@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, + "@types/gensync": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/gensync/-/gensync-1.0.4.tgz", + "integrity": "sha512-C3YYeRQWp2fmq9OryX+FoDy8nXS6scQ7dPptD8LnFDAUNcKWJjXQKDNJD3HVm+kOUsXhTOkpi69vI4EuAr95bA==", + "dev": true + }, + "@types/graceful-fs": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", + "integrity": "sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "requires": { + "@types/unist": "*" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz", + "integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/jsdom": { + "version": "20.0.1", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz", + "integrity": "sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==", + "dev": true, + "requires": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^7.0.0" + } + }, + "@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true + }, + "@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "dev": true, + "requires": { + "@types/unist": "*" + } + }, + "@types/mdx": { + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.13.tgz", + "integrity": "sha512-+OWZQfAYyio6YkJb3HLxDrvnx6SWWDbC0zVPfBRzUk0/nqoDyf6dNxQi3eArPe8rJ473nobTMQ/8Zk+LxJ+Yuw==", + "dev": true + }, + "@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true + }, + "@types/node": { + "version": "22.15.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.17.tgz", + "integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==", + "dev": true, + "requires": { + "undici-types": "~6.21.0" + } + }, + "@types/prismjs": { + "version": "1.26.3", + "resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.3.tgz", + "integrity": "sha512-A0D0aTXvjlqJ5ZILMz3rNfDBOx9hHxLZYv2by47Sm/pqW35zzjusrZTryatjN/Rf8Us2gZrJD+KeHbUSTux1Cw==", + "dev": true + }, + "@types/random-seed": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@types/random-seed/-/random-seed-0.3.5.tgz", + "integrity": "sha512-CftxcDPAHgs0SLHU2dt+ZlDPJfGqLW3sZlC/ATr5vJDSe5tRLeOne7HMvCOJnFyF8e1U41wqzs3h6AMC613xtA==", + "dev": true + }, + "@types/react": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.0.tgz", + "integrity": "sha512-UaicktuQI+9UKyA4njtDOGBD/67t8YEBt2xdfqu8+gP9hqPUPsiXlNPcpS2gVdjmis5GKPG3fCxbQLVgxsQZ8w==", + "dev": true, + "requires": { + "csstype": "^3.0.2" + } + }, + "@types/stack-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz", + "integrity": "sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==", + "dev": true + }, + "@types/tough-cookie": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.2.tgz", + "integrity": "sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==", + "dev": true + }, + "@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "dev": true + }, + "@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.0", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz", + "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.24.0.tgz", + "integrity": "sha512-aFcXEJJCI4gUdXgoo/j9udUYIHgF23MFkg09LFz2dzEmU0+1Plk4rQWv/IYKvPHAtlkkGoB3m5e6oUp+JPsNaQ==", + "dev": true, + "requires": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.24.0", + "@typescript-eslint/type-utils": "8.24.0", + "@typescript-eslint/utils": "8.24.0", + "@typescript-eslint/visitor-keys": "8.24.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.0.1" + } + }, + "@typescript-eslint/parser": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.24.0.tgz", + "integrity": "sha512-MFDaO9CYiard9j9VepMNa9MTcqVvSny2N4hkY6roquzj8pdCBRENhErrteaQuu7Yjn1ppk0v1/ZF9CG3KIlrTA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "8.24.0", + "@typescript-eslint/types": "8.24.0", + "@typescript-eslint/typescript-estree": "8.24.0", + "@typescript-eslint/visitor-keys": "8.24.0", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.24.0.tgz", + "integrity": "sha512-HZIX0UByphEtdVBKaQBgTDdn9z16l4aTUz8e8zPQnyxwHBtf5vtl1L+OhH+m1FGV9DrRmoDuYKqzVrvWDcDozw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.24.0", + "@typescript-eslint/visitor-keys": "8.24.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.24.0.tgz", + "integrity": "sha512-8fitJudrnY8aq0F1wMiPM1UUgiXQRJ5i8tFjq9kGfRajU+dbPyOuHbl0qRopLEidy0MwqgTHDt6CnSeXanNIwA==", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "8.24.0", + "@typescript-eslint/utils": "8.24.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.0.1" + } + }, + "@typescript-eslint/types": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.24.0.tgz", + "integrity": "sha512-VacJCBTyje7HGAw7xp11q439A+zeGG0p0/p2zsZwpnMzjPB5WteaWqt4g2iysgGFafrqvyLWqq6ZPZAOCoefCw==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.24.0.tgz", + "integrity": "sha512-ITjYcP0+8kbsvT9bysygfIfb+hBj6koDsu37JZG7xrCiy3fPJyNmfVtaGsgTUSEuTzcvME5YI5uyL5LD1EV5ZQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.24.0", + "@typescript-eslint/visitor-keys": "8.24.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.0.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true + } + } + }, + "@typescript-eslint/utils": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.24.0.tgz", + "integrity": "sha512-07rLuUBElvvEb1ICnafYWr4hk8/U7X9RDCOqd9JcAMtjh/9oRmcfN4yGzbPVirgMR0+HLVHehmu19CWeh7fsmQ==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.24.0", + "@typescript-eslint/types": "8.24.0", + "@typescript-eslint/typescript-estree": "8.24.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.24.0.tgz", + "integrity": "sha512-kArLq83QxGLbuHrTMoOEWO+l2MwsNS2TGISEdx8xgqpkbytB07XmlQyQdNDrCc1ecSqx0cnmhGvpX+VBwqqSkg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "8.24.0", + "eslint-visitor-keys": "^4.2.0" + } + }, + "@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true + }, + "@unrs/resolver-binding-darwin-arm64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.7.2.tgz", + "integrity": "sha512-vxtBno4xvowwNmO/ASL0Y45TpHqmNkAaDtz4Jqb+clmcVSSl8XCG/PNFFkGsXXXS6AMjP+ja/TtNCFFa1QwLRg==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-darwin-x64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.7.2.tgz", + "integrity": "sha512-qhVa8ozu92C23Hsmv0BF4+5Dyyd5STT1FolV4whNgbY6mj3kA0qsrGPe35zNR3wAN7eFict3s4Rc2dDTPBTuFQ==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-freebsd-x64": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.7.2.tgz", + "integrity": "sha512-zKKdm2uMXqLFX6Ac7K5ElnnG5VIXbDlFWzg4WJ8CGUedJryM5A3cTgHuGMw1+P5ziV8CRhnSEgOnurTI4vpHpg==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-arm-gnueabihf": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.7.2.tgz", + "integrity": "sha512-8N1z1TbPnHH+iDS/42GJ0bMPLiGK+cUqOhNbMKtWJ4oFGzqSJk/zoXFzcQkgtI63qMcUI7wW1tq2usZQSb2jxw==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-arm-musleabihf": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.7.2.tgz", + "integrity": "sha512-tjYzI9LcAXR9MYd9rO45m1s0B/6bJNuZ6jeOxo1pq1K6OBuRMMmfyvJYval3s9FPPGmrldYA3mi4gWDlWuTFGA==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-arm64-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.7.2.tgz", + "integrity": "sha512-jon9M7DKRLGZ9VYSkFMflvNqu9hDtOCEnO2QAryFWgT6o6AXU8du56V7YqnaLKr6rAbZBWYsYpikF226v423QA==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-arm64-musl": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.7.2.tgz", + "integrity": "sha512-c8Cg4/h+kQ63pL43wBNaVMmOjXI/X62wQmru51qjfTvI7kmCy5uHTJvK/9LrF0G8Jdx8r34d019P1DVJmhXQpA==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-ppc64-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.7.2.tgz", + "integrity": "sha512-A+lcwRFyrjeJmv3JJvhz5NbcCkLQL6Mk16kHTNm6/aGNc4FwPHPE4DR9DwuCvCnVHvF5IAd9U4VIs/VvVir5lg==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-riscv64-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.7.2.tgz", + "integrity": "sha512-hQQ4TJQrSQW8JlPm7tRpXN8OCNP9ez7PajJNjRD1ZTHQAy685OYqPrKjfaMw/8LiHCt8AZ74rfUVHP9vn0N69Q==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-riscv64-musl": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.7.2.tgz", + "integrity": "sha512-NoAGbiqrxtY8kVooZ24i70CjLDlUFI7nDj3I9y54U94p+3kPxwd2L692YsdLa+cqQ0VoqMWoehDFp21PKRUoIQ==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-s390x-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.7.2.tgz", + "integrity": "sha512-KaZByo8xuQZbUhhreBTW+yUnOIHUsv04P8lKjQ5otiGoSJ17ISGYArc+4vKdLEpGaLbemGzr4ZeUbYQQsLWFjA==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-x64-gnu": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.7.2.tgz", + "integrity": "sha512-dEidzJDubxxhUCBJ/SHSMJD/9q7JkyfBMT77Px1npl4xpg9t0POLvnWywSk66BgZS/b2Hy9Y1yFaoMTFJUe9yg==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-linux-x64-musl": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.7.2.tgz", + "integrity": "sha512-RvP+Ux3wDjmnZDT4XWFfNBRVG0fMsc+yVzNFUqOflnDfZ9OYujv6nkh+GOr+watwrW4wdp6ASfG/e7bkDradsw==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-wasm32-wasi": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.7.2.tgz", + "integrity": "sha512-y797JBmO9IsvXVRCKDXOxjyAE4+CcZpla2GSoBQ33TVb3ILXuFnMrbR/QQZoauBYeOFuu4w3ifWLw52sdHGz6g==", + "dev": true, + "optional": true, + "requires": { + "@napi-rs/wasm-runtime": "^0.2.9" + } + }, + "@unrs/resolver-binding-win32-arm64-msvc": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.7.2.tgz", + "integrity": "sha512-gtYTh4/VREVSLA+gHrfbWxaMO/00y+34htY7XpioBTy56YN2eBjkPrY1ML1Zys89X3RJDKVaogzwxlM1qU7egg==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-win32-ia32-msvc": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.7.2.tgz", + "integrity": "sha512-Ywv20XHvHTDRQs12jd3MY8X5C8KLjDbg/jyaal/QLKx3fAShhJyD4blEANInsjxW3P7isHx1Blt56iUDDJO3jg==", + "dev": true, + "optional": true + }, + "@unrs/resolver-binding-win32-x64-msvc": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.7.2.tgz", + "integrity": "sha512-friS8NEQfHaDbkThxopGk+LuE5v3iY0StruifjQEt7SLbA46OnfgMO15sOTkbpJkol6RB+1l1TYPXh0sCddpvA==", + "dev": true, + "optional": true + }, + "abab": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz", + "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==", + "dev": true + }, + "acorn": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", + "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", + "dev": true + }, + "acorn-dynamic-import": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-4.0.0.tgz", + "integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==", + "dev": true, + "requires": {} + }, + "acorn-globals": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-7.0.1.tgz", + "integrity": "sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q==", + "dev": true, + "requires": { + "acorn": "^8.1.0", + "acorn-walk": "^8.0.2" + }, + "dependencies": { + "acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true + } + } + }, + "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, + "requires": {} + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "requires": { + "debug": "4" + } + }, + "aggregate-error": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", + "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", + "dev": true, + "requires": { + "clean-stack": "^4.0.0", + "indent-string": "^5.0.0" + } + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + }, + "dependencies": { + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + } + } + }, + "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": "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" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + } + }, + "array-includes": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", + "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "is-string": "^1.0.7" + } + }, + "array.prototype.findlast": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", + "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + } + }, + "array.prototype.findlastindex": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", + "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + } + }, + "array.prototype.flat": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + } + }, + "array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + } + }, + "array.prototype.tosorted": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", + "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3", + "es-errors": "^1.3.0", + "es-shim-unscopables": "^1.0.2" + } + }, + "arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + } + }, + "arrify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-3.0.0.tgz", + "integrity": "sha512-tLkvA81vQG/XqE2mjDkGQHoOINtMHtysSnemrmoGe6PydDPMRbVugqyk4A6V/WDWEfm3l+0d8anA9r8cv/5Jaw==", + "dev": true + }, + "astring": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz", + "integrity": "sha512-LElXdjswlqjWrPpJFg1Fx4wpkOCxj1TDHlSV4PlaRxHGWko024xICaa97ZkMfs6DRKlCguiAI+rbXv5GWwXIkg==", + "dev": true + }, + "async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "requires": { + "possible-typed-array-names": "^1.0.0" + } + }, + "babel-jest": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.6.4.tgz", + "integrity": "sha512-meLj23UlSLddj6PC+YTOFRgDAtjnZom8w/ACsrx0gtPtv5cJZk0A5Unk5bV4wixD7XaPCN1fQvpww8czkZURmw==", + "dev": true, + "requires": { + "@jest/transform": "^29.6.4", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + } + }, + "babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + } + }, + "babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "requires": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "requires": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + } + }, + "babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + } + }, + "bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "dev": true + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "benchmark": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz", + "integrity": "sha1-CfPeMckWQl1JjMLuVloOvzwqVik=", + "dev": true, + "requires": { + "lodash": "^4.17.4", + "platform": "^1.3.3" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "requires": { + "fill-range": "^7.1.1" + } + }, + "browserslist": { + "version": "4.24.4", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz", + "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001688", + "electron-to-chromium": "^1.5.73", + "node-releases": "^2.0.19", + "update-browserslist-db": "^1.1.1" + } + }, + "bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "requires": { + "node-int64": "^0.4.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==", + "dev": true + }, + "bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", + "dev": true, + "requires": { + "run-applescript": "^7.0.0" + } + }, + "busboy": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", + "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", + "dev": true, + "requires": { + "streamsearch": "^1.1.0" + } + }, + "bytes-iec": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes-iec/-/bytes-iec-3.1.1.tgz", + "integrity": "sha512-fey6+4jDK7TFtFg/klGSvNKJctyU7n2aQdnM+CO0ruLPbqqMOM8Tio0Pc+deqUeVKX1tL5DQep1zQ7+37aTAsA==", + "dev": true + }, + "call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + } + }, + "call-bind-apply-helpers": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", + "integrity": "sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + } + }, + "call-bound": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", + "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.1", + "get-intrinsic": "^1.2.6" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001699", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001699.tgz", + "integrity": "sha512-b+uH5BakXZ9Do9iK+CkDmctUSEqZl+SP056vc5usa0PL+ev5OHw003rZXcnjNDv3L8P5j6rwT6C0BPKSikW08w==", + "dev": true + }, + "ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "dev": true + }, + "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" + } + }, + "char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true + }, + "character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "dev": true + }, + "character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "dev": true + }, + "character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "dev": true + }, + "character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "dev": true + }, + "chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "requires": { + "readdirp": "^4.0.1" + } + }, + "ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true + }, + "cjs-module-lexer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "dev": true + }, + "clean-stack": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-4.2.0.tgz", + "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", + "dev": true, + "requires": { + "escape-string-regexp": "5.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", + "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", + "dev": true + } + } + }, + "client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true + }, + "codemirror": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.1.tgz", + "integrity": "sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==", + "dev": true, + "requires": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/commands": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/search": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0" + } + }, + "collapse-white-space": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-2.1.0.tgz", + "integrity": "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw==", + "dev": true + }, + "collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true + }, + "color": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz", + "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1", + "color-string": "^1.9.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 + }, + "color-string": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", + "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", + "dev": true, + "optional": true, + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "dev": true + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "cp-file": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/cp-file/-/cp-file-10.0.0.tgz", + "integrity": "sha512-vy2Vi1r2epK5WqxOLnskeKeZkdZvTKfFZQCplE3XWsP+SUJyd5XAUFC9lFgTjjXJF2GMne/UML14iEmkAaDfFg==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.10", + "nested-error-stacks": "^2.1.1", + "p-event": "^5.0.1" + } + }, + "cpy": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/cpy/-/cpy-10.1.0.tgz", + "integrity": "sha512-VC2Gs20JcTyeQob6UViBLnyP0bYHkBh6EiKzot9vi2DmeGlFT9Wd7VG3NBrkNx/jYvFBeyDOMMHdHQhbtKLgHQ==", + "dev": true, + "requires": { + "arrify": "^3.0.0", + "cp-file": "^10.0.0", + "globby": "^13.1.4", + "junk": "^4.0.1", + "micromatch": "^4.0.5", + "nested-error-stacks": "^2.1.1", + "p-filter": "^3.0.0", + "p-map": "^6.0.0" + }, + "dependencies": { + "globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "requires": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + } + }, + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true + } + } + }, + "cpy-cli": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cpy-cli/-/cpy-cli-5.0.0.tgz", + "integrity": "sha512-fb+DZYbL9KHc0BC4NYqGRrDIJZPXUmjjtqdw4XRRg8iV8dIfghUX/WiL+q4/B/KFTy3sK6jsbUhBaz0/Hxg7IQ==", + "dev": true, + "requires": { + "cpy": "^10.1.0", + "meow": "^12.0.1" + } + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "crelt": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true + }, + "cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==", + "dev": true + }, + "cssstyle": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.3.0.tgz", + "integrity": "sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A==", + "dev": true, + "requires": { + "cssom": "~0.3.6" + }, + "dependencies": { + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==", + "dev": true + } + } + }, + "csstype": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.8.tgz", + "integrity": "sha512-jXKhWqXPmlUeoQnF/EhTtTl4C9SnrxSH/jZUih3jmO6lBKr99rP3/+FmrMj4EFpOXzMtXHAZkd3x0E6h6Fgflw==", + "dev": true + }, + "data-urls": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-3.0.2.tgz", + "integrity": "sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==", + "dev": true, + "requires": { + "abab": "^2.0.6", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0" + } + }, + "data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + } + }, + "data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + } + }, + "data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + } + }, + "debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "requires": { + "ms": "^2.1.3" + } + }, + "decimal.js": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "dev": true + }, + "decode-named-character-reference": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.1.0.tgz", + "integrity": "sha512-Wy+JTSbFThEOXQIR2L6mxJvEs+veIzpmqD7ynWxMXGpnk3smkHQOp6forLdHsKpAMW9iJpaBBIxz285t1n1C3w==", + "dev": true, + "requires": { + "character-entities": "^2.0.0" + } + }, + "dedent": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true, + "requires": {} + }, + "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 + }, + "deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true + }, + "default-browser": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", + "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", + "dev": true, + "requires": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + } + }, + "default-browser-id": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", + "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", + "dev": true + }, + "define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "requires": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + } + }, + "define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true + }, + "define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "requires": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true + }, + "detect-libc": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", + "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "dev": true, + "optional": true + }, + "detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true + }, + "devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "dev": true, + "requires": { + "dequal": "^2.0.0" + } + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "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" + } + }, + "domexception": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz", + "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==", + "dev": true, + "requires": { + "webidl-conversions": "^7.0.0" + } + }, + "dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + } + }, + "electron-to-chromium": { + "version": "1.5.97", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.97.tgz", + "integrity": "sha512-HKLtaH02augM7ZOdYRuO19rWDeY+QSJ1VxnXFa/XDFLf07HvM90pALIJFgrO+UVaajI3+aJMMpojoUTLZyQ7JQ==", + "dev": true + }, + "emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true + }, + "entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.23.9", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.9.tgz", + "integrity": "sha512-py07lI0wjxAC/DcfK1S6G7iANonniZwTISvdPzk9hzeH0IZIshbuuFxLIU96OyF89Yb9hiqWn8M/bY83KY5vzA==", + "dev": true, + "requires": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.0", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-regex": "^1.2.1", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.0", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.3", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.3", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.18" + } + }, + "es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true + }, + "es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true + }, + "es-iterator-helpers": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.1.tgz", + "integrity": "sha512-uDn+FE1yrDzyC0pCo961B2IHbdM8y/ACZsKD4dG6WqrjV53BADjwa7D+1aom2rsNVfLyDgU/eigvlJGJ08OQ4w==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.0.3", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.6", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.4", + "safe-array-concat": "^1.1.3" + } + }, + "es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0" + } + }, + "es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + } + }, + "es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "requires": { + "hasown": "^2.0.2" + } + }, + "es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "requires": { + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" + } + }, + "esast-util-from-estree": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/esast-util-from-estree/-/esast-util-from-estree-2.0.0.tgz", + "integrity": "sha512-4CyanoAudUSBAn5K13H4JhsMH6L9ZP7XbLVe/dKybkxMO7eDyLsT8UHl9TRNrU2Gr9nz+FovfSIjuXWJ81uVwQ==", + "dev": true, + "requires": { + "@types/estree-jsx": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-visit": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0" + } + }, + "esast-util-from-js": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/esast-util-from-js/-/esast-util-from-js-2.0.1.tgz", + "integrity": "sha512-8Ja+rNJ0Lt56Pcf3TAmpBZjmx8ZcK5Ts4cAzIOjsjevg9oSXJnl6SUQ2EevU8tv3h6ZLWmoKL5H4fgWvdvfETw==", + "dev": true, + "requires": { + "@types/estree-jsx": "^1.0.0", + "acorn": "^8.0.0", + "esast-util-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + }, + "dependencies": { + "acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true + } + } + }, + "esbuild": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", + "integrity": "sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==", + "dev": true, + "requires": { + "@esbuild/aix-ppc64": "0.25.1", + "@esbuild/android-arm": "0.25.1", + "@esbuild/android-arm64": "0.25.1", + "@esbuild/android-x64": "0.25.1", + "@esbuild/darwin-arm64": "0.25.1", + "@esbuild/darwin-x64": "0.25.1", + "@esbuild/freebsd-arm64": "0.25.1", + "@esbuild/freebsd-x64": "0.25.1", + "@esbuild/linux-arm": "0.25.1", + "@esbuild/linux-arm64": "0.25.1", + "@esbuild/linux-ia32": "0.25.1", + "@esbuild/linux-loong64": "0.25.1", + "@esbuild/linux-mips64el": "0.25.1", + "@esbuild/linux-ppc64": "0.25.1", + "@esbuild/linux-riscv64": "0.25.1", + "@esbuild/linux-s390x": "0.25.1", + "@esbuild/linux-x64": "0.25.1", + "@esbuild/netbsd-arm64": "0.25.1", + "@esbuild/netbsd-x64": "0.25.1", + "@esbuild/openbsd-arm64": "0.25.1", + "@esbuild/openbsd-x64": "0.25.1", + "@esbuild/sunos-x64": "0.25.1", + "@esbuild/win32-arm64": "0.25.1", + "@esbuild/win32-ia32": "0.25.1", + "@esbuild/win32-x64": "0.25.1" + } + }, + "esbuild-visualizer": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/esbuild-visualizer/-/esbuild-visualizer-0.7.0.tgz", + "integrity": "sha512-Vz22k+G2WT7GuCo7rbhaQwGbZ26lEhwzsctkEdQlu2SVrshoM4hzQeRpu/3DP596a9+9K2JyYsinuC6AC896Og==", + "dev": true, + "requires": { + "open": "^8.4.0", + "picomatch": "^4.0.0", + "yargs": "^17.6.2" + }, + "dependencies": { + "define-lazy-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", + "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", + "dev": true + }, + "is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true + }, + "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" + } + }, + "open": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", + "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==", + "dev": true, + "requires": { + "define-lazy-prop": "^2.0.0", + "is-docker": "^2.1.1", + "is-wsl": "^2.2.0" + } + }, + "picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true + } + } + }, + "escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true + }, + "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 + }, + "escodegen": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", + "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", + "dev": true, + "requires": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2", + "source-map": "~0.6.1" + } + }, + "eslint": { + "version": "9.20.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.20.1.tgz", + "integrity": "sha512-m1mM33o6dBUjxl2qb6wv6nGNwCAsns1eKtaQ4l/NPHeTvhiUPbtdfMyktxN4B3fgHIgsYh1VT3V9txblpQHq+g==", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.11.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.20.0", + "@eslint/plugin-kit": "^0.2.5", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.1", + "@types/estree": "^1.0.6", + "@types/json-schema": "^7.0.15", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.2.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "dependencies": { + "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": { + "is-glob": "^4.0.3" + } + } + } + }, + "eslint-import-resolver-node": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", + "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "is-core-module": "^2.13.0", + "resolve": "^1.22.4" + }, + "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" + } + } + } + }, + "eslint-import-resolver-typescript": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-4.3.4.tgz", + "integrity": "sha512-buzw5z5VtiQMysYLH9iW9BV04YyZebsw+gPi+c4FCjfS9i6COYOrEWw9t3m3wA9PFBfqcBCqWf32qrXLbwafDw==", + "dev": true, + "requires": { + "debug": "^4.4.0", + "get-tsconfig": "^4.10.0", + "is-bun-module": "^2.0.0", + "stable-hash": "^0.0.5", + "tinyglobby": "^0.2.13", + "unrs-resolver": "^1.6.3" + } + }, + "eslint-module-utils": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz", + "integrity": "sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==", + "dev": true, + "requires": { + "debug": "^3.2.7" + }, + "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" + } + } + } + }, + "eslint-plugin-import": { + "version": "2.31.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz", + "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", + "dev": true, + "requires": { + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.8", + "array.prototype.findlastindex": "^1.2.5", + "array.prototype.flat": "^1.3.2", + "array.prototype.flatmap": "^1.3.2", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.0", + "hasown": "^2.0.2", + "is-core-module": "^2.15.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.0", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.8", + "tsconfig-paths": "^3.15.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" + } + } + } + }, + "eslint-plugin-jest": { + "version": "28.11.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-28.11.0.tgz", + "integrity": "sha512-QAfipLcNCWLVocVbZW8GimKn5p5iiMcgGbRzz8z/P5q7xw+cNEpYqyzFMtIF/ZgF2HLOyy+dYBut+DoYolvqig==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "eslint-plugin-react": { + "version": "7.37.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.4.tgz", + "integrity": "sha512-BGP0jRmfYyvOyvMoRX/uoUeW+GqNj9y16bPQzqAHf3AYII/tDs+jMN0dBVkl88/OZwNGwrVFxE7riHsXVfy/LQ==", + "dev": true, + "requires": { + "array-includes": "^3.1.8", + "array.prototype.findlast": "^1.2.5", + "array.prototype.flatmap": "^1.3.3", + "array.prototype.tosorted": "^1.1.4", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.2.1", + "estraverse": "^5.3.0", + "hasown": "^2.0.2", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.8", + "object.fromentries": "^2.0.8", + "object.values": "^1.2.1", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.12", + "string.prototype.repeat": "^1.0.0" + }, + "dependencies": { + "resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "dev": true, + "requires": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + } + } + }, + "eslint-scope": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz", + "integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true + }, + "espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "requires": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "dependencies": { + "acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "estree-util-attach-comments": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-attach-comments/-/estree-util-attach-comments-3.0.0.tgz", + "integrity": "sha512-cKUwm/HUcTDsYh/9FgnuFqpfquUbwIqwKM26BVCGDPVgvaCl/nDCCjUfiLlx6lsEZ3Z4RFxNbOQ60pkaEwFxGw==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0" + } + }, + "estree-util-build-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/estree-util-build-jsx/-/estree-util-build-jsx-3.0.1.tgz", + "integrity": "sha512-8U5eiL6BTrPxp/CHbs2yMgP8ftMhR5ww1eIKoWRMlqvltHF8fZn5LRDvTKuxD3DUn+shRbLGqXemcP51oFCsGQ==", + "dev": true, + "requires": { + "@types/estree-jsx": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "estree-walker": "^3.0.0" + }, + "dependencies": { + "estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0" + } + } + } + }, + "estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "dev": true + }, + "estree-util-scope": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/estree-util-scope/-/estree-util-scope-1.0.0.tgz", + "integrity": "sha512-2CAASclonf+JFWBNJPndcOpA8EMJwa0Q8LUFJEKqXLW6+qBvbFZuF5gItbQOs/umBUkjviCSDCbBwU2cXbmrhQ==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0" + } + }, + "estree-util-to-js": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-to-js/-/estree-util-to-js-2.0.0.tgz", + "integrity": "sha512-WDF+xj5rRWmD5tj6bIqRi6CkLIXbbNQUcxQHzGysQzvHmdYG2G7p/Tf0J0gpxGgkeMZNTIjT/AoSvC9Xehcgdg==", + "dev": true, + "requires": { + "@types/estree-jsx": "^1.0.0", + "astring": "^1.8.0", + "source-map": "^0.7.0" + }, + "dependencies": { + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + } + } + }, + "estree-util-visit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/estree-util-visit/-/estree-util-visit-2.0.0.tgz", + "integrity": "sha512-m5KgiH85xAhhW8Wta0vShLcUvOsh3LLPI2YVwcbio1l7E09NTLL1EyMZFM1OyWowoH0skScNbhOPl4kcBgzTww==", + "dev": true, + "requires": { + "@types/estree-jsx": "^1.0.0", + "@types/unist": "^3.0.0" + } + }, + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "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" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true + }, + "expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "requires": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "fast-check": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-4.0.0.tgz", + "integrity": "sha512-aXLyLemZ7qhLNn2oq+YpjT2Xed21+i29WGAYuyrGbU4r8oinB3i4XR4e62O3NY6qmm5qHEDoc/7d+gMsri3AfA==", + "dev": true, + "requires": { + "pure-rand": "^7.0.0" + }, + "dependencies": { + "pure-rand": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-7.0.1.tgz", + "integrity": "sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ==", + "dev": true + } + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "requires": { + "bser": "2.1.1" + } + }, + "file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "requires": { + "flat-cache": "^4.0.0" + } + }, + "fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "requires": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + } + }, + "flatted": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", + "dev": true + }, + "flow-bin": { + "version": "0.160.0", + "resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.160.0.tgz", + "integrity": "sha512-hqb/1z7U9Jv+2hDdslAgdab6D4AUDrYIcF2zH/CKx9YgQtCeHfnzCcypzCNU7xmBm2+Mi9+1hqeB4OQX2adh0A==", + "dev": true + }, + "for-each": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, + "requires": { + "is-callable": "^1.1.3" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true + }, + "function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + } + }, + "functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "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-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-intrinsic": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", + "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==", + "dev": true, + "requires": { + "call-bind-apply-helpers": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "function-bind": "^1.1.2", + "get-proto": "^1.0.0", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + } + }, + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "requires": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + } + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true + }, + "get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + } + }, + "get-tsconfig": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.10.0.tgz", + "integrity": "sha512-kGzZ3LWWQcGIAmg6iWvXn0ei6WDtV26wzHRMwDSzmAbcXrTEXxHy6IehI6/4eT6VRKyMP1eF1VqwrVUmE/LR7A==", + "dev": true, + "requires": { + "resolve-pkg-maps": "^1.0.0" + } + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "dev": true + }, + "globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "requires": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + } + }, + "gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true + }, + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "has-bigints": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", + "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", + "dev": true + }, + "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 + }, + "has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "requires": { + "es-define-property": "^1.0.0" + } + }, + "has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "requires": { + "dunder-proto": "^1.0.0" + } + }, + "has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "requires": { + "has-symbols": "^1.0.3" + } + }, + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, + "hast-util-to-estree": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz", + "integrity": "sha512-48+B/rJWAp0jamNbAAf9M7Uf//UVqAoMmgXhBdxTDJLGKY+LRnZ99qcG+Qjl5HfMpYNzS5v4EAwVEF34LeAj7w==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-attach-comments": "^3.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "zwitch": "^2.0.0" + } + }, + "hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + } + }, + "hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "dev": true, + "requires": { + "@types/hast": "^3.0.0" + } + }, + "hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true + }, + "html-encoding-sniffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", + "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==", + "dev": true, + "requires": { + "whatwg-encoding": "^2.0.0" + } + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "requires": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + } + }, + "https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true + }, + "iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + }, + "ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true + }, + "import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + } + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", + "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "inline-style-parser": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.4.tgz", + "integrity": "sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==", + "dev": true + }, + "internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + } + }, + "is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "dev": true + }, + "is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "dev": true, + "requires": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + } + }, + "is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "requires": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + } + }, + "is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "requires": { + "has-bigints": "^1.0.2" + } + }, + "is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + } + }, + "is-bun-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz", + "integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==", + "dev": true, + "requires": { + "semver": "^7.7.1" + }, + "dependencies": { + "semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true + } + } + }, + "is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true + }, + "is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "requires": { + "hasown": "^2.0.2" + } + }, + "is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + } + }, + "is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + } + }, + "is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "dev": true + }, + "is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "dev": true + }, + "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-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true + }, + "is-generator-function": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.0.tgz", + "integrity": "sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "get-proto": "^1.0.0", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + } + }, + "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-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "dev": true + }, + "is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "dev": true, + "requires": { + "is-docker": "^3.0.0" + } + }, + "is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + } + }, + "is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "dev": true + }, + "is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true + }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "requires": { + "@types/estree": "*" + } + }, + "is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + } + }, + "is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true + }, + "is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } + }, + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true + }, + "is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + } + }, + "is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + } + }, + "is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "requires": { + "which-typed-array": "^1.1.16" + } + }, + "is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true + }, + "is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "requires": { + "call-bound": "^1.0.3" + } + }, + "is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + } + }, + "is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "dev": true, + "requires": { + "is-inside-container": "^1.0.0" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + }, + "istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "requires": { + "semver": "^7.5.3" + } + }, + "semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true + } + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + } + }, + "istanbul-reports": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "iterator.prototype": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", + "dev": true, + "requires": { + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" + } + }, + "jest": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.6.4.tgz", + "integrity": "sha512-tEFhVQFF/bzoYV1YuGyzLPZ6vlPrdfvDmmAxudA1dLEuiztqg2Rkx20vkKY32xiDROcD2KXlgZ7Cu8RPeEHRKw==", + "dev": true, + "requires": { + "@jest/core": "^29.6.4", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.6.4" + } + }, + "jest-changed-files": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.6.3.tgz", + "integrity": "sha512-G5wDnElqLa4/c66ma5PG9eRjE342lIbF6SUnTJi26C3J28Fv2TVY2rOyKB9YGbSA5ogwevgmxc4j4aVjrEK6Yg==", + "dev": true, + "requires": { + "execa": "^5.0.0", + "jest-util": "^29.6.3", + "p-limit": "^3.1.0" + } + }, + "jest-circus": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.6.4.tgz", + "integrity": "sha512-YXNrRyntVUgDfZbjXWBMPslX1mQ8MrSG0oM/Y06j9EYubODIyHWP8hMUbjbZ19M3M+zamqEur7O80HODwACoJw==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.4", + "@jest/expect": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.6.3", + "jest-matcher-utils": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-runtime": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", + "p-limit": "^3.1.0", + "pretty-format": "^29.6.3", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-cli": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.6.4.tgz", + "integrity": "sha512-+uMCQ7oizMmh8ZwRfZzKIEszFY9ksjjEQnTEMTaL7fYiL3Kw4XhqT9bYh+A4DQKUb67hZn2KbtEnDuHvcgK4pQ==", + "dev": true, + "requires": { + "@jest/core": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "import-local": "^3.0.2", + "jest-config": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "prompts": "^2.0.1", + "yargs": "^17.3.1" + } + }, + "jest-config": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.6.4.tgz", + "integrity": "sha512-JWohr3i9m2cVpBumQFv2akMEnFEPVOh+9L2xIBJhJ0zOaci2ZXuKJj0tgMKQCBZAKA09H049IR4HVS/43Qb19A==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.6.4", + "@jest/types": "^29.6.3", + "babel-jest": "^29.6.4", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.6.4", + "jest-environment-node": "^29.6.4", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-runner": "^29.6.4", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.6.3", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + } + } + }, + "jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-docblock": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.6.3.tgz", + "integrity": "sha512-2+H+GOTQBEm2+qFSQ7Ma+BvyV+waiIFxmZF5LdpBsAEjWX8QYjSCa4FrkIYtbfXUJJJnFCYrOtt6TZ+IAiTjBQ==", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.6.3.tgz", + "integrity": "sha512-KoXfJ42k8cqbkfshW7sSHcdfnv5agDdHCPA87ZBdmHP+zJstTJc0ttQaJ/x7zK6noAL76hOuTIJ6ZkQRS5dcyg==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.6.3", + "pretty-format": "^29.6.3" + } + }, + "jest-environment-jsdom": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-environment-jsdom/-/jest-environment-jsdom-29.6.4.tgz", + "integrity": "sha512-K6wfgUJ16DoMs02JYFid9lOsqfpoVtyJxpRlnTxUHzvZWBnnh2VNGRB9EC1Cro96TQdq5TtSjb3qUjNaJP9IyA==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/jsdom": "^20.0.0", + "@types/node": "*", + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3", + "jsdom": "^20.0.0" + } + }, + "jest-environment-node": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.6.4.tgz", + "integrity": "sha512-i7SbpH2dEIFGNmxGCpSc2w9cA4qVD+wfvg2ZnfQ7XVrKL0NA5uDVBIiGH8SR4F0dKEv/0qI5r+aDomDf04DpEQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.6.3", + "jest-util": "^29.6.3" + } + }, + "jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true + }, + "jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.3.2", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + } + }, + "jest-leak-detector": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.6.3.tgz", + "integrity": "sha512-0kfbESIHXYdhAdpLsW7xdwmYhLf1BRu4AA118/OxFm0Ho1b2RcTmO4oF6aAMaxpxdxnJ3zve2rgwzNBD4Zbm7Q==", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.6.3" + } + }, + "jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "requires": {} + }, + "jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true + }, + "jest-resolve": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.6.4.tgz", + "integrity": "sha512-fPRq+0vcxsuGlG0O3gyoqGTAxasagOxEuyoxHeyxaZbc9QNek0AmJWSkhjlMG+mTsj+8knc/mWb3fXlRNVih7Q==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.4", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.6.3", + "jest-validate": "^29.6.3", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.6.4.tgz", + "integrity": "sha512-7+6eAmr1ZBF3vOAJVsfLj1QdqeXG+WYhidfLHBRZqGN24MFRIiKG20ItpLw2qRAsW/D2ZUUmCNf6irUr/v6KHA==", + "dev": true, + "requires": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.6.4" + } + }, + "jest-runner": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.6.4.tgz", + "integrity": "sha512-SDaLrMmtVlQYDuG0iSPYLycG8P9jLI+fRm8AF/xPKhYDB2g6xDWjXBrR5M8gEWsK6KVFlebpZ4QsrxdyIX1Jaw==", + "dev": true, + "requires": { + "@jest/console": "^29.6.4", + "@jest/environment": "^29.6.4", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.6.3", + "jest-environment-node": "^29.6.4", + "jest-haste-map": "^29.6.4", + "jest-leak-detector": "^29.6.3", + "jest-message-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-runtime": "^29.6.4", + "jest-util": "^29.6.3", + "jest-watcher": "^29.6.4", + "jest-worker": "^29.6.4", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "dependencies": { + "source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + } + } + }, + "jest-runtime": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.6.4.tgz", + "integrity": "sha512-s/QxMBLvmwLdchKEjcLfwzP7h+jsHvNEtxGP5P+Fl1FMaJX2jMiIqe4rJw4tFprzCwuSvVUo9bn0uj4gNRXsbA==", + "dev": true, + "requires": { + "@jest/environment": "^29.6.4", + "@jest/fake-timers": "^29.6.4", + "@jest/globals": "^29.6.4", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.6.4", + "@jest/transform": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.6.4", + "jest-message-util": "^29.6.3", + "jest-mock": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.6.4", + "jest-snapshot": "^29.6.4", + "jest-util": "^29.6.3", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + } + }, + "jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "dependencies": { + "semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true + } + } + }, + "jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + } + }, + "jest-validate": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.6.3.tgz", + "integrity": "sha512-e7KWZcAIX+2W1o3cHfnqpGajdCs1jSM3DkXjGeLSNmCazv1EeI1ggTeK5wdZhF+7N+g44JI2Od3veojoaumlfg==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.6.3" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + } + } + }, + "jest-watcher": { + "version": "29.6.4", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.6.4.tgz", + "integrity": "sha512-oqUWvx6+On04ShsT00Ir9T4/FvBeEh2M9PTubgITPxDa739p4hoQweWPRGyYeaojgT0xTpZKF0Y/rSY1UgMxvQ==", + "dev": true, + "requires": { + "@jest/test-result": "^29.6.4", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.6.3", + "string-length": "^4.0.1" + } + }, + "jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "requires": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jiti": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.4.2.tgz", + "integrity": "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsdom": { + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-20.0.3.tgz", + "integrity": "sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ==", + "dev": true, + "requires": { + "abab": "^2.0.6", + "acorn": "^8.8.1", + "acorn-globals": "^7.0.0", + "cssom": "^0.5.0", + "cssstyle": "^2.3.0", + "data-urls": "^3.0.2", + "decimal.js": "^10.4.2", + "domexception": "^4.0.0", + "escodegen": "^2.0.0", + "form-data": "^4.0.0", + "html-encoding-sniffer": "^3.0.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.1", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.2", + "parse5": "^7.1.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.1.2", + "w3c-xmlserializer": "^4.0.0", + "webidl-conversions": "^7.0.0", + "whatwg-encoding": "^2.0.0", + "whatwg-mimetype": "^3.0.0", + "whatwg-url": "^11.0.0", + "ws": "^8.11.0", + "xml-name-validator": "^4.0.0" + }, + "dependencies": { + "acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "tough-cookie": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", + "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", + "dev": true, + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.2.0", + "url-parse": "^1.5.3" + } + }, + "universalify": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", + "dev": true + } + } + }, + "jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true + }, + "json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", + "dev": true + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "jsonml-html": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/jsonml-html/-/jsonml-html-1.2.0.tgz", + "integrity": "sha512-vg30gQFD5X+1nY3do43BW9Iiq4F5BZcysXc+ydPNu7O5AxaqxnaI9ikjTjlE9y9KaAvgTwTP6nOpifDqDoYmjg==", + "dev": true + }, + "jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "requires": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + } + }, + "junk": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/junk/-/junk-4.0.1.tgz", + "integrity": "sha512-Qush0uP+G8ZScpGMZvHUiRfI0YBWuB3gVBYlI0v0vvOJt5FLicco+IkP0a50LqTTQhmts/m6tP5SWE+USyIvcQ==", + "dev": true + }, + "keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "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" + } + }, + "lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true + }, + "lines-and-columns": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", + "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", + "dev": true + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + } + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "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 + }, + "longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "requires": { + "sourcemap-codec": "^1.4.8" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "make-synchronous": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/make-synchronous/-/make-synchronous-0.1.1.tgz", + "integrity": "sha512-Y4SxxqhaoyMDokJQ0AZz0E+bLhRkOSR7Z/IQoTKPdS6HYi3aobal2kMHoHHoqBadPWjf07P4K1FQLXOx3wf9Yw==", + "dev": true, + "requires": { + "subsume": "^3.0.0", + "type-fest": "^0.16.0" + }, + "dependencies": { + "type-fest": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.16.0.tgz", + "integrity": "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg==", + "dev": true + } + } + }, + "makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "requires": { + "tmpl": "1.0.5" + } + }, + "markdown-extensions": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz", + "integrity": "sha512-o5vL7aDWatOTX8LzaS1WMoaoxIiLRQJuIKKe2wAw6IeULDHaqbiqiggmx+pKvZDb1Sj+pE46Sn1T7lCqfFtg1Q==", + "dev": true + }, + "marked": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-11.2.0.tgz", + "integrity": "sha512-HR0m3bvu0jAPYiIvLUUQtdg1g6D247//lvcekpHO1WMvbwDlwSkZAX9Lw4F4YHE1T0HaaNve0tuAWuV1UJ6vtw==", + "dev": true + }, + "marked-highlight": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/marked-highlight/-/marked-highlight-2.1.0.tgz", + "integrity": "sha512-peBvgGZZqUw074Vy/N8Y7/6JQhSnR54/T0Ozq2/fAIBzcYfVfExFdQJptIhQxreR1elpwvJRrqhp6S/Prk8prA==", + "dev": true, + "requires": {} + }, + "math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true + }, + "mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "dev": true, + "requires": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + } + }, + "mdast-util-mdx": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx/-/mdast-util-mdx-3.0.0.tgz", + "integrity": "sha512-JfbYLAW7XnYTTbUsmpu0kdBUVe+yKVJZBItEjwyYJiDJuZ9w4eeaqks4HQO+R7objWgS2ymV60GYpI14Ug554w==", + "dev": true, + "requires": { + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + } + }, + "mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "dev": true, + "requires": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + } + }, + "mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", + "dev": true, + "requires": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + } + }, + "mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "dev": true, + "requires": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + } + }, + "mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "dev": true, + "requires": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + } + }, + "mdast-util-to-hast": { + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz", + "integrity": "sha512-QGYKEuUsYT9ykKBCMOEDLsU5JRObWQusAolFMeko/tYPufNkRffBAQjIE+99jbA87xv6FgmjLtwjh9wBWajwAA==", + "dev": true, + "requires": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + } + }, + "mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "dev": true, + "requires": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + } + }, + "mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "dev": true, + "requires": { + "@types/mdast": "^4.0.0" + } + }, + "memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha1-htcJCzDORV1j+64S3aUaR93K+bI=", + "dev": true + }, + "meow": { + "version": "12.1.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-12.1.1.tgz", + "integrity": "sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw==", + "dev": true + }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "dev": true, + "requires": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "dev": true, + "requires": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-extension-mdx-expression": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-expression/-/micromark-extension-mdx-expression-3.0.1.tgz", + "integrity": "sha512-dD/ADLJ1AeMvSAKBwO22zG22N4ybhe7kFIZ3LsDI0GlsNr2A3KYxb0LdC1u5rj4Nw+CHKY0RVdnHX8vj8ejm4Q==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-mdx-expression": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-extension-mdx-jsx": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-jsx/-/micromark-extension-mdx-jsx-3.0.2.tgz", + "integrity": "sha512-e5+q1DjMh62LZAJOnDraSSbDMvGJ8x3cbjygy2qFEi7HCeUT4BDKCvMozPozcD6WmOt6sVvYDNBKhFSz3kjOVQ==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "micromark-factory-mdx-expression": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "micromark-extension-mdx-md": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdx-md/-/micromark-extension-mdx-md-2.0.0.tgz", + "integrity": "sha512-EpAiszsB3blw4Rpba7xTOUptcFeBFi+6PY8VnJ2hhimH+vCQDirWgsMpz7w1XcZE7LVrSAUGb9VJpG9ghlYvYQ==", + "dev": true, + "requires": { + "micromark-util-types": "^2.0.0" + } + }, + "micromark-extension-mdxjs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs/-/micromark-extension-mdxjs-3.0.0.tgz", + "integrity": "sha512-A873fJfhnJ2siZyUrJ31l34Uqwy4xIFmvPY1oj+Ean5PHcPBYzEsvqvWGaWcfEIr11O5Dlw3p2y0tZWpKHDejQ==", + "dev": true, + "requires": { + "acorn": "^8.0.0", + "acorn-jsx": "^5.0.0", + "micromark-extension-mdx-expression": "^3.0.0", + "micromark-extension-mdx-jsx": "^3.0.0", + "micromark-extension-mdx-md": "^2.0.0", + "micromark-extension-mdxjs-esm": "^3.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-types": "^2.0.0" + }, + "dependencies": { + "acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true + } + } + }, + "micromark-extension-mdxjs-esm": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/micromark-extension-mdxjs-esm/-/micromark-extension-mdxjs-esm-3.0.0.tgz", + "integrity": "sha512-DJFl4ZqkErRpq/dAPyeWp15tGrcrrJho1hKK5uBS70BCtfrIFg81sqcTVu3Ta+KD1Tk5vAtBNElWxtAa+m8K9A==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "dev": true, + "requires": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "dev": true, + "requires": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-factory-mdx-expression": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-factory-mdx-expression/-/micromark-factory-mdx-expression-2.0.3.tgz", + "integrity": "sha512-kQnEtA3vzucU2BkrIa8/VaSAsP+EJ3CKOvhMuJgOEGg9KDC6OAY6nSnNDVRiVNRqj7Y4SlSzcStaH/5jge8JdQ==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-events-to-acorn": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-position-from-estree": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "dev": true, + "requires": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "dev": true, + "requires": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "dev": true, + "requires": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "dev": true, + "requires": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "dev": true, + "requires": { + "micromark-util-symbol": "^2.0.0" + } + }, + "micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "dev": true, + "requires": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "dev": true, + "requires": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "dev": true, + "requires": { + "micromark-util-symbol": "^2.0.0" + } + }, + "micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "dev": true, + "requires": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "dev": true + }, + "micromark-util-events-to-acorn": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-util-events-to-acorn/-/micromark-util-events-to-acorn-2.0.3.tgz", + "integrity": "sha512-jmsiEIiZ1n7X1Rr5k8wVExBQCg5jy4UXVADItHmNk1zkwEVhBuIUKRu3fqv+hs4nxLISi2DQGlqIOGiFxgbfHg==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "@types/unist": "^3.0.0", + "devlop": "^1.0.0", + "estree-util-visit": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "vfile-message": "^4.0.0" + } + }, + "micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "dev": true + }, + "micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "dev": true, + "requires": { + "micromark-util-symbol": "^2.0.0" + } + }, + "micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "dev": true, + "requires": { + "micromark-util-types": "^2.0.0" + } + }, + "micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "dev": true, + "requires": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "dev": true, + "requires": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "dev": true + }, + "micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "dev": true + }, + "micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "requires": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + } + }, + "microtime": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/microtime/-/microtime-3.1.1.tgz", + "integrity": "sha512-to1r7o24cDsud9IhN6/8wGmMx5R2kT0w2Xwm5okbYI3d1dk6Xv0m+Z+jg2vS9pt+ocgQHTCtgs/YuyJhySzxNg==", + "dev": true, + "requires": { + "node-addon-api": "^5.0.0", + "node-gyp-build": "^4.4.0" + } + }, + "mime-db": { + "version": "1.49.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", + "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", + "dev": true + }, + "mime-types": { + "version": "2.1.32", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", + "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", + "dev": true, + "requires": { + "mime-db": "1.49.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true + }, + "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 + }, + "nanoid": { + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.10.tgz", + "integrity": "sha512-vSJJTG+t/dIKAUhUDw/dLdZ9s//5OxcHqLaDWWrW4Cdq7o6tdLIczUkMXt2MBNmk6sJRZBZRXVixs7URY1CmIg==", + "dev": true + }, + "nanospinner": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/nanospinner/-/nanospinner-1.2.2.tgz", + "integrity": "sha512-Zt/AmG6qRU3e+WnzGGLuMCEAO/dAu45stNbHY223tUxldaDAeE+FxSPsd9Q+j+paejmm0ZbrNVs5Sraqy3dRxA==", + "dev": true, + "requires": { + "picocolors": "^1.1.1" + } + }, + "napi-postinstall": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.2.3.tgz", + "integrity": "sha512-Mi7JISo/4Ij2tDZ2xBE2WH+/KvVlkhA6juEjpEeRAVPNCpN3nxJo/5FhDNKgBcdmcmhaH6JjgST4xY/23ZYK0w==", + "dev": true + }, + "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 + }, + "nested-error-stacks": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.1.tgz", + "integrity": "sha512-9iN1ka/9zmX1ZvLV9ewJYEk9h7RyRRtqdK0woXcqohu8EWIerfPUjYJPg0ULy0UqP7cslmdGc8xKDJcojlKiaw==", + "dev": true + }, + "next": { + "version": "15.3.2", + "resolved": "https://registry.npmjs.org/next/-/next-15.3.2.tgz", + "integrity": "sha512-CA3BatMyHkxZ48sgOCLdVHjFU36N7TF1HhqAHLFOkV6buwZnvMI84Cug8xD56B9mCuKrqXnLn94417GrZ/jjCQ==", + "dev": true, + "requires": { + "@next/env": "15.3.2", + "@next/swc-darwin-arm64": "15.3.2", + "@next/swc-darwin-x64": "15.3.2", + "@next/swc-linux-arm64-gnu": "15.3.2", + "@next/swc-linux-arm64-musl": "15.3.2", + "@next/swc-linux-x64-gnu": "15.3.2", + "@next/swc-linux-x64-musl": "15.3.2", + "@next/swc-win32-arm64-msvc": "15.3.2", + "@next/swc-win32-x64-msvc": "15.3.2", + "@swc/counter": "0.1.3", + "@swc/helpers": "0.5.15", + "busboy": "1.6.0", + "caniuse-lite": "^1.0.30001579", + "postcss": "8.4.31", + "sharp": "^0.34.1", + "styled-jsx": "5.1.6" + } + }, + "next-sitemap": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/next-sitemap/-/next-sitemap-4.2.3.tgz", + "integrity": "sha512-vjdCxeDuWDzldhCnyFCQipw5bfpl4HmZA7uoo3GAaYGjGgfL4Cxb1CiztPuWGmS+auYs7/8OekRS8C2cjdAsjQ==", + "dev": true, + "requires": { + "@corex/deepmerge": "^4.0.43", + "@next/env": "^13.4.3", + "fast-glob": "^3.2.12", + "minimist": "^1.2.8" + }, + "dependencies": { + "@next/env": { + "version": "13.5.8", + "resolved": "https://registry.npmjs.org/@next/env/-/env-13.5.8.tgz", + "integrity": "sha512-YmiG58BqyZ2FjrF2+5uZExL2BrLr8RTQzLXNDJ8pJr0O+rPlOeDPXp1p1/4OrR3avDidzZo3D8QO2cuDv1KCkw==", + "dev": true + } + } + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-addon-api": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", + "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==", + "dev": true + }, + "node-gyp-build": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", + "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", + "dev": true + }, + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true + }, + "node-releases": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true + }, + "normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true + } + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "npm-run-all": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", + "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "chalk": "^2.4.1", + "cross-spawn": "^6.0.5", + "memorystream": "^0.3.1", + "minimatch": "^3.0.4", + "pidtree": "^0.3.0", + "read-pkg": "^3.0.0", + "shell-quote": "^1.6.1", + "string.prototype.padend": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "cross-spawn": { + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true + }, + "semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "nwsapi": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.7.tgz", + "integrity": "sha512-ub5E4+FBPKwAZx0UwIQOjYWGHTEq5sPqHQNRN8Z9e4A7u3Tj1weLJsL59yH9vmvqEtBHaOmT6cYQKIZOxp35FQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true + }, + "object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + } + }, + "object.entries": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.8.tgz", + "integrity": "sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, + "object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + } + }, + "object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + } + }, + "object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "open": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.1.0.tgz", + "integrity": "sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==", + "dev": true, + "requires": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "is-wsl": "^3.1.0" + } + }, + "optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "requires": { + "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.5" + } + }, + "own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "dev": true, + "requires": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + } + }, + "p-event": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-5.0.1.tgz", + "integrity": "sha512-dd589iCQ7m1L0bmC5NLlVYfy3TbBEsMUfWx9PyAgPeIcFZ/E2yaTZ4Rz4MiBmmJShviiftHVXOqfnfzJ6kyMrQ==", + "dev": true, + "requires": { + "p-timeout": "^5.0.2" + } + }, + "p-filter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-filter/-/p-filter-3.0.0.tgz", + "integrity": "sha512-QtoWLjXAW++uTX67HZQz1dbTpqBfiidsB6VtQUC9iR85S120+s0T5sO6s+B5MLzFcZkrEd/DGMmCjR+f2Qpxwg==", + "dev": true, + "requires": { + "p-map": "^5.1.0" + }, + "dependencies": { + "p-map": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-5.5.0.tgz", + "integrity": "sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==", + "dev": true, + "requires": { + "aggregate-error": "^4.0.0" + } + } + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "p-map": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-6.0.0.tgz", + "integrity": "sha512-T8BatKGY+k5rU+Q/GTYgrEf2r4xRMevAN5mtXc2aPc4rS1j3s+vWTaO2Wag94neXuCAUAs8cxBL9EeB5EA6diw==", + "dev": true + }, + "p-timeout": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", + "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", + "dev": true + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "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" + } + }, + "parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "dev": true, + "requires": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "dependencies": { + "@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "dev": true + } + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "requires": { + "entities": "^4.4.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pidtree": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", + "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true + }, + "pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", + "dev": true + }, + "platform": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz", + "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==", + "dev": true + }, + "possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true + }, + "postcss": { + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", + "dev": true, + "requires": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + } + }, + "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 + }, + "prettier": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.0.tgz", + "integrity": "sha512-quyMrVt6svPS7CjQ9gKb3GLEX/rl3BCL2oa/QkNcXv4YNVBC9olt3s+H7ukto06q7B1Qz46PbrKLO34PR6vXcA==", + "dev": true + }, + "pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + }, + "react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true + } + } + }, + "prismjs": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", + "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==", + "dev": true + }, + "prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + } + }, + "prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "property-information": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.0.0.tgz", + "integrity": "sha512-7D/qOz/+Y4X/rzSB6jKxKUsQnphO046ei8qxG59mtM3RG3DHgTK81HrxrmoDVINJb8NKT5ZsRbwHvQ6B68Iyhg==", + "dev": true + }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true + }, + "punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true + }, + "pure-rand": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.2.tgz", + "integrity": "sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==", + "dev": true + }, + "querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "random-seed": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/random-seed/-/random-seed-0.3.0.tgz", + "integrity": "sha512-y13xtn3kcTlLub3HKWXxJNeC2qK4mB59evwZ5EkeRlolx+Bp2ztF7LbcZmyCnOqlHQrLnfuNbi1sVmm9lPDlDA==", + "dev": true, + "requires": { + "json-stringify-safe": "^5.0.1" + } + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "react": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", + "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", + "dev": true + }, + "react-dom": { + "version": "19.1.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", + "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", + "dev": true, + "requires": { + "scheduler": "^0.26.0" + } + }, + "react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "dependencies": { + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + } + } + }, + "readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true + }, + "recma-build-jsx": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-build-jsx/-/recma-build-jsx-1.0.0.tgz", + "integrity": "sha512-8GtdyqaBcDfva+GUKDr3nev3VpKAhup1+RvkMvUxURHpW7QyIvk9F5wz7Vzo06CEMSilw6uArgRqhpiUcWp8ew==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "estree-util-build-jsx": "^3.0.0", + "vfile": "^6.0.0" + } + }, + "recma-jsx": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-jsx/-/recma-jsx-1.0.0.tgz", + "integrity": "sha512-5vwkv65qWwYxg+Atz95acp8DMu1JDSqdGkA2Of1j6rCreyFUE/gp15fC8MnGEuG1W68UKjM6x6+YTWIh7hZM/Q==", + "dev": true, + "requires": { + "acorn-jsx": "^5.0.0", + "estree-util-to-js": "^2.0.0", + "recma-parse": "^1.0.0", + "recma-stringify": "^1.0.0", + "unified": "^11.0.0" + } + }, + "recma-parse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-parse/-/recma-parse-1.0.0.tgz", + "integrity": "sha512-OYLsIGBB5Y5wjnSnQW6t3Xg7q3fQ7FWbw/vcXtORTnyaSFscOtABg+7Pnz6YZ6c27fG1/aN8CjfwoUEUIdwqWQ==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "esast-util-from-js": "^2.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + } + }, + "recma-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/recma-stringify/-/recma-stringify-1.0.0.tgz", + "integrity": "sha512-cjwII1MdIIVloKvC9ErQ+OgAtwHBmcZ0Bg4ciz78FtbT8In39aAYbaA7zvxQ61xVMSPE8WxhLwLbhif4Js2C+g==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "estree-util-to-js": "^2.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + } + }, + "reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + } + }, + "regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", + "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", + "dev": true, + "requires": { + "regenerate": "^1.4.0" + } + }, + "regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + } + }, + "regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", + "dev": true + }, + "regjsparser": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.9.tgz", + "integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "dev": true + } + } + }, + "rehype-recma": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rehype-recma/-/rehype-recma-1.0.0.tgz", + "integrity": "sha512-lqA4rGUf1JmacCNWWZx0Wv1dHqMwxzsDWYMTowuplHF3xH0N/MmrZ/G3BDZnzAkRmxDadujCjaKM2hqYdCBOGw==", + "dev": true, + "requires": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "hast-util-to-estree": "^3.0.0" + } + }, + "remark-mdx": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.0.tgz", + "integrity": "sha512-Ngl/H3YXyBV9RcRNdlYsZujAmhsxwzxpDzpDEhFBVAGthS4GDgnctpDjgFl/ULx5UEDzqtW1cyBSNKqYYrqLBA==", + "dev": true, + "requires": { + "mdast-util-mdx": "^3.0.0", + "micromark-extension-mdxjs": "^3.0.0" + } + }, + "remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "dev": true, + "requires": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + } + }, + "remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "dev": true, + "requires": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, + "resolve": { + "version": "1.22.10", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", + "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", + "dev": true, + "requires": { + "is-core-module": "^2.16.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + } + } + }, + "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 + }, + "resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true + }, + "resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "rollup": { + "version": "4.34.8", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz", + "integrity": "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==", + "dev": true, + "requires": { + "@rollup/rollup-android-arm-eabi": "4.34.8", + "@rollup/rollup-android-arm64": "4.34.8", + "@rollup/rollup-darwin-arm64": "4.34.8", + "@rollup/rollup-darwin-x64": "4.34.8", + "@rollup/rollup-freebsd-arm64": "4.34.8", + "@rollup/rollup-freebsd-x64": "4.34.8", + "@rollup/rollup-linux-arm-gnueabihf": "4.34.8", + "@rollup/rollup-linux-arm-musleabihf": "4.34.8", + "@rollup/rollup-linux-arm64-gnu": "4.34.8", + "@rollup/rollup-linux-arm64-musl": "4.34.8", + "@rollup/rollup-linux-loongarch64-gnu": "4.34.8", + "@rollup/rollup-linux-powerpc64le-gnu": "4.34.8", + "@rollup/rollup-linux-riscv64-gnu": "4.34.8", + "@rollup/rollup-linux-s390x-gnu": "4.34.8", + "@rollup/rollup-linux-x64-gnu": "4.34.8", + "@rollup/rollup-linux-x64-musl": "4.34.8", + "@rollup/rollup-win32-arm64-msvc": "4.34.8", + "@rollup/rollup-win32-ia32-msvc": "4.34.8", + "@rollup/rollup-win32-x64-msvc": "4.34.8", + "@types/estree": "1.0.6", + "fsevents": "~2.3.2" + } + }, + "run-applescript": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", + "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", + "dev": true + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + }, + "safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "requires": { + "xmlchars": "^2.2.0" + } + }, + "scheduler": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz", + "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", + "dev": true + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + }, + "serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "requires": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + } + }, + "set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "requires": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + } + }, + "set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "requires": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + } + }, + "sharp": { + "version": "0.34.1", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.1.tgz", + "integrity": "sha512-1j0w61+eVxu7DawFJtnfYcvSv6qPFvfTaqzTQ2BLknVhHTwGS8sc63ZBF4rzkWMBVKybo4S5OBtDdZahh2A1xg==", + "dev": true, + "optional": true, + "requires": { + "@img/sharp-darwin-arm64": "0.34.1", + "@img/sharp-darwin-x64": "0.34.1", + "@img/sharp-libvips-darwin-arm64": "1.1.0", + "@img/sharp-libvips-darwin-x64": "1.1.0", + "@img/sharp-libvips-linux-arm": "1.1.0", + "@img/sharp-libvips-linux-arm64": "1.1.0", + "@img/sharp-libvips-linux-ppc64": "1.1.0", + "@img/sharp-libvips-linux-s390x": "1.1.0", + "@img/sharp-libvips-linux-x64": "1.1.0", + "@img/sharp-libvips-linuxmusl-arm64": "1.1.0", + "@img/sharp-libvips-linuxmusl-x64": "1.1.0", + "@img/sharp-linux-arm": "0.34.1", + "@img/sharp-linux-arm64": "0.34.1", + "@img/sharp-linux-s390x": "0.34.1", + "@img/sharp-linux-x64": "0.34.1", + "@img/sharp-linuxmusl-arm64": "0.34.1", + "@img/sharp-linuxmusl-x64": "0.34.1", + "@img/sharp-wasm32": "0.34.1", + "@img/sharp-win32-ia32": "0.34.1", + "@img/sharp-win32-x64": "0.34.1", + "color": "^4.2.3", + "detect-libc": "^2.0.3", + "semver": "^7.7.1" + }, + "dependencies": { + "semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "optional": true + } + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "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==", + "dev": true + }, + "shell-quote": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.2.tgz", + "integrity": "sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA==", + "dev": true + }, + "side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + } + }, + "side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "requires": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + } + }, + "side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + } + }, + "side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + } + }, + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", + "dev": true, + "optional": true, + "requires": { + "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "dev": true, + "optional": true + } + } + }, + "sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "size-limit": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-11.2.0.tgz", + "integrity": "sha512-2kpQq2DD/pRpx3Tal/qRW1SYwcIeQ0iq8li5CJHQgOC+FtPn2BVmuDtzUCgNnpCrbgtfEHqh+iWzxK+Tq6C+RQ==", + "dev": true, + "requires": { + "bytes-iec": "^3.1.1", + "chokidar": "^4.0.3", + "jiti": "^2.4.2", + "lilconfig": "^3.1.3", + "nanospinner": "^1.2.2", + "picocolors": "^1.1.1", + "tinyglobby": "^0.2.11" + } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "smob": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/smob/-/smob-1.4.0.tgz", + "integrity": "sha512-MqR3fVulhjWuRNSMydnTlweu38UhQ0HXM4buStD/S3mc/BzX3CuM9OmhyQpmtYCvoYdl5ris6TI0ZqH355Ymqg==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true + }, + "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==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "dev": true + }, + "space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "dev": true + }, + "spdx-correct": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", + "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", + "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.9.tgz", + "integrity": "sha512-Ki212dKK4ogX+xDo4CtOZBVIwhsKBEfsEEcwmJfLQzirgc2jIWdzg40Unxz/HzEUqM1WFzVlQSMF9kZZ2HboLQ==", + "dev": true + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "stable-hash": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz", + "integrity": "sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==", + "dev": true + }, + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + } + } + }, + "streamsearch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", + "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", + "dev": true + }, + "string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + } + }, + "string.prototype.matchall": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", + "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.3", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.0" + } + }, + "string.prototype.padend": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.2.tgz", + "integrity": "sha512-/AQFLdYvePENU3W5rgurfWSMU6n+Ww8n/3cUt7E+vPBB/D7YDG8x+qjoFs4M/alR2bW7Qg6xMjVwWUOvuQ0XpQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.18.0-next.2" + } + }, + "string.prototype.repeat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", + "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", + "dev": true, + "requires": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-object-atoms": "^1.0.0", + "has-property-descriptors": "^1.0.2" + } + }, + "string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, + "string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + } + }, + "stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "dev": true, + "requires": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + } + }, + "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": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "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==", + "dev": true + }, + "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 + }, + "style-mod": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz", + "integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==", + "dev": true + }, + "style-to-js": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.16.tgz", + "integrity": "sha512-/Q6ld50hKYPH3d/r6nr117TZkHR0w0kGGIVfpG9N6D8NymRPM9RqCUv4pRpJ62E5DqOYx2AFpbZMyCPnjQCnOw==", + "dev": true, + "requires": { + "style-to-object": "1.0.8" + } + }, + "style-to-object": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.8.tgz", + "integrity": "sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==", + "dev": true, + "requires": { + "inline-style-parser": "0.2.4" + } + }, + "styled-jsx": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", + "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", + "dev": true, + "requires": { + "client-only": "0.0.1" + } + }, + "subsume": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/subsume/-/subsume-3.0.0.tgz", + "integrity": "sha512-6n/UfV8UWKwJNO8OAOiKntwEMihuBeeoJfzpL542C+OuvT4iWG9SwjrXkOmsxjb4SteHUsos9SvrdqZ9+ICwTQ==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0", + "unique-string": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + } + } + }, + "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" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, + "symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true + }, + "terser": { + "version": "5.19.2", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz", + "integrity": "sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==", + "dev": true, + "requires": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "dependencies": { + "acorn": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "dev": true + } + } + }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, + "tinyglobby": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", + "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", + "dev": true, + "requires": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "dependencies": { + "fdir": { + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", + "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", + "dev": true, + "requires": {} + }, + "picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true + } + } + }, + "tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "tr46": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-3.0.0.tgz", + "integrity": "sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==", + "dev": true, + "requires": { + "punycode": "^2.1.1" + } + }, + "transducers-js": { + "version": "0.4.174", + "resolved": "https://registry.npmjs.org/transducers-js/-/transducers-js-0.4.174.tgz", + "integrity": "sha1-1YYsEO/0vj0zIqv2u3QuMPG7b8Q=", + "dev": true + }, + "trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "dev": true + }, + "trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "dev": true + }, + "ts-api-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.1.tgz", + "integrity": "sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w==", + "dev": true, + "requires": {} + }, + "ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "dependencies": { + "acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true + } + } + }, + "tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true + } + } + }, + "tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true + }, + "tstyche": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/tstyche/-/tstyche-3.5.0.tgz", + "integrity": "sha512-N4SUp/ZWaMGEcglpVFIzKez0GQEiBdfFDgcnqwv9O1mePZgos8N1cZCzNgGtPGo/w0ym04MjJcDnsw1sorEzgA==", + "dev": true, + "requires": {} + }, + "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-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + } + }, + "typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "requires": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + } + }, + "typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" + } + }, + "typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "dev": true, + "requires": { + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" + } + }, + "typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "dev": true + }, + "typescript-eslint": { + "version": "8.24.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.24.0.tgz", + "integrity": "sha512-/lmv4366en/qbB32Vz5+kCNZEMf6xYHwh1z48suBwZvAtnXKbP+YhGe8OLE2BqC67LMqKkCNLtjejdwsdW6uOQ==", + "dev": true, + "requires": { + "@typescript-eslint/eslint-plugin": "8.24.0", + "@typescript-eslint/parser": "8.24.0", + "@typescript-eslint/utils": "8.24.0" + } + }, + "unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "requires": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + } + }, + "undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", + "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", + "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", + "dev": true + }, + "unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + } + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "unist-util-is": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.0.tgz", + "integrity": "sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0" + } + }, + "unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0" + } + }, + "unist-util-position-from-estree": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position-from-estree/-/unist-util-position-from-estree-2.0.0.tgz", + "integrity": "sha512-KaFVRjoqLyF6YXCbVLNad/eS4+OfPQQn2yOd7zF/h5T/CSL2v8NpN6a5TPvtbXthAGw5nG+PuTtq+DdIZr+cRQ==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0" + } + }, + "unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0" + } + }, + "unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + } + }, + "unist-util-visit-parents": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz", + "integrity": "sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + } + }, + "unrs-resolver": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/unrs-resolver/-/unrs-resolver-1.7.2.tgz", + "integrity": "sha512-BBKpaylOW8KbHsu378Zky/dGh4ckT/4NW/0SHRABdqRLcQJ2dAOjDo9g97p04sWflm0kqPqpUatxReNV/dqI5A==", + "dev": true, + "requires": { + "@unrs/resolver-binding-darwin-arm64": "1.7.2", + "@unrs/resolver-binding-darwin-x64": "1.7.2", + "@unrs/resolver-binding-freebsd-x64": "1.7.2", + "@unrs/resolver-binding-linux-arm-gnueabihf": "1.7.2", + "@unrs/resolver-binding-linux-arm-musleabihf": "1.7.2", + "@unrs/resolver-binding-linux-arm64-gnu": "1.7.2", + "@unrs/resolver-binding-linux-arm64-musl": "1.7.2", + "@unrs/resolver-binding-linux-ppc64-gnu": "1.7.2", + "@unrs/resolver-binding-linux-riscv64-gnu": "1.7.2", + "@unrs/resolver-binding-linux-riscv64-musl": "1.7.2", + "@unrs/resolver-binding-linux-s390x-gnu": "1.7.2", + "@unrs/resolver-binding-linux-x64-gnu": "1.7.2", + "@unrs/resolver-binding-linux-x64-musl": "1.7.2", + "@unrs/resolver-binding-wasm32-wasi": "1.7.2", + "@unrs/resolver-binding-win32-arm64-msvc": "1.7.2", + "@unrs/resolver-binding-win32-ia32-msvc": "1.7.2", + "@unrs/resolver-binding-win32-x64-msvc": "1.7.2", + "napi-postinstall": "^0.2.2" + } + }, + "update-browserslist-db": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", + "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", + "dev": true, + "requires": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + } + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dev": true, + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, + "v8-to-istanbul": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.1.0.tgz", + "integrity": "sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0" + } + }, + "validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + } + }, + "vfile-message": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", + "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "dev": true, + "requires": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + } + }, + "w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "dev": true + }, + "w3c-xmlserializer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", + "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==", + "dev": true, + "requires": { + "xml-name-validator": "^4.0.0" + } + }, + "walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "requires": { + "makeerror": "1.0.12" + } + }, + "webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true + }, + "whatwg-encoding": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz", + "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==", + "dev": true, + "requires": { + "iconv-lite": "0.6.3" + } + }, + "whatwg-mimetype": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", + "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==", + "dev": true + }, + "whatwg-url": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-11.0.0.tgz", + "integrity": "sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ==", + "dev": true, + "requires": { + "tr46": "^3.0.0", + "webidl-conversions": "^7.0.0" + } + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "requires": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + } + }, + "which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "requires": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "dependencies": { + "isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + } + } + }, + "which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "requires": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + } + }, + "which-typed-array": { + "version": "1.1.18", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.18.tgz", + "integrity": "sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + } + }, + "word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } + }, + "ws": { + "version": "8.18.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.1.tgz", + "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", + "dev": true, + "requires": {} + }, + "xml-name-validator": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz", + "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==", + "dev": true + }, + "xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true + } + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + }, + "zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "dev": true + } + } +} diff --git a/package.json b/package.json index 871be9d55e..9d7ef03c4b 100644 --- a/package.json +++ b/package.json @@ -1,100 +1,27 @@ { "name": "immutable", - "version": "3.8.1", + "version": "5.1.2", "description": "Immutable Data Collections", - "homepage": "https://facebook.github.com/immutable-js", + "license": "MIT", + "homepage": "https://immutable-js.com", "author": { "name": "Lee Byron", "url": "https://github.com/leebyron" }, "repository": { "type": "git", - "url": "git://github.com/facebook/immutable-js.git" + "url": "git://github.com/immutable-js/immutable-js.git" }, "bugs": { - "url": "https://github.com/facebook/immutable-js/issues" + "url": "https://github.com/immutable-js/immutable-js/issues" }, "main": "dist/immutable.js", - "typings": "dist/immutable-nonambient.d.ts", - "typescript": { - "definition": "dist/immutable.d.ts" - }, - "scripts": { - "build": "grunt default && gulp default", - "lint": "eslint src/ && grunt lint && gulp lint", - "testonly": "./resources/jest", - "test": "npm run build && npm run lint && npm run testonly && npm run type-check", - "type-check": "cd type-definitions/tests && flow check", - "perf": "node ./resources/bench.js", - "start": "gulp dev", - "deploy": "(cd ./pages/out && git init && git config user.name \"Travis CI\" && git config user.email \"github@fb.com\" && git add . && git commit -m \"Deploy to GitHub Pages\" && git push --force --quiet \"https://${GH_TOKEN}@github.com/facebook/immutable-js.git\" master:gh-pages > /dev/null 2>1)" - }, - "jest": { - "moduleFileExtensions": [ - "js", - "ts" - ], - "transform": { - "^.+\\.ts$": "/resources/jestPreprocessor.js" - }, - "testRegex": "/__tests__/.*\\.(ts|js)$", - "unmockedModulePathPatterns": [ - "./node_modules/react" - ] - }, - "devDependencies": { - "acorn": "0.11.x", - "babel-eslint": "^4.1.8", - "benchmark": "^1.0.0", - "browser-sync": "2.18.8", - "browserify": "^5.11.2", - "colors": "1.1.2", - "del": "2.2.2", - "es6-transpiler": "0.7.18", - "eslint": "^1.10.3", - "estraverse": "1.9.3", - "express": "^4.13.4", - "fbjs-scripts": "^0.5.0", - "flow-bin": "0.40.0", - "grunt": "1.0.1", - "grunt-cli": "1.2.0", - "grunt-contrib-clean": "1.0.0", - "grunt-contrib-copy": "1.0.0", - "grunt-contrib-jshint": "1.1.0", - "grunt-release": "0.14.0", - "gulp": "3.9.1", - "gulp-concat": "2.6.1", - "gulp-filter": "5.0.0", - "gulp-header": "1.8.8", - "gulp-jshint": "2.0.4", - "gulp-less": "3.3.0", - "gulp-size": "2.1.0", - "gulp-sourcemaps": "1.6.0", - "gulp-uglify": "2.0.1", - "gulp-util": "3.0.8", - "jasmine-check": "^0.1.2", - "jest": "^17.0.3", - "jshint-stylish": "^0.4.0", - "magic-string": "0.10.2", - "marked": "0.3.6", - "microtime": "^2.0.0", - "react": "^0.12.0", - "react-router": "^0.11.2", - "react-tools": "^0.12.0", - "rollup": "0.24.0", - "run-sequence": "1.2.2", - "through2": "2.0.3", - "typescript": "2.2.1", - "uglify-js": "2.8.4", - "vinyl-buffer": "1.0.0", - "vinyl-source-stream": "1.1.0" - }, + "module": "dist/immutable.es.js", + "types": "dist/immutable.d.ts", "files": [ "dist", - "contrib", "README.md", - "LICENSE", - "PATENTS" + "LICENSE" ], "keywords": [ "immutable", @@ -108,5 +35,132 @@ "sequence", "iteration" ], - "license": "BSD-3-Clause" + "publishKeys": [ + "name", + "version", + "description", + "license", + "homepage", + "author", + "repository", + "bugs", + "main", + "module", + "sideEffects", + "types", + "files", + "keywords" + ], + "engines": { + "npm": ">=7.0.0" + }, + "scripts": { + "test": "run-s format lint type-check build test:*", + "test:unit": "jest", + "test:types": "tstyche", + "format": "npm run lint:format -- --write", + "lint": "run-s lint:*", + "lint:format": "prettier --check \"{__tests__,src,type-definitions,website/src,perf,resources}/**/*{.js,.mjs,.ts,.tsx,.flow,.css}\"", + "lint:js": "eslint", + "type-check": "run-s type-check:*", + "type-check:ts": "tsc --project tsconfig.src.json && tsc --project type-definitions/tsconfig.json && tsc --project __tests__/tsconfig.json", + "type-check:flow": "flow check type-definitions/flow-tests --include-warnings", + "build": "run-s build:*", + "build:clean": "rimraf dist", + "build:dist": "rollup -c ./resources/rollup-config.mjs", + "build:types": "cpy \"./type-definitions/immutable.*\" dist", + "build:prepare": "./resources/prepare-dist.sh", + "build:stats": "node ./resources/dist-stats.mjs", + "website:build": "cd website && rm -rf out && next build --turbopack && next-sitemap", + "website:dev": "cd website && next dev --turbopack", + "check-build-output": "node ./resources/check-build-output.mjs", + "check-git-clean": "./resources/check-git-clean.sh", + "benchmark": "node ./resources/benchmark.js", + "publish": "echo 'ONLY PUBLISH VIA CI'; exit 1;" + }, + "prettier": { + "singleQuote": true, + "trailingComma": "es5" + }, + "devDependencies": { + "@codemirror/commands": "^6.8.1", + "@codemirror/lang-javascript": "^6.2.3", + "@codemirror/state": "^6.5.2", + "@codemirror/theme-one-dark": "^6.1.2", + "@codemirror/view": "^6.36.5", + "@eslint/js": "^9.20.0", + "@jdeniau/immutable-devtools": "^0.2.0", + "@jest/globals": "^29.7.0", + "@mdx-js/loader": "^3.1.0", + "@mdx-js/react": "^3.1.0", + "@next/mdx": "^15.3.2", + "@rollup/plugin-buble": "1.0.3", + "@rollup/plugin-commonjs": "28.0.2", + "@rollup/plugin-json": "6.1.0", + "@rollup/plugin-terser": "^0.4.4", + "@rollup/plugin-typescript": "^12.1.2", + "@size-limit/esbuild-why": "^11.2.0", + "@size-limit/preset-small-lib": "^11.2.0", + "@types/mdx": "^2.0.13", + "@types/node": "^22.15.17", + "@types/prismjs": "^1.26.3", + "@types/random-seed": "0.3.5", + "@types/react": "19.1.0", + "benchmark": "2.1.4", + "codemirror": "^6.0.1", + "colors": "1.4.0", + "cpy-cli": "^5.0.0", + "eslint": "^9.20.1", + "eslint-import-resolver-typescript": "^4.3.4", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-jest": "^28.11.0", + "eslint-plugin-react": "^7.37.4", + "fast-check": "^4.0.0", + "flow-bin": "0.160.0", + "globals": "^15.15.0", + "jest": "^29.0.0", + "jest-environment-jsdom": "^29.6.4", + "jsonml-html": "^1.2.0", + "make-synchronous": "0.1.1", + "marked": "^11.2.0", + "marked-highlight": "^2.1.0", + "microtime": "3.1.1", + "next": "^15.3.2", + "next-sitemap": "4.2.3", + "npm-run-all": "4.1.5", + "prettier": "^3.5.0", + "prismjs": "^1.29.0", + "random-seed": "0.3.0", + "react": "19.1.0", + "react-dom": "19.1.0", + "rimraf": "2.7.1", + "rollup": "4.34.8", + "size-limit": "^11.2.0", + "transducers-js": "0.4.174", + "ts-node": "^10.9.2", + "tslib": "^2.8.1", + "tstyche": "^3.5", + "typescript": "5.7", + "typescript-eslint": "^8.24.0" + }, + "size-limit": [ + { + "name": "all", + "path": "dist/immutable.es.js", + "import": "*", + "limit": "20 kB" + }, + { + "name": "List", + "path": "dist/immutable.es.js", + "import": "{ List }", + "limit": "20 kB" + }, + { + "name": "Seq", + "path": "dist/immutable.es.js", + "import": "{ Seq }", + "limit": "20 kB" + } + ] } diff --git a/pages/lib/TypeKind.js b/pages/lib/TypeKind.js deleted file mode 100644 index c6dd087fc5..0000000000 --- a/pages/lib/TypeKind.js +++ /dev/null @@ -1,22 +0,0 @@ -var TypeKind = { - Any: 0, - - Boolean: 1, - Number: 2, - String: 3, - Object: 4, - Array: 5, - Function: 6, - - Param: 7, - Type: 8, - - This: 9, - Undefined: 10, - Union: 11, - Tuple: 12, - Indexed: 13, - Operator: 14, -}; - -module.exports = TypeKind; diff --git a/pages/lib/collectMemberGroups.js b/pages/lib/collectMemberGroups.js deleted file mode 100644 index 369f314d5a..0000000000 --- a/pages/lib/collectMemberGroups.js +++ /dev/null @@ -1,74 +0,0 @@ -var { Seq } = require('../../'); -// Note: intentionally using raw defs, not getTypeDefs to avoid circular ref. -var defs = require('../resources/immutable.d.json'); - -function collectMemberGroups(interfaceDef, options) { - var members = {}; - - if (interfaceDef) { - collectFromDef(interfaceDef); - } - - var groups = {'':[]}; - - if (options.showInGroups) { - Seq(members).forEach(member => { - (groups[member.group] || (groups[member.group] = [])).push(member); - }); - } else { - groups[''] = Seq(members).sortBy(member => member.memberName).toArray(); - } - - if (!options.showInherited) { - groups = Seq(groups).map( - members => members.filter(member => !member.inherited) - ).toObject(); - } - - return groups; - - function collectFromDef(def, name) { - - def.groups && def.groups.forEach(g => { - Seq(g.members).forEach((memberDef, memberName) => { - collectMember(g.title || '', memberName, memberDef); - }); - }); - - def.extends && def.extends.forEach(e => { - var superModule = defs.Immutable; - e.name.split('.').forEach(part => { - superModule = - superModule && superModule.module && superModule.module[part]; - }); - var superInterface = superModule && superModule.interface; - if (superInterface) { - collectFromDef(superInterface, e.name); - } - }); - - function collectMember(group, memberName, memberDef) { - var member = members[memberName]; - if (member) { - if (!member.inherited) { - member.overrides = { name, def, memberDef }; - } - if (!member.group && group) { - member.group = group; - } - } else { - member = { - group, - memberName: memberName.substr(1), - memberDef - }; - if (def !== interfaceDef) { - member.inherited = { name, def }; - } - members[memberName] = member; - } - } - } -} - -module.exports = collectMemberGroups; diff --git a/pages/lib/genMarkdownDoc.js b/pages/lib/genMarkdownDoc.js deleted file mode 100644 index c65295a2ee..0000000000 --- a/pages/lib/genMarkdownDoc.js +++ /dev/null @@ -1,16 +0,0 @@ -var markdown = require('./markdown'); -var defs = require('./getTypeDefs'); - - -function genMarkdownDoc(typeDefSource) { - return markdown( - typeDefSource.replace(/\n[^\n]+?travis-ci.org[^\n]+?\n/, '\n'), - { - defs, - typePath: ['Immutable'], - relPath: 'docs/' - } - ); -} - -module.exports = genMarkdownDoc; diff --git a/pages/lib/genTypeDefData.js b/pages/lib/genTypeDefData.js deleted file mode 100644 index 42144e20dd..0000000000 --- a/pages/lib/genTypeDefData.js +++ /dev/null @@ -1,480 +0,0 @@ -var ts = require('typescript'); - -var TypeKind = require('./TypeKind'); - -function genTypeDefData(typeDefPath, typeDefSource) { - var sourceFile = ts.createSourceFile( - typeDefPath, - typeDefSource, - ts.ScriptTarget.ES2015, - /* parentReferences */ true - ); - return DocVisitor(sourceFile); -} - -module.exports = genTypeDefData; - -function DocVisitor(source) { - - var stack = []; - var data = {}; - var typeParams = []; - var aliases = []; - - visit(source); - return pop(); - - function visit(node) { - switch (node.kind) { - case ts.SyntaxKind.ModuleDeclaration: - return visitModuleDeclaration(node); - case ts.SyntaxKind.FunctionDeclaration: - return visitFunctionDeclaration(node); - case ts.SyntaxKind.InterfaceDeclaration: - return visitInterfaceDeclaration(node); - case ts.SyntaxKind.TypeAnnotation: - return; // do not visit type annotations. - case ts.SyntaxKind.PropertySignature: - return visitPropertySignature(node); - case ts.SyntaxKind.MethodSignature: - return visitMethodSignature(node); - default: - return ts.forEachChild(node, visit); - } - } - - function push(newData) { - stack.push(data); - data = newData; - } - - function pop() { - var prevData = data; - data = stack.pop(); - return prevData; - } - - function isTypeParam(name) { - return typeParams.some(set => set && set.indexOf(name) !== -1); - } - - function isAliased(name) { - return !!last(aliases)[name]; - } - - function addAliases(comment, name) { - comment && comment.notes && comment.notes.filter( - note => note.name === 'alias' - ).map( - node => node.body - ).forEach(alias => { - last(aliases)[alias] = name; - }); - } - - function visitModuleDeclaration(node) { - var moduleObj = {}; - - var comment = getDoc(node); - if (!shouldIgnore(comment)) { - var name = - node.name ? node.name.text : - node.stringLiteral ? node.stringLiteral.text : - ''; - - if (comment) { - setIn(data, [name, 'doc'], comment); - } - - setIn(data, [name, 'module'], moduleObj); - } - - push(moduleObj); - aliases.push({}); - - ts.forEachChild(node, visit); - - aliases.pop(); - pop(); - } - - function visitFunctionDeclaration(node) { - var comment = getDoc(node); - var name = node.name.text; - if (!shouldIgnore(comment) && !isAliased(name)) { - addAliases(comment, name); - - var comment = getDoc(node); - if (comment) { - setIn(data, [name, 'call', 'doc'], comment); - } - - var callSignature = parseCallSignature(node); - callSignature.line = getLineNum(node); - pushIn(data, [name, 'call', 'signatures'], callSignature); - } - - ts.forEachChild(node, visit); - } - - function visitInterfaceDeclaration(node) { - var interfaceObj = {}; - - var comment = getDoc(node); - var ignore = shouldIgnore(comment); - if (!ignore) { - var name = node.name.text; - - interfaceObj.line = getLineNum(node) - - if (comment) { - interfaceObj.doc = comment; - } - if (node.typeParameters) { - interfaceObj.typeParams = node.typeParameters.map(tp => { - return tp.name.text; - }); - } - - typeParams.push(interfaceObj.typeParams); - - if (node.heritageClauses) { - node.heritageClauses.forEach(hc => { - var kind; - if (hc.token === ts.SyntaxKind.ExtendsKeyword) { - kind = 'extends'; - } else if (hc.token === ts.SyntaxKind.ImplementsKeyword) { - kind = 'implements'; - } else { - throw new Error('Unknown heritageClause'); - } - interfaceObj[kind] = hc.types.map(c => parseType(c)); - }); - } - setIn(data, [name, 'interface'], interfaceObj); - } - - push(interfaceObj); - aliases.push({}); - - ts.forEachChild(node, visit); - - if (!ignore) { - typeParams.pop(); - } - - aliases.pop(); - pop(); - } - - function ensureGroup(node) { - var trivia = ts.getLeadingCommentRangesOfNode(node, source); - if (trivia && trivia.length) { - trivia.forEach(range => { - if (range.kind === ts.SyntaxKind.SingleLineCommentTrivia) { - pushIn(data, ['groups'], { - title: source.text.substring(range.pos + 3, range.end) - }); - } - }) - } - if (!data.groups || data.groups.length === 0) { - pushIn(data, ['groups'], {}); - } - } - - function visitPropertySignature(node) { - var comment = getDoc(node); - var name = ts.getTextOfNode(node.name); - if (!shouldIgnore(comment) && !isAliased(name)) { - addAliases(comment, name); - - ensureGroup(node); - - var propertyObj = { - line: getLineNum(node), - // name: name // redundant - }; - - var comment = getDoc(node); - if (comment) { - setIn(last(data.groups), ['members', '#'+name, 'doc'], comment); - } - - setIn(last(data.groups), ['members', '#'+name], propertyObj); - - if (node.questionToken) { - throw new Error('NYI: questionToken'); - } - - if (node.typeAnnotation) { - propertyObj.type = parseType(node.typeAnnotation.type); - } - } - - ts.forEachChild(node, visit); - } - - function visitMethodSignature(node) { - var comment = getDoc(node); - var name = ts.getTextOfNode(node.name); - if (!shouldIgnore(comment) && !isAliased(name)) { - addAliases(comment, name); - - ensureGroup(node); - - var comment = getDoc(node); - if (comment) { - setIn(last(data.groups), ['members', '#'+name, 'doc'], comment); - } - - var callSignature = parseCallSignature(node); - callSignature.line = getLineNum(node); - pushIn(last(data.groups), ['members', '#'+name, 'signatures'], callSignature); - - if (node.questionToken) { - throw new Error('NYI: questionToken'); - } - } - - ts.forEachChild(node, visit); - } - - function parseCallSignature(node) { - var callSignature = {}; - - if (node.typeParameters) { - callSignature.typeParams = node.typeParameters.map(tp => { - return tp.name.text; - }); - } - - typeParams.push(callSignature.typeParams); - - if (node.parameters.length) { - callSignature.params = - node.parameters.map(p => parseParam(p)); - } - - if (node.type) { - callSignature.type = parseType(node.type); - } - - typeParams.pop(); - - return callSignature; - } - - function parseType(node) { - switch (node.kind) { - case ts.SyntaxKind.AnyKeyword: - return { - k: TypeKind.Any - }; - case ts.SyntaxKind.ThisType: - return { - k: TypeKind.This - } - case ts.SyntaxKind.UndefinedKeyword: - return { - k: TypeKind.Undefined - } - case ts.SyntaxKind.BooleanKeyword: - return { - k: TypeKind.Boolean - }; - case ts.SyntaxKind.NumberKeyword: - return { - k: TypeKind.Number - }; - case ts.SyntaxKind.StringKeyword: - return { - k: TypeKind.String - }; - case ts.SyntaxKind.UnionType: - return { - k: TypeKind.Union, - types: node.types.map(parseType) - }; - case ts.SyntaxKind.TupleType: - return { - k: TypeKind.Tuple, - types: node.elementTypes.map(parseType) - }; - case ts.SyntaxKind.IndexedAccessType: - return { - k: TypeKind.Indexed, - type: parseType(node.objectType), - index: parseType(node.indexType), - }; - case ts.SyntaxKind.TypeOperator: - var operator = - node.operator === ts.SyntaxKind.KeyOfKeyword ? 'keyof' : - node.operator === ts.SyntaxKind.ReadonlyKeyword ? 'readonly' : - undefined; - if (!operator) { - throw new Error('Unknown operator kind: ' + ts.SyntaxKind[node.operator]); - } - return { - k: TypeKind.Operator, - operator, - type: parseType(node.type), - }; - case ts.SyntaxKind.TypeLiteral: - return { - k: TypeKind.Object, - members: node.members.map(m => { - switch (m.kind) { - case ts.SyntaxKind.IndexSignature: - return { - index: true, - params: m.parameters.map(p => parseParam(p)), - type: parseType(m.type) - } - case ts.SyntaxKind.PropertySignature: - return { - name: m.name.text, - type: m.type && parseType(m.type) - } - } - throw new Error('Unknown member kind: ' + ts.SyntaxKind[m.kind]); - }) - }; - case ts.SyntaxKind.ArrayType: - return { - k: TypeKind.Array, - type: parseType(node.elementType) - } - case ts.SyntaxKind.FunctionType: - return { - k: TypeKind.Function, - typeParams: node.typeParameters && node.typeParameters.map(parseType), - params: node.parameters.map(p => parseParam(p)), - type: parseType(node.type) - }; - case ts.SyntaxKind.TypeReference: - var name = getNameText(node.typeName); - if (isTypeParam(name)) { - return { - k: TypeKind.Param, - param: name - }; - } - return { - k: TypeKind.Type, - name: getNameText(node.typeName), - args: node.typeArguments && node.typeArguments.map(parseType), - }; - case ts.SyntaxKind.ExpressionWithTypeArguments: - return { - k: TypeKind.Type, - name: getNameText(node.expression), - args: node.typeArguments && node.typeArguments.map(parseType), - }; - case ts.SyntaxKind.QualifiedName: - var type = parseType(node.right); - type.qualifier = [node.left.text].concat(type.qualifier || []); - return type; - case ts.SyntaxKind.TypePredicate: - return { - k: TypeKind.Boolean - }; - } - throw new Error('Unknown type kind: ' + ts.SyntaxKind[node.kind]); - } - - function parseParam(node) { - var p = { - name: node.name.text, - type: parseType(node.type), - }; - if (node.dotDotDotToken) { - p.varArgs = true; - } - if (node.questionToken) { - p.optional = true; - } - if (node.initializer) { - throw new Error('NYI: equalsValueClause'); - } - return p; - } -} - -function getLineNum(node) { - var source = ts.getSourceFileOfNode(node); - return source.getLineAndCharacterOfPosition(node.getStart(source)).line; -} - -var COMMENT_NOTE_RX = /^@(\w+)\s*(.*)$/; - -var NOTE_BLACKLIST = { - override: true -}; - -function getDoc(node) { - var source = ts.getSourceFileOfNode(node); - var trivia = last(ts.getLeadingCommentRangesOfNode(node, source)); - if (!trivia || trivia.kind !== ts.SyntaxKind.MultiLineCommentTrivia) { - return; - } - - var lines = source.text - .substring(trivia.pos, trivia.end) - .split('\n') - .slice(1, -1) - .map(l => l.trim().substr(2)); - - var paragraphs = lines - .filter(l => l[0] !== '@') - .join('\n') - .split('\n\n'); - - var synopsis = paragraphs && paragraphs.shift(); - var description = paragraphs && paragraphs.join('\n\n'); - var notes = lines - .filter(l => l[0] === '@') - .map(l => l.match(COMMENT_NOTE_RX)) - .map(n => ({ name: n[1], body: n[2] })) - .filter(note => !NOTE_BLACKLIST[note.name]); - - return { - synopsis, - description, - notes - }; -} - -function getNameText(node) { - try { - return ts.entityNameToString(node); - } catch (e) { - console.log('Has no name.'); - console.log(node); - throw e; - } -} - -function last(list) { - return list && list[list.length - 1]; -} - -function pushIn(obj, path, value) { - for (var ii = 0; ii < path.length; ii++) { - obj = obj[path[ii]] || (obj[path[ii]] = (ii === path.length - 1 ? [] : {})); - } - obj.push(value); -} - -function setIn(obj, path, value) { - for (var ii = 0; ii < path.length - 1; ii++) { - obj = obj[path[ii]] || (obj[path[ii]] = {}); - } - obj[path[path.length - 1]] = value; -} - -function shouldIgnore(comment) { - return Boolean(comment && comment.notes && comment.notes.find( - note => note.name === 'ignore' || note.name === 'deprecated' - )); -} diff --git a/pages/lib/getTypeDefs.js b/pages/lib/getTypeDefs.js deleted file mode 100644 index dcbee0db4e..0000000000 --- a/pages/lib/getTypeDefs.js +++ /dev/null @@ -1,5 +0,0 @@ -var markdownDocs = require('./markdownDocs'); -var defs = require('../resources/immutable.d.json'); -markdownDocs(defs); - -module.exports = defs; diff --git a/pages/lib/markdown.js b/pages/lib/markdown.js deleted file mode 100644 index ee02566c56..0000000000 --- a/pages/lib/markdown.js +++ /dev/null @@ -1,165 +0,0 @@ -var { Seq } = require('../../'); -var marked = require('marked'); -var prism = require('./prism'); -var collectMemberGroups = require('./collectMemberGroups'); -// Note: intentionally using raw defs, not getTypeDefs to avoid circular ref. -var defs = require('../resources/immutable.d.json'); - - -function collectAllMembersForAllTypes(defs) { - var allMembers = new WeakMap(); - _collectAllMembersForAllTypes(defs); - return allMembers; - function _collectAllMembersForAllTypes(defs) { - - Seq(defs).forEach((def, name) => { - if (def.interface) { - var groups = collectMemberGroups(def.interface, { showInherited: true }); - allMembers.set( - def.interface, - Seq.Keyed(groups[''].map( - member => [member.memberName, member.memberDef] - )).toObject() - ); - } - if (def.module) { - _collectAllMembersForAllTypes(def.module); - } - }); - return allMembers; - } -} - -var allMembers = collectAllMembersForAllTypes(defs); - -// functions come before keywords -prism.languages.insertBefore('javascript', 'keyword', { - 'var': /\b(this)\b/g, - 'block-keyword': /\b(if|else|while|for|function)\b/g, - 'primitive': /\b(true|false|null|undefined)\b/g, - 'function': prism.languages.function, -}); - -prism.languages.insertBefore('javascript', { - 'qualifier': /\b[A-Z][a-z0-9_]+/g, -}); - -marked.setOptions({ - xhtml: true, - highlight: code => prism.highlight(code, prism.languages.javascript) -}); - -var renderer = new marked.Renderer(); - -renderer.code = function(code, lang, escaped) { - if (this.options.highlight) { - var out = this.options.highlight(code, lang); - if (out != null && out !== code) { - escaped = true; - code = out; - } - } - return '' + - (escaped ? code : escapeCode(code, true)) + - ''; -}; - -var METHOD_RX = /^(\w+)(?:[#.](\w+))?(?:\(\))?$/; -var PARAM_RX = /^\w+$/; -var MDN_TYPES = { - 'Array': true, - 'Object': true, - 'JSON': true, -}; -var MDN_BASE_URL = - 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/'; - -renderer.codespan = function(text) { - return '' + decorateCodeSpan(text, this.options) + ''; -}; - -function decorateCodeSpan(text, options) { - var context = options.context; - - if (context.signatures && - PARAM_RX.test(text) && - context.signatures.some(sig => - sig.params && sig.params.some(param => param.name === text))) { - return '' + text + ''; - } - - var method = METHOD_RX.exec(text); - if (method) { - method = method.slice(1).filter(function(x){return !!x}); - if (MDN_TYPES[method[0]]) { - return '
'+text+''; - } - if (context.typePath && - !arrEndsWith(context.typePath, method) && - !arrEndsWith(context.typePath.slice(0, -1), method)) { - var path = findPath(context, method); - if (path) { - var relPath = context.relPath || ''; - return ''+text+''; - } - } - } - - if (options.highlight) { - return options.highlight(unescapeCode(text), prism.languages.javascript); - } - - return text; -} - -function arrEndsWith(arr1, arr2) { - for (var ii = 1; ii <= arr2.length; ii++) { - if (arr2[arr2.length - ii] !== arr1[arr1.length - ii]) { - return false; - } - } - return true; -} - -function findPath(context, search) { - var relative = context.typePath; - - for (var ii = 0; ii <= relative.length; ii++) { - var path = relative.slice(0, relative.length - ii).concat(search); - if (path.reduce( - (def, name) => def && ( - (def.module && def.module[name]) || - (def.interface && allMembers && allMembers.get(def.interface)[name]) || - undefined - ), - {module: defs} - )) { - return path; - } - } -} - -function escapeCode(code) { - return code - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -} - -function unescapeCode(code) { - return code - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(/"/g, '"') - .replace(/'/g, '\'') - .replace(/&/g, '&'); -} - -function markdown(content, context) { - context || (context = {}); - return content ? marked(content, { renderer, context }) : content; -} - -module.exports = markdown; diff --git a/pages/lib/markdownDocs.js b/pages/lib/markdownDocs.js deleted file mode 100644 index 7482250f82..0000000000 --- a/pages/lib/markdownDocs.js +++ /dev/null @@ -1,50 +0,0 @@ -var { Seq } = require('../../'); -var markdown = require('./markdown'); - - -function markdownDocs(defs) { - markdownTypes(defs, []); - - function markdownTypes(typeDefs, path) { - Seq(typeDefs).forEach((typeDef, typeName) => { - var typePath = path.concat(typeName); - markdownDoc( - typeDef.doc, - { typePath } - ); - typeDef.call && markdownDoc( - typeDef.call.doc, - { typePath, - signatures: typeDef.call.signatures } - ); - if (typeDef.interface) { - markdownDoc(typeDef.interface.doc, { defs, typePath }); - Seq(typeDef.interface.groups).forEach(group => - Seq(group.members).forEach((member, memberName) => - markdownDoc( - member.doc, - { typePath: typePath.concat(memberName.slice(1)), - signatures: member.signatures } - ) - ) - ); - } - typeDef.module && markdownTypes(typeDef.module, typePath); - }); - } -} - -function markdownDoc(doc, context) { - if (!doc) { - return; - } - doc.synopsis && (doc.synopsis = markdown(doc.synopsis, context)); - doc.description && (doc.description = markdown(doc.description, context)); - doc.notes && doc.notes.forEach(note => { - if (note.name !== 'alias') { - note.body = markdown(note.body, context); - } - }); -} - -module.exports = markdownDocs; diff --git a/pages/lib/prism.js b/pages/lib/prism.js deleted file mode 100644 index ae123e914d..0000000000 --- a/pages/lib/prism.js +++ /dev/null @@ -1,661 +0,0 @@ -/* ********************************************** - Begin prism-core.js -********************************************** */ - -self = (typeof window !== 'undefined') - ? window // if in browser - : ( - (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) - ? self // if in worker - : {} // if in node js - ); - -/** - * Prism: Lightweight, robust, elegant syntax highlighting - * MIT license http://www.opensource.org/licenses/mit-license.php/ - * @author Lea Verou http://lea.verou.me - */ - -var Prism = (function(){ - -// Private helper vars -var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; - -var _ = self.Prism = { - util: { - encode: function (tokens) { - if (tokens instanceof Token) { - return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); - } else if (_.util.type(tokens) === 'Array') { - return tokens.map(_.util.encode); - } else { - return tokens.replace(/&/g, '&').replace(/ text.length) { - // Something went terribly wrong, ABORT, ABORT! - break tokenloop; - } - - if (str instanceof Token) { - continue; - } - - pattern.lastIndex = 0; - - var match = pattern.exec(str); - - if (match) { - if(lookbehind) { - lookbehindLength = match[1].length; - } - - var from = match.index - 1 + lookbehindLength, - match = match[0].slice(lookbehindLength), - len = match.length, - to = from + len, - before = str.slice(0, from + 1), - after = str.slice(to + 1); - - var args = [i, 1]; - - if (before) { - args.push(before); - } - - var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias); - - args.push(wrapped); - - if (after) { - args.push(after); - } - - Array.prototype.splice.apply(strarr, args); - } - } - } - } - - return strarr; - }, - - hooks: { - all: {}, - - add: function (name, callback) { - var hooks = _.hooks.all; - - hooks[name] = hooks[name] || []; - - hooks[name].push(callback); - }, - - run: function (name, env) { - var callbacks = _.hooks.all[name]; - - if (!callbacks || !callbacks.length) { - return; - } - - for (var i=0, callback; callback = callbacks[i++];) { - callback(env); - } - } - } -}; - -var Token = _.Token = function(type, content, alias) { - this.type = type; - this.content = content; - this.alias = alias; -}; - -Token.stringify = function(o, language, parent) { - if (typeof o == 'string') { - return o; - } - - if (Object.prototype.toString.call(o) == '[object Array]') { - return o.map(function(element) { - return Token.stringify(element, language, o); - }).join(''); - } - - var env = { - type: o.type, - content: Token.stringify(o.content, language, parent), - tag: 'span', - classes: ['token', o.type], - attributes: {}, - language: language, - parent: parent - }; - - if (env.type == 'comment') { - env.attributes['spellcheck'] = 'true'; - } - - if (o.alias) { - var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; - Array.prototype.push.apply(env.classes, aliases); - } - - _.hooks.run('wrap', env); - - var attributes = ''; - - for (var name in env.attributes) { - attributes += name + '="' + (env.attributes[name] || '') + '"'; - } - - return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + ''; - -}; - -if (!self.document) { - if (!self.addEventListener) { - // in Node.js - return self.Prism; - } - // In worker - self.addEventListener('message', function(evt) { - var message = JSON.parse(evt.data), - lang = message.language, - code = message.code; - - self.postMessage(JSON.stringify(_.util.encode(_.tokenize(code, _.languages[lang])))); - self.close(); - }, false); - - return self.Prism; -} - -// Get current script and highlight -var script = document.getElementsByTagName('script'); - -script = script[script.length - 1]; - -if (script) { - _.filename = script.src; - - if (document.addEventListener && !script.hasAttribute('data-manual')) { - document.addEventListener('DOMContentLoaded', _.highlightAll); - } -} - -return self.Prism; - -})(); - -if (typeof module !== 'undefined' && module.exports) { - module.exports = Prism; -} - - -/* ********************************************** - Begin prism-markup.js -********************************************** */ - -Prism.languages.markup = { - 'comment': //g, - 'prolog': /<\?.+?\?>/, - 'doctype': //, - 'cdata': //i, - 'tag': { - pattern: /<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|[^\s'">=]+))?\s*)*\/?>/gi, - inside: { - 'tag': { - pattern: /^<\/?[\w:-]+/i, - inside: { - 'punctuation': /^<\/?/, - 'namespace': /^[\w-]+?:/ - } - }, - 'attr-value': { - pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi, - inside: { - 'punctuation': /=|>|"/g - } - }, - 'punctuation': /\/?>/g, - 'attr-name': { - pattern: /[\w:-]+/g, - inside: { - 'namespace': /^[\w-]+?:/ - } - } - - } - }, - 'entity': /\&#?[\da-z]{1,8};/gi -}; - -// Plugin to make entity title show the real entity, idea by Roman Komarov -Prism.hooks.add('wrap', function(env) { - - if (env.type === 'entity') { - env.attributes['title'] = env.content.replace(/&/, '&'); - } -}); - - -/* ********************************************** - Begin prism-css.js -********************************************** */ - -Prism.languages.css = { - 'comment': /\/\*[\w\W]*?\*\//g, - 'atrule': { - pattern: /@[\w-]+?.*?(;|(?=\s*{))/gi, - inside: { - 'punctuation': /[;:]/g - } - }, - 'url': /url\((["']?).*?\1\)/gi, - 'selector': /[^\{\}\s][^\{\};]*(?=\s*\{)/g, - 'property': /(\b|\B)[\w-]+(?=\s*:)/ig, - 'string': /("|')(\\?.)*?\1/g, - 'important': /\B!important\b/gi, - 'punctuation': /[\{\};:]/g, - 'function': /[-a-z0-9]+(?=\()/ig -}; - -if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'style': { - pattern: /[\w\W]*?<\/style>/ig, - inside: { - 'tag': { - pattern: /|<\/style>/ig, - inside: Prism.languages.markup.tag.inside - }, - rest: Prism.languages.css - }, - alias: 'language-css' - } - }); - - Prism.languages.insertBefore('inside', 'attr-value', { - 'style-attr': { - pattern: /\s*style=("|').+?\1/ig, - inside: { - 'attr-name': { - pattern: /^\s*style/ig, - inside: Prism.languages.markup.tag.inside - }, - 'punctuation': /^\s*=\s*['"]|['"]\s*$/, - 'attr-value': { - pattern: /.+/gi, - inside: Prism.languages.css - } - }, - alias: 'language-css' - } - }, Prism.languages.markup.tag); -} - -/* ********************************************** - Begin prism-clike.js -********************************************** */ - -Prism.languages.clike = { - 'comment': [ - { - pattern: /(^|[^\\])\/\*[\w\W]*?\*\//g, - lookbehind: true - }, - { - pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/g, - lookbehind: true - } - ], - 'string': /("|')(\\?.)*?\1/g, - 'class-name': { - pattern: /((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig, - lookbehind: true, - inside: { - punctuation: /(\.|\\)/ - } - }, - 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g, - 'boolean': /\b(true|false)\b/g, - 'function': { - pattern: /[a-z0-9_]+\(/ig, - inside: { - punctuation: /\(/ - } - }, - 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g, - 'operator': /[-+]{1,2}|!|<=?|>=?|={1,3}|&{1,2}|\|?\||\?|\*|\/|\~|\^|\%/g, - 'ignore': /&(lt|gt|amp);/gi, - 'punctuation': /[{}[\];(),.:]/g -}; - - -/* ********************************************** - Begin prism-javascript.js -********************************************** */ - -Prism.languages.javascript = Prism.languages.extend('clike', { - 'keyword': /\b(break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|get|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|set|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/g, - 'number': /\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g -}); - -Prism.languages.insertBefore('javascript', 'keyword', { - 'regex': { - pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g, - lookbehind: true - } -}); - -if (Prism.languages.markup) { - Prism.languages.insertBefore('markup', 'tag', { - 'script': { - pattern: /[\w\W]*?<\/script>/ig, - inside: { - 'tag': { - pattern: /|<\/script>/ig, - inside: Prism.languages.markup.tag.inside - }, - rest: Prism.languages.javascript - }, - alias: 'language-javascript' - } - }); -} - - -/* ********************************************** - Begin prism-file-highlight.js -********************************************** */ - -(function(){ - -if (!self.Prism || !self.document || !document.querySelector) { - return; -} - -var Extensions = { - 'js': 'javascript', - 'html': 'markup', - 'svg': 'markup', - 'xml': 'markup', - 'py': 'python', - 'rb': 'ruby' -}; - -Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach(function(pre) { - var src = pre.getAttribute('data-src'); - var extension = (src.match(/\.(\w+)$/) || [,''])[1]; - var language = Extensions[extension] || extension; - - var code = document.createElement('code'); - code.className = 'language-' + language; - - pre.textContent = ''; - - code.textContent = 'Loading…'; - - pre.appendChild(code); - - var xhr = new XMLHttpRequest(); - - xhr.open('GET', src, true); - - xhr.onreadystatechange = function() { - if (xhr.readyState == 4) { - - if (xhr.status < 400 && xhr.responseText) { - code.textContent = xhr.responseText; - - Prism.highlightElement(code); - } - else if (xhr.status >= 400) { - code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText; - } - else { - code.textContent = '✖ Error: File does not exist or is empty'; - } - } - }; - - xhr.send(null); -}); - -})(); diff --git a/pages/resources/identity.ai b/pages/resources/identity.ai deleted file mode 100644 index 44a1d29661..0000000000 --- a/pages/resources/identity.ai +++ /dev/null @@ -1,2208 +0,0 @@ -%PDF-1.5 % -1 0 obj <>/OCGs[5 0 R 6 0 R]>>/Pages 3 0 R/Type/Catalog>> endobj 2 0 obj <>stream - - - - - application/pdf - - - identity - - - Adobe Illustrator CC 2014 (Macintosh) - 2014-10-30T16:19:54-07:00 - 2014-10-30T16:19:54-07:00 - 2014-10-30T16:19:54-07:00 - - - - 256 - 108 - JPEG - /9j/4AAQSkZJRgABAgEASABIAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA AQBIAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgAbAEAAwER AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE 1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp 0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo +DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A7vhYuxV2KuxV2KuxV2Ku xV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux V2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV 2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2 KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2K uxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Ku xV2KuxV2KuxV2KuxV2KuxV2KpJrfnXytoV2lpq2oR2ly8YlSNw5JQkqG+EHupwgFICm3n7ycl9BY PqkK3dwImhjbkOQnUPEakU+JWBG+NJ4Smup6np+l2Mt9qE621pCAZZnNFFTQfeTTAgBJT+Y3kkWC X51aIWbytAk1HoZEVXZfs12V1OGinh93zCeafqFlqNlDe2My3FpOvOGZDVWGBBFJF/ysjyOZZ4hq 8Je2DGYDmQAhoxqFoae2Giy4Cr2fnryle2F5qFrqUctnYBTeTAPSMPULWq13p2xpHChB+Z/kIwmb 9Mw+mGCFqSfaIJA+z7Y0V4dr2+YWr+af5fswUa1CSTQDjJ3/ANjjwleH3fMJlrPnLyxot5FZ6rqE VpczKHjiflUqWKhtgQBVT1xooAtGavrOmaPYtfancLbWiFVaV6kAsaAbAnrgUC0ntPzK8iXUoih1 u25nYCRjGCT7yBRhorXu+aM1zzl5Y0KaKHVtQjtJZl9SJXDHktaV+EHviAnhRN15g0a10VdbuLpY 9KaOOVbohuPCYqI2oBX4uY7Y0ikmj/NHyBLIsaazCzuQqikm5JoP2caKRH3fMMpwMXYq7FXYq7FX Yq7FXYq7FXYq7FXYq7FXYq7FXYq7FXz7/wA5BD/ncrX/ALZkX/UTNl2Pl8WEuvu/SxbzmUGqoWFR +jdLFabj/Qodxgj0ckkVK/L7yreaPzC1zX9G0zTL9h6WnL+9etTczCoSR6/yx0+kk99pRj3NRlW5 /t/Z1WXlF8kWgAFBrt5QU2oLe27ZEf71tmAMkh/tn61TQvzC13R/LN/oVm/G3vt4p6nlbcv74J/r r08Oo3wmO+7UDtt/Z3/sSbSmU/XKDiv1GYDx+1398JH3s4kHly4D97MPJ4A/LrzxTb9xYfjXIdR7 /wBLKYA/0v8AvAhfJ/lfSNZ8u+Zbi9nlgk0uNLmzWFlUNIIJSA/JWqKqOlMkL5sMsgJcPK5foCh+ WXljSfMutS2mr3M8EEFsbhGhdVJkWVVAbmsgpRvDJEHoGuWSogyP4soHz15gXX/Neo6iG5W88pit W8IIv3cbb9OVORyMRQZ2OR67ft/033PQ/MXmL9O/kXFcyNW6t5YLS7rufVhcLU17svFj88jEVJEj 6SfxzeS3JtxzXifUV5vUJdWXiR+6CIByUqQamvh9JjyHwb8+05A8rl3edUPJlPnhzJpXlEvcLdH9 DN+9B5D4WkATfvHTifcYjr7x97EAGv6sv9w9L83/APkgoP8Atm6X/wATt8Y/W4x+l4/ocnlyPUOO qxXskv1pfq/1SeGONV5inJHjkJ38CMRfD8HKyishF/x7cq57bW+r8qaHYq7FXYq7FXYq7FXYq7FX Yq7FXYq7FXYq7FXYq7FXhf56aHrN/wCbbaWxsZ7qL9HRxmSKNnUMJ5WIJA60OX4gSGucwLsjcd47 2OeZ/LOvT65bD9GXMkDWWmRyMsT8R6dpCsgJA2oQQcYwLbLNAWCRvXUd6/V/ywv7Gy1OaJXvPTkR NLhiq7mNmDO7KvdR8P3nwy84yHBjqozoX069PJTuvLvmF/Jdqg0u69UaxdzND6T8wjwW/FiKdCVI ykQPLyc2eeJkZWN53zCK0n8rrq7j0i4nD2sMqt+lrd6rIDG7cOKn+daD265fHETTgz1UY2B5e4/2 FLfKvknX7u9ntbmyuLOOWznQTyxsqB+JZKkjoWoMqMCT8XJGeMYncfTXMd6GTT/PGm2uoaQlnexw X4ijvYYrf1klEBqnGUBqU/yDv3wGBB5MxljIXZ5Dly5V8NnoPkXydfWXkjzHJfq8d/qEDm3s1oWH CGQRqaV+Ji/TCRKPLqGk5IZJ2T9Mr/HyYZ5X0jzPptrrDrpN6LqawNtahYXqZJZkBPT9mPkfmMdw eXNncJAbi4+Y57/rUtL/AC+80XlpK6Wj2qsPRkiuJPRZ1Uq9eJjOxYA9euIxz/H9qZ6nANjfL+cP +JNfNVstL83p5X1rSjo16LS8a3uIy0MhAnhcKwBAAq6vU7fsjIiJBHe2TyRkJEHb3jnte6DbQ/Nc 9ulgmj3Bi+stcoZLf025uAtDMx2T22/oxhKqr8fJOXPi4zMG9yase/8AnH7r6Jv5p8k67Yaf5dtE tZrxo7Gb6y9sjSqkk8sj8BTb4eYB3wGMiTt1CMebGKs7VLu6iupCIml/M+88pXeiXllevpMVnBHa xPZCL+5uIBGFdV5NRFPfBEerzTk4eHY7VzND/fFJdO07zfYzlrXSJmMswkpPYJKQSezyK5H0ZIRk BVfj5Lky4pSMhLnK+YHP3T/Q+osx0OxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KpDr0cjX iFVJHpj/AIk2Z2lIEfi6rXRJmPchryGQ3KfCePCOv/ACuWY5Cvm1ZoHiHuH3KbWtFcjc7cB9OSE2 Bxc17Qy/o9BxNfWY0/2K4OIcfwZGB8Mf1v0BatrXgTt/OMJmxGLk61t5CzhgVBRt8ZyC4sZ39y1B eRxyRorem9PUoKg06b4TwkglA4wCByKNsLRTZzmQkOBVVHiAaZTln6hTk4MXoNoW1hlCyngxfj8A HjUDLJyGzRigaO26mltMVPRa7EHJGYYDHJWiS5FlPGY29NipBptyB/pkZGPEDbZES4CK2UPTnKBO GwNa5OxdtfDKqpEXltIkFqq/HRCSR0qWJpleOYJLbmxkRiPJUL6k9k8UqH0AihPhp0Zab/LI1ASs c2d5TAgj01+pCwrcIwATuDuK5bIgtEBIdGWZqnfOxV2KuxV2KuxV2KuxV2KuxV2KuxV2KuxV2Kux V2KpbqUbtOpVSRxHT5nMnCRTh6iJMvgpTwyGZfhJHFK/8CMlGQprnA38mntSquR8X8gxE1OKrcYp fqqjia8yafQMeIcS8J4Pi2trXgTt/OMTNRi5LYIJCzAqQCp3wykEQgVoW5RXQK3FvtUFQae+G4nd FSFhFWtuRby8vtEVA+g5VOe4b8WP0lQgimUSURuRWi0HeuTkRs1QiRey1LaYg7UrsQcJmGIxyXIk 4t5EKHi1CDTuDgJFgsgJcJFLPTnKhOG1a9MlY5sOGVVSpcW8ixwqByopqR7muRjIWWzJjIAXVvGt 2jdT6YUBdvAimD03afWY0eSlGs6EAJ37iuSJBa4iQ6J1mG7J2KuxV2KuxV2KuxV2KuxV2KuxV2Ku xV2KuxV2KuxVQnVi4oCdsnEtcwbaZGLDY0oP1YQUEG22gIDEb/y4iSmC3g/pgUNa/wAMb3RRpcsF eJO38wxMkiC1I2JIIIqOuJKBEtcZRVaGh64bC0VWONljavUjpkSd2cY0FNFdQ3wmpFBhJDAAhywy EHt88TIKIlwV+DLxO+NhQDTXCQjjx2rXDYWiueNgFAFaDemAFJiXfvShUg0ptt747LvTSiQdF/DC aQAUTlTc7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FX Yq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXY q7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FWTf7hv+Xf8A4TAyd/uG/wCXf/hMVd/uG/5d/wDhMVd/ uG/5d/8AhMVd/uG/5d/+ExV3+4b/AJd/+ExV3+4b/l3/AOExV3+4b/l3/wCExV3+4b/l3/4TFXf7 hv8Al3/4TFXf7hv+Xf8A4TFXf7hv+Xf/AITFXf7hv+Xf/hMVd/uG/wCXf/hMVd/uG/5d/wDhMVd/ uG/5d/8AhMVd/uG/5d/+ExV3+4b/AJd/+ExV3+4b/l3/AOExV3+4b/l3/wCExV3+4b/l3/4TFXf7 hv8Al3/4TFXf7hv+Xf8A4TFXf7hv+Xf/AITFXf7hv+Xf/hMVd/uG/wCXf/hMVd/uG/5d/wDhMVd/ uG/5d/8AhMVd/uG/5d/+ExV3+4b/AJd/+ExV3+4b/l3/AOExV3+4b/l3/wCExV//2Q== - - - - proof:pdf - uuid:65E6390686CF11DBA6E2D887CEACB407 - xmp.did:5962c3f6-6a0f-4199-90f1-c6dea6f71387 - uuid:15bcb097-31e4-8d46-bdb6-d8c19fdf6524 - - uuid:1abccb90-0c26-4942-b156-fd2eb962e3e1 - xmp.did:58fdc1b8-1448-3a44-9e20-282d8ec1cf95 - uuid:65E6390686CF11DBA6E2D887CEACB407 - proof:pdf - - - - - saved - xmp.iid:5962c3f6-6a0f-4199-90f1-c6dea6f71387 - 2014-10-30T16:19:52-07:00 - Adobe Illustrator CC 2014 (Macintosh) - / - - - - Web - Document - 1 - True - False - - 960.000000 - 560.000000 - Pixels - - - - Cyan - Magenta - Yellow - Black - - - - - - Default Swatch Group - 0 - - - - White - RGB - PROCESS - 255 - 255 - 255 - - - Black - RGB - PROCESS - 0 - 0 - 0 - - - RGB Red - RGB - PROCESS - 255 - 0 - 0 - - - RGB Yellow - RGB - PROCESS - 255 - 255 - 0 - - - RGB Green - RGB - PROCESS - 0 - 255 - 0 - - - RGB Cyan - RGB - PROCESS - 0 - 255 - 255 - - - RGB Blue - RGB - PROCESS - 0 - 0 - 255 - - - RGB Magenta - RGB - PROCESS - 255 - 0 - 255 - - - R=193 G=39 B=45 - RGB - PROCESS - 193 - 39 - 45 - - - R=237 G=28 B=36 - RGB - PROCESS - 237 - 28 - 36 - - - R=241 G=90 B=36 - RGB - PROCESS - 241 - 90 - 36 - - - R=247 G=147 B=30 - RGB - PROCESS - 247 - 147 - 30 - - - R=251 G=176 B=59 - RGB - PROCESS - 251 - 176 - 59 - - - R=252 G=238 B=33 - RGB - PROCESS - 252 - 238 - 33 - - - R=217 G=224 B=33 - RGB - PROCESS - 217 - 224 - 33 - - - R=140 G=198 B=63 - RGB - PROCESS - 140 - 198 - 63 - - - R=57 G=181 B=74 - RGB - PROCESS - 57 - 181 - 74 - - - R=0 G=146 B=69 - RGB - PROCESS - 0 - 146 - 69 - - - R=0 G=104 B=55 - RGB - PROCESS - 0 - 104 - 55 - - - R=34 G=181 B=115 - RGB - PROCESS - 34 - 181 - 115 - - - R=0 G=169 B=157 - RGB - PROCESS - 0 - 169 - 157 - - - R=41 G=171 B=226 - RGB - PROCESS - 41 - 171 - 226 - - - R=0 G=113 B=188 - RGB - PROCESS - 0 - 113 - 188 - - - R=46 G=49 B=146 - RGB - PROCESS - 46 - 49 - 146 - - - R=27 G=20 B=100 - RGB - PROCESS - 27 - 20 - 100 - - - R=102 G=45 B=145 - RGB - PROCESS - 102 - 45 - 145 - - - R=147 G=39 B=143 - RGB - PROCESS - 147 - 39 - 143 - - - R=158 G=0 B=93 - RGB - PROCESS - 158 - 0 - 93 - - - R=212 G=20 B=90 - RGB - PROCESS - 212 - 20 - 90 - - - R=237 G=30 B=121 - RGB - PROCESS - 237 - 30 - 121 - - - R=199 G=178 B=153 - RGB - PROCESS - 199 - 178 - 153 - - - R=153 G=134 B=117 - RGB - PROCESS - 153 - 134 - 117 - - - R=115 G=99 B=87 - RGB - PROCESS - 115 - 99 - 87 - - - R=83 G=71 B=65 - RGB - PROCESS - 83 - 71 - 65 - - - R=198 G=156 B=109 - RGB - PROCESS - 198 - 156 - 109 - - - R=166 G=124 B=82 - RGB - PROCESS - 166 - 124 - 82 - - - R=140 G=98 B=57 - RGB - PROCESS - 140 - 98 - 57 - - - R=117 G=76 B=36 - RGB - PROCESS - 117 - 76 - 36 - - - R=96 G=56 B=19 - RGB - PROCESS - 96 - 56 - 19 - - - R=66 G=33 B=11 - RGB - PROCESS - 66 - 33 - 11 - - - - - - Grays - 1 - - - - R=0 G=0 B=0 - RGB - PROCESS - 0 - 0 - 0 - - - R=26 G=26 B=26 - RGB - PROCESS - 26 - 26 - 26 - - - R=51 G=51 B=51 - RGB - PROCESS - 51 - 51 - 51 - - - R=77 G=77 B=77 - RGB - PROCESS - 77 - 77 - 77 - - - R=102 G=102 B=102 - RGB - PROCESS - 102 - 102 - 102 - - - R=128 G=128 B=128 - RGB - PROCESS - 128 - 128 - 128 - - - R=153 G=153 B=153 - RGB - PROCESS - 153 - 153 - 153 - - - R=179 G=179 B=179 - RGB - PROCESS - 179 - 179 - 179 - - - R=204 G=204 B=204 - RGB - PROCESS - 204 - 204 - 204 - - - R=230 G=230 B=230 - RGB - PROCESS - 230 - 230 - 230 - - - R=242 G=242 B=242 - RGB - PROCESS - 242 - 242 - 242 - - - - - - Web Color Group - 1 - - - - R=63 G=169 B=245 - RGB - PROCESS - 63 - 169 - 245 - - - R=122 G=201 B=67 - RGB - PROCESS - 122 - 201 - 67 - - - R=255 G=147 B=30 - RGB - PROCESS - 255 - 147 - 30 - - - R=255 G=29 B=37 - RGB - PROCESS - 255 - 29 - 37 - - - R=255 G=123 B=172 - RGB - PROCESS - 255 - 123 - 172 - - - R=189 G=204 B=212 - RGB - PROCESS - 189 - 204 - 212 - - - - - - - Adobe PDF library 11.00 - - - - - - - - - - - - - - - - - - - - - - - - - endstream endobj 3 0 obj <> endobj 8 0 obj <>/Resources<>/ExtGState<>/Properties<>/XObject<>>>/Thumb 20 0 R/TrimBox[0.0 0.0 960.0 560.0]/Type/Page>> endobj 9 0 obj <>stream -HWˎGWTNWlcƮuAf֣[dRAdUV& ߞgg~zl.Ot8Rߜo7WӥlK&`)vJe_s=wkhs1Krބm)\_/|z9r ,>X Goc 4n}Sy06Uelm۫&~ؙcǰrqB!Mgpjm`s0|iFl #lk[XÜ IBaMoI}MU 5l]zYv,ܗyƭvZ@IR9qQTx4m^/xHsa#wFq^<ˎsUC{zެMx8aYcj=hCbiԉl?7 -̰ @fxi4uB̰8YMU/ff!UQRV 3xnEXܝ;%çw|61գx48ndqaa|6%U^0-~/B#t;6 ؊JjC͡`8q! -}*D^u&4@~E pvef YglDvE3gFłpF;*b44C6]'Z#Ġx^xl$9s|ʚbE^0HCkQ*AO -T*':iIVݷoHiUiU_@G!(V=+':i*GѪvҪVkhg緣U*ZV,6/`>]?nl+~ ۊ[&z,WOuVnl+b[ɝld['*u>!ۺ;d[RT߈PV#E`d_Vwpe< tz1_sҐ@+ ]rRM\fPI +[k5|:j[ǛleTiݩ3A$MT^~ԚdvuuuUჳht.[> endobj 20 0 obj <>stream -8;Z\u5n8N$$j;VR-9:UhT)'<$0@%\#iB&n#M&p=M`b5lXt>9a/<+@KdI>\';9_Ob?VVFp#qBr -6`>t+Opn?\"-,&u;UKhmW#jb?),s)kWS;mu=QT4(Es1c*Hs+$IogkoB7r@q*WQF\3 -W#eMkTStuRhFE':++9f0-UJ(^KFgHU\Km4:!!e-hiW~> endstream endobj 22 0 obj [/Indexed/DeviceRGB 255 23 0 R] endobj 23 0 obj <>stream -8;X]O>EqN@%''O_@%e@?J;%+8(9e>X=MR6S?i^YgA3=].HDXF.R$lIL@"pJ+EP(%0 -b]6ajmNZn*!='OQZeQ^Y*,=]?C.B+\Ulg9dhD*"iC[;*=3`oP1[!S^)?1)IZ4dup` -E1r!/,*0[*9.aFIR2&b-C#soRZ7Dl%MLY\.?d>Mn -6%Q2oYfNRF$$+ON<+]RUJmC0InDZ4OTs0S!saG>GGKUlQ*Q?45:CI&4J'_2j$XKrcYp0n+Xl_nU*O( -l[$6Nn+Z_Nq0]s7hs]`XX1nZ8&94a\~> endstream endobj 17 0 obj <>/ExtGState<>>>/Subtype/Form>>stream -/CS0 cs 0.427 0.737 0.859 scn -/GS0 gs -271.996 378.559 13.56 -40.02 re -f -q 1 0 0 1 289.6611 378.5591 cm -0 0 m -10.56 0 l -21 -15.36 l -31.38 0 l -41.94 0 l -41.94 -40.02 l -29.16 -40.02 l -29.16 -25.62 l -21 -37.62 l -12.78 -25.62 l -12.78 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 335.707 378.5591 cm -0 0 m -10.56 0 l -21 -15.36 l -31.38 0 l -41.94 0 l -41.94 -40.02 l -29.16 -40.02 l -29.16 -25.62 l -21 -37.62 l -12.78 -25.62 l -12.78 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 397.1504 337.519 cm -0 0 m --2.52 0 -4.8 0.321 -6.84 0.96 c --8.88 1.6 -10.62 2.56 -12.06 3.84 c --13.5 5.12 -14.61 6.74 -15.39 8.7 c --16.17 10.659 -16.56 12.96 -16.56 15.6 c --16.56 41.04 l --3.78 41.04 l --3.78 16.14 l --3.78 14.739 -3.49 13.67 -2.91 12.93 c --2.331 12.189 -1.36 11.82 0 11.82 c -1.359 11.82 2.33 12.189 2.91 12.93 c -3.489 13.67 3.78 14.739 3.78 16.14 c -3.78 41.04 l -16.62 41.04 l -16.62 15.6 l -16.62 12.96 16.23 10.659 15.45 8.7 c -14.67 6.74 13.55 5.12 12.09 3.84 c -10.629 2.56 8.88 1.6 6.84 0.96 c -4.8 0.321 2.52 0 0 0 c -f -Q -q 1 0 0 1 423.2202 368.0591 cm -0 0 m --7.38 0 l --7.38 10.5 l -20.58 10.5 l -20.58 0 l -13.2 0 l -13.2 -29.52 l -0 -29.52 l -h -f -Q -q 1 0 0 1 460.8916 350.959 cm -0 0 m --2.7 7.02 l --5.4 0 l -h --7.5 27.6 m -2.1 27.6 l -17.28 -12.42 l -4.68 -12.42 l -3.36 -8.82 l --8.76 -8.82 l --10.08 -12.42 l --22.68 -12.42 l -h -f -Q -q 1 0 0 1 493.0215 347.959 cm -0 0 m -3.039 0 4.56 1.16 4.56 3.48 c -4.56 5.799 3.039 6.96 0 6.96 c --1.44 6.96 l --1.44 0 l -h -3 18.42 m -3 20.259 1.999 21.18 0 21.18 c --1.44 21.18 l --1.44 15.66 l -0 15.66 l -1.999 15.66 3 16.58 3 18.42 c --13.801 30.6 m -1.859 30.6 l -3.859 30.6 5.689 30.37 7.35 29.91 c -9.009 29.45 10.43 28.77 11.609 27.87 c -12.789 26.97 13.71 25.85 14.369 24.51 c -15.029 23.169 15.359 21.6 15.359 19.8 c -15.359 18.52 15.199 17.43 14.88 16.53 c -14.559 15.63 14.22 14.88 13.859 14.28 c -13.419 13.56 12.919 12.96 12.359 12.48 c -13.239 11.919 14.04 11.199 14.76 10.32 c -15.359 9.56 15.909 8.6 16.409 7.44 c -16.909 6.279 17.159 4.86 17.159 3.18 c -17.159 1.26 16.819 -0.48 16.14 -2.04 c -15.459 -3.6 14.489 -4.93 13.229 -6.03 c -11.97 -7.13 10.43 -7.971 8.609 -8.55 c -6.789 -9.13 4.76 -9.42 2.52 -9.42 c --13.801 -9.42 l -h -f -Q -q 1 0 0 1 513.6592 378.5591 cm -0 0 m -13.32 0 l -13.32 -29.52 l -24.36 -29.52 l -24.36 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 539.9697 378.5591 cm -0 0 m -23.58 0 l -23.58 -10.5 l -12.78 -10.5 l -12.78 -14.94 l -23.4 -14.94 l -23.4 -24.9 l -12.78 -24.9 l -12.78 -29.52 l -24 -29.52 l -24 -40.02 l -0 -40.02 l -h -f -Q - endstream endobj 18 0 obj <>/ExtGState<>>>/Subtype/Form>>stream -/CS0 cs 0.427 0.737 0.859 scn -/GS0 gs -271.996 398.559 13.56 -40.02 re -f -q 1 0 0 1 289.6611 398.5591 cm -0 0 m -10.56 0 l -21 -15.36 l -31.38 0 l -41.94 0 l -41.94 -40.02 l -29.16 -40.02 l -29.16 -25.62 l -21 -37.62 l -12.78 -25.62 l -12.78 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 335.707 398.5591 cm -0 0 m -10.56 0 l -21 -15.36 l -31.38 0 l -41.94 0 l -41.94 -40.02 l -29.16 -40.02 l -29.16 -25.62 l -21 -37.62 l -12.78 -25.62 l -12.78 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 397.1504 357.519 cm -0 0 m --2.52 0 -4.8 0.321 -6.84 0.96 c --8.88 1.6 -10.62 2.56 -12.06 3.84 c --13.5 5.12 -14.61 6.74 -15.39 8.7 c --16.17 10.659 -16.56 12.96 -16.56 15.6 c --16.56 41.04 l --3.78 41.04 l --3.78 16.14 l --3.78 14.739 -3.49 13.67 -2.91 12.93 c --2.331 12.189 -1.36 11.82 0 11.82 c -1.359 11.82 2.33 12.189 2.91 12.93 c -3.489 13.67 3.78 14.739 3.78 16.14 c -3.78 41.04 l -16.62 41.04 l -16.62 15.6 l -16.62 12.96 16.23 10.659 15.45 8.7 c -14.67 6.74 13.55 5.12 12.09 3.84 c -10.629 2.56 8.88 1.6 6.84 0.96 c -4.8 0.321 2.52 0 0 0 c -f -Q -q 1 0 0 1 423.2202 388.0591 cm -0 0 m --7.38 0 l --7.38 10.5 l -20.58 10.5 l -20.58 0 l -13.2 0 l -13.2 -29.52 l -0 -29.52 l -h -f -Q -q 1 0 0 1 460.8916 370.959 cm -0 0 m --2.7 7.02 l --5.4 0 l -h --7.5 27.6 m -2.1 27.6 l -17.28 -12.42 l -4.68 -12.42 l -3.36 -8.82 l --8.76 -8.82 l --10.08 -12.42 l --22.68 -12.42 l -h -f -Q -q 1 0 0 1 493.0215 367.959 cm -0 0 m -3.039 0 4.56 1.16 4.56 3.48 c -4.56 5.799 3.039 6.96 0 6.96 c --1.44 6.96 l --1.44 0 l -h -3 18.42 m -3 20.259 1.999 21.18 0 21.18 c --1.44 21.18 l --1.44 15.66 l -0 15.66 l -1.999 15.66 3 16.58 3 18.42 c --13.801 30.6 m -1.859 30.6 l -3.859 30.6 5.689 30.37 7.35 29.91 c -9.009 29.45 10.43 28.77 11.609 27.87 c -12.789 26.97 13.71 25.85 14.369 24.51 c -15.029 23.169 15.359 21.6 15.359 19.8 c -15.359 18.52 15.199 17.43 14.88 16.53 c -14.559 15.63 14.22 14.88 13.859 14.28 c -13.419 13.56 12.919 12.96 12.359 12.48 c -13.239 11.919 14.04 11.199 14.76 10.32 c -15.359 9.56 15.909 8.6 16.409 7.44 c -16.909 6.279 17.159 4.86 17.159 3.18 c -17.159 1.26 16.819 -0.48 16.14 -2.04 c -15.459 -3.6 14.489 -4.93 13.229 -6.03 c -11.97 -7.13 10.43 -7.971 8.609 -8.55 c -6.789 -9.13 4.76 -9.42 2.52 -9.42 c --13.801 -9.42 l -h -f -Q -q 1 0 0 1 513.6592 398.5591 cm -0 0 m -13.32 0 l -13.32 -29.52 l -24.36 -29.52 l -24.36 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 539.9697 398.5591 cm -0 0 m -23.58 0 l -23.58 -10.5 l -12.78 -10.5 l -12.78 -14.94 l -23.4 -14.94 l -23.4 -24.9 l -12.78 -24.9 l -12.78 -29.52 l -24 -29.52 l -24 -40.02 l -0 -40.02 l -h -f -Q - endstream endobj 19 0 obj <>/ExtGState<>>>/Subtype/Form>>stream -/CS0 cs 0.427 0.737 0.859 scn -/GS0 gs -271.996 418.559 13.56 -40.02 re -f -q 1 0 0 1 289.6611 418.5591 cm -0 0 m -10.56 0 l -21 -15.36 l -31.38 0 l -41.94 0 l -41.94 -40.02 l -29.16 -40.02 l -29.16 -25.62 l -21 -37.62 l -12.78 -25.62 l -12.78 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 335.707 418.5591 cm -0 0 m -10.56 0 l -21 -15.36 l -31.38 0 l -41.94 0 l -41.94 -40.02 l -29.16 -40.02 l -29.16 -25.62 l -21 -37.62 l -12.78 -25.62 l -12.78 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 397.1504 377.519 cm -0 0 m --2.52 0 -4.8 0.321 -6.84 0.96 c --8.88 1.6 -10.62 2.56 -12.06 3.84 c --13.5 5.12 -14.61 6.74 -15.39 8.7 c --16.17 10.659 -16.56 12.96 -16.56 15.6 c --16.56 41.04 l --3.78 41.04 l --3.78 16.14 l --3.78 14.739 -3.49 13.67 -2.91 12.93 c --2.331 12.189 -1.36 11.82 0 11.82 c -1.359 11.82 2.33 12.189 2.91 12.93 c -3.489 13.67 3.78 14.739 3.78 16.14 c -3.78 41.04 l -16.62 41.04 l -16.62 15.6 l -16.62 12.96 16.23 10.659 15.45 8.7 c -14.67 6.74 13.55 5.12 12.09 3.84 c -10.629 2.56 8.88 1.6 6.84 0.96 c -4.8 0.321 2.52 0 0 0 c -f -Q -q 1 0 0 1 423.2202 408.0591 cm -0 0 m --7.38 0 l --7.38 10.5 l -20.58 10.5 l -20.58 0 l -13.2 0 l -13.2 -29.52 l -0 -29.52 l -h -f -Q -q 1 0 0 1 460.8916 390.959 cm -0 0 m --2.7 7.02 l --5.4 0 l -h --7.5 27.6 m -2.1 27.6 l -17.28 -12.42 l -4.68 -12.42 l -3.36 -8.82 l --8.76 -8.82 l --10.08 -12.42 l --22.68 -12.42 l -h -f -Q -q 1 0 0 1 493.0215 387.959 cm -0 0 m -3.039 0 4.56 1.16 4.56 3.48 c -4.56 5.799 3.039 6.96 0 6.96 c --1.44 6.96 l --1.44 0 l -h -3 18.42 m -3 20.259 1.999 21.18 0 21.18 c --1.44 21.18 l --1.44 15.66 l -0 15.66 l -1.999 15.66 3 16.58 3 18.42 c --13.801 30.6 m -1.859 30.6 l -3.859 30.6 5.689 30.37 7.35 29.91 c -9.009 29.45 10.43 28.77 11.609 27.87 c -12.789 26.97 13.71 25.85 14.369 24.51 c -15.029 23.169 15.359 21.6 15.359 19.8 c -15.359 18.52 15.199 17.43 14.88 16.53 c -14.559 15.63 14.22 14.88 13.859 14.28 c -13.419 13.56 12.919 12.96 12.359 12.48 c -13.239 11.919 14.04 11.199 14.76 10.32 c -15.359 9.56 15.909 8.6 16.409 7.44 c -16.909 6.279 17.159 4.86 17.159 3.18 c -17.159 1.26 16.819 -0.48 16.14 -2.04 c -15.459 -3.6 14.489 -4.93 13.229 -6.03 c -11.97 -7.13 10.43 -7.971 8.609 -8.55 c -6.789 -9.13 4.76 -9.42 2.52 -9.42 c --13.801 -9.42 l -h -f -Q -q 1 0 0 1 513.6592 418.5591 cm -0 0 m -13.32 0 l -13.32 -29.52 l -24.36 -29.52 l -24.36 -40.02 l -0 -40.02 l -h -f -Q -q 1 0 0 1 539.9697 418.5591 cm -0 0 m -23.58 0 l -23.58 -10.5 l -12.78 -10.5 l -12.78 -14.94 l -23.4 -14.94 l -23.4 -24.9 l -12.78 -24.9 l -12.78 -29.52 l -24 -29.52 l -24 -40.02 l -0 -40.02 l -h -f -Q - endstream endobj 26 0 obj <> endobj 13 0 obj <> endobj 12 0 obj [/ICCBased 27 0 R] endobj 27 0 obj <>stream -HyTSwoɞc [5laQIBHADED2mtFOE.c}08׎8GNg9w߽'0 ֠Jb  - 2y.-;!KZ ^i"L0- @8(r;q7Ly&Qq4j|9 -V)gB0iW8#8wթ8_٥ʨQQj@&A)/g>'Kt;\ ӥ$պFZUn(4T%)뫔0C&Zi8bxEB;Pӓ̹A om?W= -x-[0}y)7ta>jT7@tܛ`q2ʀ&6ZLĄ?_yxg)˔zçLU*uSkSeO4?׸c. R ߁-25 S>ӣVd`rn~Y&+`;A4 A9=-tl`;~p Gp| [`L`< "A YA+Cb(R,*T2B- -ꇆnQt}MA0alSx k&^>0|>_',G!"F$H:R!zFQd?r 9\A&G rQ hE]a4zBgE#H *B=0HIpp0MxJ$D1D, VĭKĻYdE"EI2EBGt4MzNr!YK ?%_&#(0J:EAiQ(()ӔWT6U@P+!~mD eԴ!hӦh/']B/ҏӿ?a0nhF!X8܌kc&5S6lIa2cKMA!E#ƒdV(kel }}Cq9 -N')].uJr - wG xR^[oƜchg`>b$*~ :Eb~,m,-ݖ,Y¬*6X[ݱF=3뭷Y~dó ti zf6~`{v.Ng#{}}jc1X6fm;'_9 r:8q:˜O:ϸ8uJqnv=MmR 4 -n3ܣkGݯz=[==<=GTB(/S,]6*-W:#7*e^YDY}UjAyT`#D="b{ų+ʯ:!kJ4Gmt}uC%K7YVfFY .=b?SƕƩȺy چ k5%4m7lqlioZlG+Zz͹mzy]?uuw|"űNwW&e֥ﺱ*|j5kyݭǯg^ykEklD_p߶7Dmo꿻1ml{Mś nLl<9O[$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! -zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)Km endstream endobj 25 0 obj <> endobj 24 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj 30 0 obj [/View/Design] endobj 31 0 obj <>>> endobj 28 0 obj [/View/Design] endobj 29 0 obj <>>> endobj 14 0 obj <> endobj 15 0 obj <> endobj 16 0 obj <> endobj 11 0 obj <> endobj 32 0 obj <> endobj 33 0 obj <>stream -%!PS-Adobe-3.0 %%Creator: Adobe Illustrator(R) 17.0 %%AI8_CreatorVersion: 18.0.0 %%For: (Lee Byron) () %%Title: (Untitled-1) %%CreationDate: 10/30/14 4:19 PM %%Canvassize: 16383 %%BoundingBox: 83 -268 726 -4 %%HiResBoundingBox: 83.2057291666688 -267.358072916666 725.64453125 -4.17317708333303 %%DocumentProcessColors: Cyan Magenta Yellow Black %AI5_FileFormat 13.0 %AI12_BuildNumber: 18 %AI3_ColorUsage: Color %AI7_ImageSettings: 0 %%RGBProcessColor: 0 0 0 ([Registration]) %AI3_Cropmarks: 0 -560 960 0 %AI3_TemplateBox: 480.5 -280.5 480.5 -280.5 %AI3_TileBox: 102 -568 836 8 %AI3_DocumentPreview: None %AI5_ArtSize: 14400 14400 %AI5_RulerUnits: 6 %AI9_ColorModel: 1 %AI5_ArtFlags: 0 0 0 1 0 0 1 0 0 %AI5_TargetResolution: 800 %AI5_NumLayers: 2 %AI9_OpenToView: 57.5 -4.5 2 1192 711 18 0 0 121 293 0 0 0 1 1 0 1 1 0 1 %AI5_OpenViewLayers: 73 %%PageOrigin:80 -580 %AI7_GridSettings: 72 8 72 8 1 0 0.800000011920929 0.800000011920929 0.800000011920929 0.899999976158142 0.899999976158142 0.899999976158142 %AI9_Flatten: 1 %AI12_CMSettings: 00.MS %%EndComments endstream endobj 34 0 obj <>stream -%%BoundingBox: 83 -268 726 -4 %%HiResBoundingBox: 83.2057291666688 -267.358072916666 725.64453125 -4.17317708333303 %AI7_Thumbnail: 128 52 8 %%BeginData: 12290 Hex Bytes %0000330000660000990000CC0033000033330033660033990033CC0033FF %0066000066330066660066990066CC0066FF009900009933009966009999 %0099CC0099FF00CC0000CC3300CC6600CC9900CCCC00CCFF00FF3300FF66 %00FF9900FFCC3300003300333300663300993300CC3300FF333300333333 %3333663333993333CC3333FF3366003366333366663366993366CC3366FF %3399003399333399663399993399CC3399FF33CC0033CC3333CC6633CC99 %33CCCC33CCFF33FF0033FF3333FF6633FF9933FFCC33FFFF660000660033 %6600666600996600CC6600FF6633006633336633666633996633CC6633FF %6666006666336666666666996666CC6666FF669900669933669966669999 %6699CC6699FF66CC0066CC3366CC6666CC9966CCCC66CCFF66FF0066FF33 %66FF6666FF9966FFCC66FFFF9900009900339900669900999900CC9900FF %9933009933339933669933999933CC9933FF996600996633996666996699 %9966CC9966FF9999009999339999669999999999CC9999FF99CC0099CC33 %99CC6699CC9999CCCC99CCFF99FF0099FF3399FF6699FF9999FFCC99FFFF %CC0000CC0033CC0066CC0099CC00CCCC00FFCC3300CC3333CC3366CC3399 %CC33CCCC33FFCC6600CC6633CC6666CC6699CC66CCCC66FFCC9900CC9933 %CC9966CC9999CC99CCCC99FFCCCC00CCCC33CCCC66CCCC99CCCCCCCCCCFF %CCFF00CCFF33CCFF66CCFF99CCFFCCCCFFFFFF0033FF0066FF0099FF00CC %FF3300FF3333FF3366FF3399FF33CCFF33FFFF6600FF6633FF6666FF6699 %FF66CCFF66FFFF9900FF9933FF9966FF9999FF99CCFF99FFFFCC00FFCC33 %FFCC66FFCC99FFCCCCFFCCFFFFFF33FFFF66FFFF99FFFFCC110000001100 %000011111111220000002200000022222222440000004400000044444444 %550000005500000055555555770000007700000077777777880000008800 %000088888888AA000000AA000000AAAAAAAABB000000BB000000BBBBBBBB %DD000000DD000000DDDDDDDDEE000000EE000000EEEEEEEE0000000000FF %00FF0000FFFFFF0000FF00FFFFFF00FFFFFF %524C45FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8AFA8FFA8AFA8FFA8AFA8FF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFFD81A8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFFD04A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AF %A8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8 %A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AF %A8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8 %A8AFA8A8A8AFA8A8A8AFA8A8A8AFFFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8 %FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8 %AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8 %FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8 %AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFFD81A8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8 %A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AF %A8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8 %A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AF %A8A8A8AFA8A8A8AFA8A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8 %AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8 %FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8 %AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8 %FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFFD81A8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFFD04A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8 %AFA8A8A8AFFFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFFD81A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FF %A8AFA8FFA8AFA8FFFD81A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFFD04A8AFA8A8A8AFA8A8A8AF %A8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8FFA8A8 %A8FFA8A8A8FFA8A8A8FFA8A8A8AFA8CAA8FFA8A8A8FFA8A9A8FFA8CBA8FF %A8A8A8FFA8A8A8FFA8CAA8FFA8A8A8FFA8A8A8FFA8CBA8FFA8A8A8AFA8A8 %A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFFFA8AFA8 %FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8 %AFA8FF7D5252A877527DFFA8FF52527D7D4C7DA8FFA87D527D765252CB76 %52767D5277525252FF7D5252FFA8A85277527D7DFFA2524CA8AFA8527752 %5276FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8 %FFA8AFFD26A87D0027525221277DFF5227007D522700A1AE7D0027275200 %4CA852004C272727280027A85221277DFF7DFD05277DA1002752FFA82821 %270028A8AFFD1EA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF5928277D524C2753A1284B4C595327 %5228A828522752524C4CCB524C4C7D522E27537DA82752277DFFA8275252 %5227537D4C277DFFA9284C2E7D7DFFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8A8AFA8A8A8AFA8A8A8AFA8A8A8AF %A8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A87D272777522728 %27282728277D5227274C272827284C522752A8522752FF7D00277DFF5227 %272827A87D282752272753A8272753FFA8282752527DA8AFA8A8A8AFA8A8 %A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8AFA8FFA8AFA8 %FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8 %FF5928277D5252274C272E274C53532728275227282752524C4CFF524C28 %AF5928277D8452272E27287DA8274C275227597D4C277DFFAF284C27274C %FFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8 %FFFD26A87D00275352272827280528277D5228272727282727275227287D %52272860592727535A2727282E27527D2827592E27277D272752CA7E5227 %2E527DFD20A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FF5928277D524C5253277D284C597D275252 %285352275352282752272828FF7D28277E524C4B4C4B52277D284C4C5227 %527D524B52277D2852275252FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFFD04A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA87D0027775200525A5959 %27217D4C272784528427272884FD05277EA87D0027524C27525353272727 %4C274B27287DA1004B27274C52274B214CA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFFFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FF845A59A8 %7E5A59858484597E848459848485607E59848485597D598484A97E7E597E %7D7E5A85847E7DA8597E597E5AAFA87E59847DA8597E595A7DFFA8AFA8FF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFFD26A8A9 %6085848560845A845A855AA9848560845A84608584845A85A8855A848484 %6085848560855A845A85A8855A8584845AA9608584FFA8845A858484FD20 %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FF848560AF848584858485608584856085848584856085 %84858485608584FF848560A984858485608584A9848584856085A8856085 %60858485848584FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8A95A8484855A84848584845AA984 %845A8584845A8584A85A855A845AA9A8A85A8584845A8584845A8584845A %85608484A960845A8584845A855A84A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8FF848584A984A9 %848584A9848584A9848584A9848584A9848584AF848584AF848584A9A885 %84A9848584AF848584A984A9A8A984A9A8FF848584A984FFA8FFA8AFA8FF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFFD27A87E8484 %847EFD0684A8FD04847EFD0484A8FD0784A8848484A8FD0684A88484A884 %8484A87E8484A8A8FD0484FD21A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA88584A984A984A984 %AF8485A8AF84A984A9A8A984AFA88584A9848584FFA88584AF848584A984 %8584AF848584A984A9A8A9848584AF848584A984FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFFD04A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A884 %85A8A884A9A8A884A984A8848584A884A9848484A98484848584A8A8A984 %8484A984A884A9848484A9848484A9A8A884A9848484A9848484A9A8A8A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFFF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8A9A8AFA8A9A8AFA8A9A8AFA8A9A8AFA8A9A8AFA8A9A8AF %A8AFA8AFA8FFA8AFA8A9A8AFA8A9A8AFA8AFA8AFA8A9A8AFA8A9A8AFA8AF %A8AFA8A9A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FF %A8AFA8FFA8AFFD27A884A8A8A884A884A8A8A884A8A8A884A884A884A8A8 %A884A8A8A884A8A8A884A8A8A884A8A8A884A8A8A884A8A8A884A884A884 %A8A8A884FD23A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8A9A8FFA8A9A8FFA8AFA8AFA8AFA8AF %A8AFA8AFA8AFA8AFA8A9A8AFA8FFA8AFA8AFA8AFA8AFA8AFA8AFA8AFA8A9 %A8AFA8AFA8AFA8AFA8AFA8A9A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8 %A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8A9A8A8A8A9A8A8A8 %AFA8A884A9A8A8A8AFA8A8A8A9A8A8A8A9A8A8A8AFA8A884A9A8A884A9A8 %A8A8A9A8A884A9A8A8A8A9A8A8A8A9A8A884A9A8A8A8AFA8A8A8AFA8A8A8 %AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8AFA8FFA8AFA8FF %A8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8AFA8FFA8FFA8FFA8FFA8FFA8AF %A8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FF %FD81A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FF %A8FFA8FFA8FFA8FFA8FFFD04A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AF %A8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8 %A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AF %A8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8 %A8AFA8A8A8AFA8A8A8AFA8A8A8AFA8A8A8AFFFA8AFA8FFA8AFA8FFA8AFA8 %FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8 %AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8 %FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8 %AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFA8FFA8AFFD81A8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8FFA8 %FFA8FFA8FFFD81A8FFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8 %FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFF %FFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8 %FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFFFFA8FFFF %FFA8FFFFFFA8FFFFFFA8FFFFFFA8FD81FFFF %%EndData endstream endobj 35 0 obj <>stream -%AI12_CompressedDataxeu&0 5ZǼ[ N\rK B:+,e;+e"'"^= 2␇u/n>}/gson?.O?9>㛏o?>y{~#*[oֆSO zﯾg_ͻ?]?<K]:"]31&/䳏ŴxN!Do]D7gg޽g>׏_|q_tWNy'Լ:ߏo߾0G7o1xs+>|gO'?~+_}O#^.QC)??鍬&v矽o1ӌVbeB1gԶxigcGӚNu<ǿ=|]k|߽%~4$o~WRmWke'_ wcgYxr'kgwb9gOn3&ͻ_v1ͧfw*?y3n~'dcǏc;f7ܿg\/xఱaϽ}'[~|uZOAj'{%/?ջ}?L| " ȅ?z?;܇ǓVgo=+uݿ?}[m|{ݫ'|o50=kl^#6Ct?`S/|oG쫖w˧lx^}3(OX:?^"ًv<6G2jcޞ|9޾}>G9_*olݽO~7>_||| ͨkz+6˫7vw7zN Z?,Op l/~`nSw^}w {wߓOp;'SN_&خMZJٖb]ٔ m-wro&n`)~S®D-mBoٔyWne)K;݄?;-۩)aSK,fS.Zh-߭gج꺶(ӲaȺ-(Zv;oVRž,ˬr﷫9\k7c]/WkYܭM-Z{)w*zYuXtڒu@S]#m-wRky`i'/]K+Ћ'/fy;#Le0I8Hc'!r6-Pn%܅tSq7o}|0 ]R`7(x`- Vs~S6vS.r+s+W6%oJڕ)aS`N= [~s+Z&)72oJٕ)iStvo)f-mʧv۟Mh[׬~˂6_炙Ns720u -w<-۲>kfDg㦖YJ%KIZ_+SIڳEM-R ZPEIo#m-e.^E'ʂpLLl,dެԽLE&LQޕ/hndYFdD=&t%P@̈́tYѻ+70 z(7Vqo@6˜A@#dq?`#a.s)oŃ[\!wK.9hGonq?`ab/ 3} &3acoq1(&R0<. kq2r! n.}]qRp3%qGyUv(U^/b%]ڊZ+i:7p)wpqҍtо~l[ Æ+I"6f:JrGo +璷Pnz*m&@nvY9r + Lý 2qanY fK!ܝӢg]-*ֺ 7• -KhG9c\d/tAX/Fq4g*+R=:hOE:iƇ񲰿Lى8=ZN2Ti?ʐd=E@[8})i' -݄;wte"451s)a(~(ԟi'OܖI[;,"iVaai#kI/,He(q/,G|P6|ϑ~۽hU.w(ՔMIQ,ܔOUlnǻEߟơӻ==MOk^T(VݐĪc;wFUr]edUlvih42 -ãA~39ݷ~FGQi\ }/\%T H?#8n!4A" #@Q9,rr%[HA$ RHB* Qr* =TeF΍[-=0w*NVbҔ3+"@i׵ᱚ&U-$дavDu ;eG#wq$,m;$kOp#22q||JZj^-Q5nua"H/nWn+iWSNWv*Jr˴Z0ǦM=R5ycWJZ]SfQ7?Ug)E\?U^VeZ5KvT7f?]Xhi*LUh6fi?Znthzlz4D7-l$J#-i)\h~@UuL6thBQkTgCi.ùNk1;R $M9$ϑiёiK%6i؜kd`<{:_IӢeUeag&pzic=T,mQ e6E^XQh$iN{/Zzrbm7n[ZoXw#n!- b5`IҦ0Td8RA5*h73fAJSX+Sg}['ɇm?y36 rkyH<&a*Dd6F{/"HQ.ljQ 8S]?Ny\ޚ=bU~Y}nfU̹ߨN%}uùcWBUamu:ٺ''oON׉PASH;}ZD¡dC&b(b`bu5Yi;jb/*sUjkՄBW2?+u%Y '+zUVCJnf_l\'cU'_(2i4lZĎp#ETRw$"ª sTbUuZEnK, 7$k w;!c˥o"6YvY ߊ͗\ݙWW\ ;~p#^Y`Q良W^{cbLBA}.`Ӌ]}\ocq Nބۻpu;{/Ǔ2>ն{_?~y8=~-GT(Ҡ"`T+ʴx>7lg|R-Ozٛe>TYY:ٻSݾIuL\چu͍2.O",W(^Q^l~924}9!,4#AiEq%,g %#s%υja3'g:<<r=?39I;yo|0vYdBŞ#K<$K1FmcAǢBH=Qh=W; -Ѷfk2tPACU}02x/4>/ϕ=ӧ{A1e9qoY8ejoUI'O>sUcb FcWTՎb&<9WDU\g`o =9er>h*_Iig=~Jhgnnyms^\j/e Ro:SnhBL\$#kq  -kX&,^kz\u>l/ƴ7T7rǥ2 M/ޅA[lH8$fqOTqƅYv5.b5)% Wjk@|G\X9->L䥔,岖)n 7nݬMrXJܕte>(7SrDY̺ӱOPj<m1F~Ke=vUP^hũ -19f)~uݘkFlgVf 5Rn{xq{Qƺ7NlnNq#.uėيE 4\ETp햩ڭ(-uјc't*-2ߌAchn%jjfLsF dkN*Wn&k5uNi6l;⳦2I1/6N^gf[`:[t z5{^r}>nc[4}ok|>\,"MUZEi/C7V_[{:AIUޞȽbw -\vqZUo"[`qF؈DO7ϼZḔJ 6J~-[yWsHrMW~$t_onQ]/ 4v%|"74o|u4$ybGL}$WaPMӢݪD6]ա;eZDh޴u}tB]kt@/]đ_5U'z&9s5faNXգxo$^#qHj+v{WYQceϗ:UѪ>KNRlC4hI١K*VgZSEt7U/MJUH~٧ۃkѫ-j>OU7 赠>qUS7sO91w$LζPqĝ$D}G=hݻW=~zSd>}zS {Ef٠{ -sP*n޻:NjWkηɴ8{c* 5/p 㥨#OxO|: d;ۻp5c?ӿ}@D ô}I? xc!>[z9pn9?@4\>YFkc)6>FqG]u$/~)P 3/~"gATYT{,LwbEyTlm-LgT58GBs'Ӵ2ݘ.'VM>g﹟ENMJYZNZVTo"๫NP۲0V}Yt-+%}^T2]*_L_:e^^~“4/-TD9='|G!:S|X|Y T{k: 47샘C*H&V%Q5~OKVz⪢h*jQ!,gݣ{ꝣ"sظ+8 sh)S_̗H|vGH}N),\2ٴvƇc'o ŶKt`1 d)ڳDEg"J|8'=b^èٻ9|o|?;8:t $ww["PnZnzm<#+ l .眍K§HF*`x'N?isĬT/4ggp.FWl X_<q`WA޺O(OY|ǏaVl Ë}u{ o5Ss}6GrpDoqx{q}%wSUa SyҺSqɾ;G{ztFM|ԙax$nBIW{QݷbdXw'z=WYL~_+V,QLIia}-+49r0iąˆcEq"9mkKKޤTZҷ}|^}dH'ȍʾ ߃R~xZ)k{" ތ[rx|vAXl<ƲzuZܠ ٸ_m_Ə|aSz[ KdH>F'> - mTpue*״V6^/wM`W 9P&k-JӭQI hi+]PW7Yȫhӽ%X!3l#yfQ={tqw0(^bcl'IJw޳y#4u1_χ3l%}q@.O؊x ML;5>b p),Jq tD[G6##iyռs]Vg 6oaF{l9WEs sYݻ:n:j0r.$~cQnŐo] ,wk,ZGJGV1h<<$7^/?klä2.)_"F#x/G6-mC+dm=wK>Y XMרO+2;Yƀ{Rc9]"Bᘬ0wBpɀD^23_uӨT ڈ|ˏlՍJ!4ccK|7$ɹ'@A#`T`rU8r(8󍄻p$ۅKWVjI.ExPd\_y !3OUsh}f5k6oŒmm&|RcbncH)171Og}YyZߡj};IM/Wq fʸ nrn+Lߒ"T<ʦF 8Qԅ@RbEIo9QщAMF;cgXPKJ8,[PƊ37[ -ޠ\so|RЬ['-w}[PUpb+b'p;RZefy:Yִ$J{eήr@5JۚVl1S*G\82o7"k{O?{L- \"n/iF,wBj-UT3|/>-\K[tjg)gEwMr~Xkɴh -٬[Szu^)b-c -JӐH~[͎Csߤ+ÕR%iAFae/l䜣)Ӛ)KE$ZôOB5fvIco7 c&vlWE콷b0JsEOӕ̳JD&Z*f5%\8{}OFFxd4;C^~1Jim3#K0K!X!TO5UFу63&Q阚g$' Kr7]ϳjn6j82v{|NJrRm8eeLf8 m; X\lKz07A+GsK~NaG)㧸>sOXFXS$-▛E{EI&Y㭩.)+Kz5A^KKޒwwwBwg;{foG!+SWcUW8]ytt67 W܅^];,]dm#gqPu;䥷eӋ2-VܔBuN>7GgX֙[I=硿r5'xw|۱o>>#ȭ5xfviVoiRnIаo!x_a&ffs= 6 e&!J.4} ZHܫ; wl|e씆Qkh,+V,~ )5qᾦ#A>jn,&lL*u 6kRE[k3VF`# Vیml2<K̰OPMSfAx~fl6t%+uxdEݚJV uہLtׯA7z=N_?Z.E Iԭ)p]Ni([!JE0{19}IE39}IM^tqzVO[᧭Vi+\(֡ ߕ |Ûw߼/~۷?|5{wo/^A<'h) L#;ozoO'|/?})'Y(k-Nuvn -8lrL̩Bː7lt.?[{6`gXb9{,.fČi;0@xD!YL)fǴ|8Іlitl63(UF _r[/c\> iق6 $3iŒy 'Y2)g osg@ .O.K qƋ&;}%Vgs @"PilM^MJ VO -X1=X~׉Kə1xYC:3ma= %س\ Zg YC,}l6 .E†*z9Hes{5I:֣nq2{AxD tDaSvI|=r֦dR!*0Xl׃G; qkO6 3_ _8Jexl Q~MLv HDs\(A7Ufĥq -񜊯s.SLXU[BQ̌}:p0>@| cþpʬt9أQo5Fw6*@|Xp"9|a N`z03f`J8oBŬb-q8qKbI8*&R{ͮs[м 6 ;2dE#c=׭dCRyt{'<,D~_gG89DM?+a#Dg2';ux -6e hV; zo;p"MP"0=N3Xp n$|9#APr- -23CިLOZę\'"LӁ -|7`yjwt`qsz4ȠR Md.qO+ޱEIi@  vgGuE5gspxa;go@JJ_قV3:0ĦK=%syCG*uoua.HKE<bw06S1=7rc-RDyJ2و[X]HsFLN+]N˷IXsy/D|6tjv!DőՒ V|Bҝ IsT)F=fɓ'iO 5%gm-᦯gJ)0P83Dc(~}'S@ZQa9![$>|}XY[]&d?ٵ٨cW·YC pgb" O w&S'D)5{ڻDB?!t=Gڤñ-wj~]^PSNXJe_4;-I Џu /'~N[zR>6GBvqgAw#i ݲ "=-Z -ZipOɯ%:F I6Fɒ "K6{%Rzѱ{"Dv"rH\hEja;s<%-È8Hfxٻ(R3I9Z"օ޻^ѐy@7A;^|DYd(@\▃@zusKVtΐ"Gh΃I >RFH+P8vm=Y ipΈr쁿d\$Gb8 W&:y bLT})G>9Urh28+invv;\fe٘itS{ }. .bcB=NǾN2͔ZO<y:vΙtp+39鯐)΃&9 L+l WXq9bs3:0xp:rBTav++'-"B^Wm-31܍-ߜ; 6bs[qd{{({Z;8DGCCЃ~:Gσ -W:tHD P*qeލl\lG ; Uf -!O )MnA؞);zwC[{'҃ aDcӵ'."u6dX:jK[x\txL.n&iR87+D7,wo~ylR_=fqyx臮_|'|W$p|\sA'gWӌzj_Mv9<& Cyl?6"CsQ*ǯ>ݫ֋QN=s{ MYn_fss'˒{#b悡U3 ^3*vD4&[{X2~F^@%lUDb/aM -NM;{`olt̖.`,Ѩ= [@l -Ї'1G@}`d1 $h΁a%{k<*#تWɋUT/8£ԫ-"T*uuSYc28Ҥ4PzFGƁqf~5*"|L!֋݃WN@F2y*7Ap45Y&@$)&*el\$p#nţ~(pYwӮ]Y|Y/(+Ϥ% n6}ya^<>?+#Y$0r02T;gTaťb0W8;u3I<+^ LHcT/;qx bADF{ -5,-h'EA sCQ` ^(Ji$3|+_ӈ{%$81!3gǭ(X( %m9gZfd@-V3A+ -/$^h,CIC+:SZQ͆6q,NE VSעQnn~:+8`KďY3ЭշbD`-.@7g+&@zEB -,%w'Ka, U=f:L9kU$HKԠ( #fUԪ2ij^ +Mo&+DhI(\3Qi5<@SL:h1 MSR DJh^wh\tZ o*{")|#pX9Q3o8If -Z=k8b$Q+UY^x&mu0ׁbÈ:A2֌--@:>h+ %5J9]W@Qn.t(EXd#+)u #j_]TdTSW38FW8W*q\&(V@f!E\GWkb%XЖ`w4} /fpꧢ>>I"tl?֘Ts*Oi5K;Xql%1ԫ "%(ӥBo[!PmkFn9#v7~s(V1eF2ށ -:!Wz2|Y:]$KR`uF` fP"0* },aiටkp=9[Éw-b8$f'387^H7gbgy@h <9`^k&f觟a(Ϭ -"eA5 cK>;n5Wg y DV”N̉AI} U ͐ƅYư{ȪK .%L)P+'ujh̎BڏtJv|>av3DUqڪȦS!CN #kjXpj10=& T3`"|1бOJ|d*҉)F,9 Z#-.')ΰgqxNYW-~qz-:ѴF -ƽ8tZ|Q9#$d['VoۧQ[T0"ucOUq{JW%T3NWuzn:-7jZU ҏR9Hߢia2O|3 rlG!܉-ۋ: px̙"=B- -A?:{} -21eL!du?NjxE3vS2O0gdňw~td6[AFhR;b> U~`u SŦRSܳA.:f:@ }ߊԈQ}vC!ta -=0gWh HzDkJr1up$ JLnfz%mQWPĥ_o<h 6M\ɋl'nhƍ_1S]mtf: W=tJ$' [TN5 Gt9CL=d<0%g 8CSEqj{p9Fk'Df~*t=L\N Vd/8<=u |\7tr KOF 0DSMmaDXEu܆l^eJYLcG9xD&A[=Yty?cq"ֹxg<k74+ęKE'+4}ގmRwE7n}ЪhSC SA@@Կ0P[E-ك!К 6a po}1DSu=FĮ9 Y-袀NP{6'upotqcZja,>HjiH7z6[x݊!A+A `s@ @DKS1+#z13 e~ Ϯгʱ* 1@bD XxF7`D L1 p!HĀ7D PzHD;Ćpf!b!>!aft%b;l ѐlb  x0t8:TC(.rhÀpHp!10  =!xC;8`7DF1Zu Cb8 c7=8A8aп!03 Uڲ;|C VBl a,\աa(hgq[5QBߨ~nǑР{ -isq }-v@w{n ~WDy*ev06"tm[O V<Փq_lF3żṙq -i򡕦FuZ3-u`?l+mWԡ5cվ$58ɼ3P>ĭ1$[fq,Cڝܵ -_F5>Kb]2ԵhR\77C?cyn~HqS.V2ͣJ5ammlED]5XPO4#L3 ׃m -UQwo\9CdWeeAĂ;, -!bfq - -.@aae4m²,gq#,(zy@ݺfuFBwF@va]fM1VbDwh`W7ޭ*c쯵.β){.fN8L2 -SY+0k}Nk}[,tϹ:wϺx~1 uZi챵R 3@Zgrz,*}F+ L<ɥJw}.G"|,TcF+skeF +C lůrT]A`Dr5z\)sNzU9B:T5P%R<9N7Ax`~ޔHW(#PT< PtIiĂ*n(+ 0$02/ Zف)I690L|8qI]%BY;>f86Z+;`92@u\64*+ZC(AH%GHJg#Vq*{ިP_@&K+GKe6D&BSkDwsD _"&~cZ6ZA T,eHܢe2 }_צSU[v?%Z+;ݬ(Xy(H/ߢvY*xg}NCh}[,Ϲ6wmrik -@R٣~+x@‚t6?U鬕{1ggyfkst?⨱ -cÀFH?SGQX`+qW0Gb` -Ɨ[?Z*$۵(ksOǛO?Yջ <z׶wo><~{s??|xoH3B4ӯ__\/}\6\ D_~_O}Zп/z~Ϳ?|D[t -7O,5ShDMe?e~> )s{_oN?S"H,OV[z}Su{vy޼n?[3/~+jʂB4};O(c]#5V+Fk>ũ*(~ y#ogclk)+J&4 -f`E -ZT:УRS%@3W$OGGQWN#!;*vR$dK2^;z+xR1g^Ds&WT YӃ29Z%CiX2㫠pVt -ffoҙƸ~&w?8fe]|md*f_+[&LR0!/̝l'6ސP:TTd@ʼc"gB] -9*˸6gJ"܍ZzTL%4G`bD}L%y*$+J&:vK?^AT .*m>GRW9E!e?"Њ -2WV|Kؤys $t"i-5$'Ce>D/#d>fL7#Ad(Je:LڨDSC1)E| -D`:^!f Tm44DF+tJj'QE gC!cZaViQQ-WR,TDc9iGi -ĚҲ/y]i ÀGԊ4т"h ɳ`KZ%M5XSNhjʤ$KQ -} )fMy|E BjHXX[DŽ0$N0ѢPn:q*Ac #&dxlse&] -&#"UqI cJEҐ9KȯjA=NxGh @4b#AM'bË 21Lì>. N(RK&Dm@& -iʚK]a7ީ cV. 7n&qëΌ4ׄꂖK"=`l|J>0ht$ܙ@(IH1њĀ-)I}Y"E%Na3UTHƷ^A3RQP^LEQDmE Z*xn;\uqdz ߜNyS/FQy y4B!1!-&QuDbiɊdBуZw,j<Й@*MDb+IWjK ť.ѕP ^1N*5ӕx*jEh&In!JEjnauxy0i=ue`v.Aɸ-AI/(~1W!q$*HUd j s\9HX" -U4ӠYI*J 'F5]@H$ߢTseѲ7*J_F;ůPȏT&N@Tٓis޺'{wy "7I"0T%VY5f'*s6<&39ўm:EEc5N!>3>G3)j -CkRƁ P" `T9 TJw&L+;+A$ሉ[R?hJ [:9N:܀Kf%Tܪ 0"1%8X!D)k~Br7cIl5;+WrL#tgIYQيYAq%$.\G<~N {ŬwCePGD) -LlŸ1’$',l$0s0zU --t٣F,$Ӄ5^J]Ł,F^=xdr^fB$W26Cd{&,|j _ ,0{c(\7D`4,W_0 -s%B+:qް輻=Kޞ&*'/C.Jً\"DLZ*gg8H\;~~ne3ٙmYL4R9g -\UصءYT|>T~>T*Y,8 7^\ÝZVݝ<+m7C&[e쯡ިMF誡i;R HHPUh^LÎ"bDo\Vs &p-H>(?SLxR!jG3ɐz_J$~0^8PnuA4`VK뤾5It8cwLO4 -kp@@c*管G8cRJ)V`G+۪?\d[EaQ)QB73Όy B!YT+,$ժqu։x^b*ap$d.Dh>KwrSvHe(i}f(4;SV2[^T# sfeU@SYAv!Tm*P"ege/e}UDj!rǡTT -((!Ͱ~Գx)&=uB ŔHҴȇT -H)AL7K$$}+ND%dV g^eƄߒc&+ 䥻9K0[Vdpf&dSWʥ!Y'F_dl'RhsH5̄`2B$s3$6Q>$܆P8|!= -IEOlaϴRvg *t-+dD| n]ښ1w81/$R`i-qE8+eTe[eSukћtJnab 3n_JצzV4t -ŵȐ6` #_%/0< `5 R=gNfK`QUVr+PƉ"p4ar :1Q*.NVK) -yCgś:5>ws)M\P>K>'Ü/՜u-׃(ee]v|%cYD\|zn#I.iRǨ:, KǜGS"L#CiqITQ1QfjXG(;;L$-.ݐbvPz%Շ +Q6dFHĥ̔E0RM\Zu ܤ ULrly*0pRkETU:CN jXEQ/x rbR I!N!as?VvHbs΁N(LӰC8JGARps#)fԊ; -5!b?î6]l2Ĭ Hdff T7'Y2ydVW:*=IHyt 뢹rτq_=*7 ~&\jYVP0ⓖE -j/Pj݉2Lxzt?Psi&OI,)D$ؓw -jS R4(̬No/8'0 |ɪ\ж  Yތ de;:$53iS^γn5I`nDT.I5S}#hYפf^T #)[ ,%̡'-u0P\C<$0L3I܀\- 㙵UV@% [4nQ.qfg 1m1d敕Up^$"-m6k?QYtĢC $ ,ҏW$.z ԊTj5, " 2 %#)X5CII>ga0.mJR]rԸZQ|w5{iîb]nx#Е4..4RMKi>G*S$|K â%(!7*3ЃQs&v ]fh*W#\EʙZ <$z>. &2=āVz(LfC~ -KViܒ<5@@gɆ#y]PE,#(V,.ߴ5cK9)?B!}̠j"O&T5;Ss O[,'=@vhRJs(Ѣ`@Y\O~RеI:{LT $qN"Ġ| -V0$s$5Zq?fWv&;ӻ[e=gP-\*AV|YLf\238dk?oDXr82Ռ~Zq&nMDt 0ng=ܞq) l  {Fn^ -4Zc[,kl\bI+(5Sgw!9~qpT40c/[FbʞaRE7kg~D8ࡉ1`V aKb%J*c9dм(=L N7"Lbu9%6W`_ -2Ar+Pj#؂\͍i&YS~IY6e mCۨjk!atZ=x9[m5{z`fyv>C',|du2M JOjߑfI b಴^˥ǐ%0~VjA`Xl_nZCu$ (f_Ŝr}A'V e쳄mgB+ |%v1_#NjJم10tfW -'-L#!<؍IMMΪn0ǟ` cu - n-K#!!?FT 4ISiAKXZ^!TztAwJ6:7~:*GCb!1; 8[]>mS*|)겍@ .(W <:; :զ3 -h8qML(=\2)@xYȫ3{!n ؿ? -mD=ߞ+#QZ)N,czA-\7t6lN B{7qes P)|ïMCcK-8>4 34Lh=^Q HW,7)ӣ3?P8 -!FRd% Hi&v * r*Y6zELS "XG}v `ͿMA7R-̫{f4-?BEf/3~bpGhvcPS|]rߘd 2J9|J6 -m!Dr< K9o)ζ !~H㓃6-$ж|PN *>q<QRpQU?9/amK,?hca&ť6htKwO- G -U!|j l_p$7G:j'Rdq! U~~־ Em;np A*&<8'cQiTr[LmG@^J).bf_yXz|+ǞaV'%Sf'\<]1)fv=%LVe%wb$T*돐Cʉ뱉|^@r|,9Ff g*;7;v-n9,Vl(Z5420 2( νD͗8Q)XE4}<ZM7Jh]5y曲71RddYl=yEpw_L!;!N?P Gk6H~)H$(Ңa~=ЋorUO _7t~o }\vS)uIMaSw }҆߇ORޞ @1Bʰ'p sZ/B٦jgDʀ-Lu/?5JPx"CT Ld8|>24и(9LR*f]=4`?Ĺ#eւk$5j {aym&sCEݵSVyE~jGYM3 sJ'K*&WnLÞ6US!G`YU̔+,m26IɄ$'\KJwghәnR,+-=Q -W)Æ -ʪtZ 9)]7R^w_gۿ2jes"e7jsFTR $ -cCĪaTܐ bF4KyyKjg_<]ذб1cT3.ђ#vw RGŠH!؍ipҢ9Rqc |ĆA:dנ2qT2ꬮReF332'r¶Dt#V#xJuK:)D}+|Г»#%fFL*g -k| soq..?Ct -5 (0:7.A1@z!s=Pg.3 rJ+("ҝN)?" r|5(L^m86Զy(elP8@(mh^-p]8D@R0'CH_A5x{[['\sp$_6E0Mh/R z1ݸs#Zq&Qcb#.xAG -a9"< Ў%TߗmmmW9Ց9 -333b1'沣v-ڛS5-FOD49L͹9'ײca+@Ͷ%2! A2Krdռ. DhIP%/IxAE#f-ץK[0AݑIs]eZmtjF^ b$*v* Gkx үB&W4LUsb%ADl`q.p}h,hje'1O NNL ^ځv,pn\%N<'RNq.Z睨9 K1puQb"&%}t녑f PPiᙎx^^#"%ǩnہp*ĽRi:#עa:iTdq>6 ͆P@gCOcG_Pj:-TLH%&yo$3ha ~̘e/&Kynq%s-d̿D'@rafl&QCɑFQ:X/5_kt~ )%'f6+MngO=|N VO:- d@s ݬ((y~M%b/\kږ9D;i sۛF^\#%k29'RF j&ǒe N\bu§JcYmG|\ nC]euEiT -~ k="C\Qcwݣ/4Z*Qt )!A! -~Ap1U!JRu=֧w/jHbM* =j)wPEƝN;Jc=wx`OGIMގmV v4֤%e BZ*  $خF<C?w,Gՠ:md} 攝UDΟYA, -Q]pe6T猳ݥ9Fَ1<2#@&?ci܁"dz6UyxFb* l(+g!8"3!-:UIeӑ@ǡwXh0Q=UԂ dX|=VV[sfwÜrG! s})c KlP#c!L[ƆbbÜ4_~@ar8A -G|$gӡEeKcd2}(!+=8p|z,8~* -=El"3Lszm%ǦtoUZre\b'(ЀF{û"Fq)n7T^CcEDf=NWc.{k7D3B4˜^G׼.] 2 9I~毼LIY-O!z7OCkBJ#B_<a?ef3Tq^5C M;#m/_m_d -l4_(t,TrHj>j{/TD/8CpN-WԂf. 2m3mЉLR,Iu .Ioh)A/ޔ|0t7ev?JŏkG؊FuCI@-'Q"28z҄cEqb&גAe I8^h,S<&|< Q|x4˜g@Z湾i_([e1pA}K(ΈcI@ 2?0w0`Jf@lkb,ô[V"rw -. X -2+Ѐ'<%)Kq+Uۚ)Nhbe(2&Ͱ΢ċd-UQhx,TsC#ZDcy-9Pրy~c(Gn?FUTI!Vj!p.fei7Q #1ʘ82Yq>p>e86V'ܬ- gX #fy|ߥ0/zXiW'}~Xv] -LNPBJ덺}+L/S8P -T߳ S.p,FYzmȴht7gFW^u}fj*!@mq6I/=SlN(0ɆEPNؚB:jح(KB){Վ}zJVMNJS~xm!)1@8Rէ)`7}G^($CI-$`4_f7q|U}B9wp/: -9'`V X1)؈R)`WIbHP-`394pW[S٘1B"#$;x\}b3h:s3)vYҍ恘R9w]V[/}U;Rn,ȍ"s ) dǠXm|L`&uCgnk%u&Y%cjU(&z 9a]e|Y(-@FBC .0ء6%Y׾^ޞ[Mi>2|/U"{?wr'ǯO0?g/?ÿ^?_$6p'3*L0$тP;`[U-FP]&5Y˷`X05,ol@q׿bu!>9f"=*`cJ԰ ۋ2G86{!8rE:iDe?匴8:OYWleq8Egd',;C+N(*.P -& 2at.Mb6AUqڗ{cW{$4AǷ=,u_p}gEDt/dҷ}R~&Q!]!e3)smMO*HO=mD綗3 ϾUlԾ]mhgsi{$}8WpV5#'=%^N&t V?͖vN! ,2}wEM9\@-C5ߠބ"7\)ַ!8$'KWX쿋BDvUc}w"]Tnkoƅ}gy Fޅ}*ÿ;9zvS .M@K:mJMS羽?]: 5!(Nܨnn֟"ǸJ\=ʼnpVW)қO59*T5(mO͖t&xk6f&ABcQSxzPs)ܣm= BvgCOZ,Em V0n0Ho7iX&d<"i.o^bc,b6캽kfr~ZBArv#mA/MfV_vz<7s"`b{:(l'g>šo"qҶmH֜4hIG̐Xu͝y91S&O>Z-]opk[f'|dl˻2 aF//#oʘlsrs/p{$0 ]!PM/cօRvi/++L4v@FܶXcIaij&enL.en ><}xt0Ƕqe>!j閭YýH]f Fʅk=/>m4#); c ,|Cѷ0hXŤ!!7+aNC"J|&}O8ȹY0QUGUZ߬C%jYx[3*:p|{i0~e,_rLO9_ƾ~dxSH-^jȅi/[ڧW/+ -nۢXV̋r͐߶s'Sz -U4-]Sa{1rW%;y[r78fȄ=t t QFEX&`7.)roK\qn^pYo@4]n~^8&mnSoK[f67˔7p%`Wb#J̿jOr,~b};%ϿI۔,K{hoSZ@{^g^@V_^|ʶ=yDo#@KVCF{Tr9q,C%>*ف'|=kt q,S$=?gõ -+GZJYCVypA!)$,rnwܖZ-V(u̱GsXtM>si'^8?;r\|[Px6JG̟i'#ZA/j#ۈx3sf*bˈ6U2>g願L䟍hMT-~kCz;ޜhM73ȊɉVt-oÉքeo#ګb.~Eآ^.m7;αNe7Kcqz3e/\A)kF -*>OYn Q3L?z^oagΑ5jqV+ -jez_ =ɪGrjá.) :im'yM%fQY!mUz3sNo![^tL6ԕ$ԕSp;EmSWÒJ)U 86CdoSWaeI6uAg|3@>]]i"jȁW]]m%7WWJ )ػl{WlT@Gbդ?|^Ӕ )꧌9秬&-<1Jpyy1ΓCJ/&Ttk>4͇9nWwxͫArfJ "}Bjsۼ|# *ja!v~=$(M4֚5ct~FHNp;5YLJC ZBf;@ -6^Иiļy۝}_B<#1nX2`-Pn{::U oX$fCR/,`=HbIoV6 -i rbJ߬`J9ʩ_^jj6dL_էbPL*bN?<`yt>(ov؛,0Ƴ(K #}{S: ^鈆[JO#֟^qP'+[U+onX?UCSuWOO^`zao_Ʃ_}h٤kQz{adQ/a9o/:suq?ާ|l< ȺN*?t`TXHTg5EzV>$۽k+o,o`@۪+Ӡ |IǒvgS{!mmCk8POQǸMGٚz^-|a1ꡜngQ>2ŋ@POoQp}.-TA0TDTcW4ޒ4Hjmf)%<7K4(!l۱+=Rߌ*9ÑZJ@B&QGb'kQ."Zz38|{NWi0dLF &{pYXO |JSFEdG*R3c(*3\˦q[PR,+թ9~@r, OHt)ݮX%0?ᤸ&aA5z;qڛ#:' -#oy7qK68}3"k2}#^HO Fs`Yi"`m֋h;.gPzWD2W{3zVSg)Bȁ]rDc:;2A@QiS"Щ1KE^ -,v "Z}W\/-۵bEmZ۫<~ OBTV8,gB]z CHV;3AUճ╇:!u/l|3" F&gɆt}%7iDH$ڡmDH4sрп*NC|}2 AU>aۀP2(ErԘAc4Y)ur ۀpFBK8\!n%JbԽ /׿%VS4VnTw6i2HrjF,,i k$d Lllk1e?]"%;&A@눟 Oo$=xLk9.$ >9a"I$,:3/Ap%G#ЭQ6V;V f $vϹ?ח%=)uv.OO@뤓T޿M}4RM?M" \e pNԝ6R}ňn!%_!Nk7$ja7k@#rV2ݡ4o#@/ߧ9׏+e( LSU :,(CKξs>"omp8%Kvt -V- - Ш?~vAkvAQِ]N4 v9]כ9!YGNb@(Kfhg]ކL Y`}r}fYy2 Cwu&.z*7[mHP 7@Jc - `<=IHGߊ*xt; D7o`Yo?'e\dA!ԗޟ" kx -Gq]thrSsHyQt)uuw7?}(L in?ʷ5e9i`7l Jއv•!e~ מ|D,2i`nEvkYΧ(Z(qݾm_E~Kž~zE+U97?52a)or펷m ǎ">qqf@Qt1:5h%φw""%{ ewZi1JGv4+mo//@$o۞~ -~SQ n{}OO?H@Z3cIzT۔+^߫ijCΠcx{ C[Ǜ$ #ԿZ[gol -8OJRަ~C -@Y?Ϥ^~ZrXzL'J.?X9?`뛕Nn*o+?̭L;o/?b7r\'ГOlh*@cIo/?\|9 ~B$rVM"!$K_IJ>MTrsoS?]7F}s' p$rՏ]ʤ,ǻX4?dC*ޏ>s6|AD`6vYQF͑џWSqDnmF҄|ٗx# s;7ms 2afᑯ_*J/q7?*f9utjr3†b6O~@O/՗Ej au1J]97??*!kl~E:x:ZJV~8IjqDh'eXbH/?Wig3 *HSo?`הz<|hʐYǮ/'{W㇫E>ӛ6Yyxy{1(nG@2kA*FcuV*Op=u6ٓw{!l) -uJ2O=qu ?8yQ9m\פ'd/PA -zZi]ݲƒrv4XN/7 TR4+kj. 2CovDloU0} :gJKtۛU7{rv߲c&۾ O^Z4+ر\XS0՛,[?,ɶv"˪m@Ɵ_nn,3BMUp_V.!vIǶCJALvqXȹ__М\R mmh' -,Q? ]ZWuLo~_c|<+!O{Ur6o//2$^Ri˹(42bފa!{tk\\ rr17tjیUџ0B R2bBq l}m/b()a5т:V{9\^Y0VYdE /cvaͅ+GݯZjVo+vW5L - 0‰>V&: - `Ϸ] QۯP)ۧg=.*2sA4&!ӏ -`[囷@)R9P J_dŔB{zsbRӴn;1G{TM!MP^QfRyXD"Dβ+܆P0#a?]8ƍfOi{<4Vm^}`nu\L(ݾK}DuiDbk#H ےitbǶS_Rv.FURvY~+cSI?VJ})>(์U_Yk8n.\e&#J iX(иBKӿw492e;moD&7S#l/#/[Z7-V /^XQ/=-Ky,L\:CPɞC 6NlHpzB%vb y2gnr5H:~v ZW_.A\C@0 )|4e3,gOOs(g xzYz?Y?^bøG(?>MP?y >]y:t|0K !INѾ-wڱL>vX%^͗0D:֐zB2\ ʑ~p)y~8el2bJ}P(ml^quFG̾p))_5ENf>j -?frz~h>#?߀%Sl!]’^J=TwCdr* -@V3wzz)l(z!BT!HU-pbralMslkWxbͽU[a&816@A8hغ9F.s٬ʞTSYS1Ck(;%z`41~{= =U~I(;ym3p}N 'X+qL0|b{ 3B=9Q+ѽ¸`p.83sS>YGkU!Nqx/X>qѫ!c2fzUzΛNqhn͙+ȚBI$H"msuVTMW%jsE9];T:0YAkE3ч9) :"}3&!2WE$)n#tHSŎ5ϑ6V) ndI+x'=Pk@e,6X -DO5hTC(5p)0rX7̹%rG+ a_ 7F),Ÿa -|l'ޔWeO:  -MEmR*(1у}Yڗ(^6b/r_sta&a,\ 0_(A΢iz<M-V:7W$BTUpql;9hzΌPF"\َPL) ɦm$OftW@~]ٹAz 20MPVg_# i+l=NZC @̜6E5 ~]AdU 99 u44i>_i^G^+^ ,q -Id/gqŢތMiz_|ӦSOL -ds9+sy SDES"2;#7L'~Y -8G3弮I:'bо -=;d}aoy~[[Guw x@2NqZ5Z_[.+B:Ҝ>lfsJNxZCwCf'Lf -Fudkח*,C2FHe?DރI/8I][:`t¢?F515>A!27уa>c \jkt>P^D ߤF =)G1|cy5Z$PD JbU8rg[B$TRD.F9b9fP="݀5y3!z(_GRsK7z -;džQ 6_ڄ>H__z:0RS=S3u ݻ#z\k=;%n[tF~q7 ih/:⋮lC岮N]oz`zT"j.wW1Q.R`XVäOfN{4C~C9zpvSw2_EHuu2qw4~ OB91IZXf޾% H@h(P8/&]'KUp#żο>!au6}aJ.upH Y嶄$([~^E`ka6P"+0qPQz*z]}+): w(5ޖAZaƵh; - -SГ3,㽆ʇdTC7BN^yifN f98A0/*i .f^ ǩ~)Ir>G}} FʪE_XW:S3}@8JXf!"2!ѹin3gvؠd\SƆDG!g3i2G~"S@`c[nmA@Բ.Q)2(bgΝ, }u%\}(VC7$J}Hh11\ -90[\,omrlkZq`=4xov5es+?tdAqpa='M_ : 颚j+5 LGM<<Ġu[/24[~w!@)qR@#R Ĝ۹ϓy!M4FBz<W8Gy.s/)\\6?SB it#vby$36r%d '̘R#Lw#ÍiEPYKՔt5Sd}>C_*~ -qltR#H,"( CG{̈+ r_'Yx̠WutC:gc:.Z^%5P3G0O!}-/zSA-N\XLXvz J8Ԧ N3bL^vPh,FiPM;G+38Dtanu5wZpu#e42έ ~\ ʸx朳WִjC`!Ʃ [ e:US`HM]wRndYɐJ9hU$bΩ8<3tϳXbуSS}K=j%hP-@!(7D/|:)$2S}["{ ^2|Bj-/%D\D˶e䐑pTK؅5F#L^6~\[C#] j/,Mf_!'m#~bJYK)N0cZtĪ.IŌ|3tZ 1o:0茇J+G)~W0Yy:efB2'k ,UXa6{cb⢌H@V=4`=>}޼d׏'IEl8l4VwlX2 Wᩧ3)z!Km*.X)QnYXYJ8(dLWjBiIc7/]ɺ2:YG2SBeo#\ J|M,7dBV}Z 3CeXiЕ/!$BR= c rsW ْ>h#P#@s@{vJ\kDօɊ/ 3?Pa^cڴA tO#ѫAqra ͇1 6??xr$Z@ -, ڹ&& -G8,q0ÈT_Xg2-[q3$8B]J>%flө/P,"11a~m(JlT/aBTbhY>TʹE3^82Gv&&/?|6(y{8[1%u͝s%p2?\b1 _ - ^%G<HqKmkLC#b v Pt[,UYc.f#s4&$QƐL@Qiv4Ġ؃Ѥ#AFv^XtJH-Nhk6Xt=(!Qj.35ȑ2X;@AJ'%Р|%gf"F^ҹf n-VhF(φ'h-W3wk8d{Sǔ)v ,{,I PMS㶬^-PRM% vQ@L9zh̒i1 /5h{wpR ,"򉡁,rFCwcMѹNNS0*ZTr<`FZ}k?l~\‘(t4{OoX(swW{Bc \#l/ӘФMpIDM hGȖqv[ |'RSdQ\Dר_4(c]zrps:EW5# g5**y.bM$c:愍V";Cf1^qIi.4p2" ̢c\uas=oh3!>{UccY>N($c_ʼUs+5١-RgH.<+P4/Kf""D)$Hf8J=hzH0Ùq c8ހ$'IUV^A` Y%yO]X*I H1QzZ[&etNcsM/ z6o*O/<pBg0,) '4>HGm RMvPYU0{ -s GLFty^[ΖE:Wv2"lO!Rk&۴6s!T!F'v-EppIAV@$][ -(Er`'"w{ ;JjF2J\GtPGk=,c.ƱmrI}9m3kD\= ,r/B)aM+[J͙\ȋ[01YTz >M0(&h;n=WʄmEfCxׅ!]T GO -촢l^c,,? -pGhT%9TVuCD@ !b!8ts@hj_J8bnX7Ņ( Pb=cRӼn֕l9zV4+e~p+O#-;m}AC+8B>$Zldvri"_/-a)w&w@BN\JZmLfBߚMũjZ^Fkc.<%Pc7\ 8̸فH=L62j5 @%XcVbgأm?"R!g].*+>;`D@B_i8D!BKbCMTL~,, -O1F.)AeCx+Jk͐Ig2a u~>07%F@@M~^*]HXw ead"4M@EeG1_ ڂzu4I=gon.(56@gl:;pz@Gk+t#E@2bd v,>dg.5/aoxXة"|6^DpkQS루)j9vqG<6jÁ$*ېj84" 2s ^0`<݂.[_N 6RgM!1'f)+XTpXRXMN.9 f]LHLU#fvk5Әvwxc̥/pCHҍ! tTBycy)t(vKY }Gd%;^\7~(?#ėhg`1h_ի(M%|֡e}z|VZGj`_ VX>`ִ{07Y2hbJLUKէDK,i/8V8m#pTK- -'uW x;oFte_O @>^`ΰ4 -&4:= ѷ Ii~`D -3ύ bA_qD )⋽:#( -KhNp9(@{`$)Fy?8cYzBKy*.holFyW w9~FhHO5|z'mZtkA|E$zQk”^+1 t |,jh\,7QK'y uX1]ZCȻw'ԁIp^(FPp -bZ,am-})Tgy1V!7D=Un^ZK(Q`%7*g@B11A6"A93f] -H<] `&*luh8jq1ɔM:\Zi.C <A18;EWɂT cDxZjRq/K3Ԃ"=_ LQsE*RX^R ̉r,de >Rc -NrЇd7Fhj68 ںxHth)O3$4(GLlT ?G XyBkЅ;s=洀O2p6z~©SNlNT<N4e(Z:f-֖LZ J̟rĕ1:,ȧIaF-=ڱzos^+s@ bszVYQ"#,9'3cۥYIԹuw B!dsR)R tR Ţ,L QskO>C?\U!ܻ7>Ws8GK/BˍE|Yk/0ZaFם镬#OR/:'&V8~ -ڹ,(^>&@1iW[ry׵jT":ˁ=*ݷRyIčKhi,gunXDZB @ .]]3j\$AN5cjn}^h.3M¢fu->p۝V/0|!GI})k3ޚ`4R -g wSCm60E*Q{֫KrŧVR -IAnԃ/Ō)&b5st%d$^hh t'8)Θ LD}}$9u6\liƘ tp'=d 1I侥x#1M@H43H*Bn56镜)/OU*7bLu~FL0wRExTJxg*_gPD!m:=L / > VUzeޅ$ {wvݻ" -d$(.[zՍ:Bp܌>B05Nޏ[4`BDIL>^0t -?dd4d|n:DtN߱q-GZN)HTk) W04JU* fZ 﫻Mֱ 'z`K"QF JT J;(ԜŔu~`B_Y<;7kՕPv0(0^!uƂi -zWi+&## mQ2  S8=b8 m؅3@r^ŝY=䒣Iuz}yamhc$8Hz/umdT '駲jtdўK֊!NGYYv.C.rSö%? (]f{7ng-]&rpԹo<M44c@[E4s LY% ֐%T!:_ZL8vHK1.vI Duc-F,7h%zHF #vU. >`%u,LXt(aMNekh?t '{;f='dxS?'`h\Ɲ9/_)Uڃ/&M./PVa^ׇz5HH=)L2cJ"?Ԭ拠lKUʸ"K^,L$Fkrs,0Zn衤v,>MEwbKy8kwo )ej(Rziq(ƹ'7)Fށ%"4 ԫT*9Ccٴ廩Aŕ X){x< IRp4:eImͯIWB?zz@lwE*ʉVL(YLh[=\PAհ6er[B"C>uՙG5"w|Uu潕ӌh?T<qPzXW^=l3 _NB3;'tz]7] Z2zD\g)Y;5V)+# ѻʝ Lc6r ZԐUCcgC/H&uxr+!MR=_vBe*-H=H4zQDU|ݜ"ԡy"c=CB8\!^}9j&gJ GG=P81 9L1Kl&ZY~fnzwk Fj*&9ޜGnmsԔU$DAƻZǩ\g* gIᠺK`f(MH~ KT* e~ ı FӔ@ !Bg^& -ux5x EZ xY#4!A,# |$u5n#7 JAU}r)7^[xbcgʦ0za%rd$L-W9vq5^W`bP%j;-TK (]_4z=܉*|LmΝb FQMm!@ɀThDc-u1-Y%듆`iXγB4O%!UL. 8AI헨}9xmYyNJoS}q`-4U?b~-fze(ږTϽurfTէ%ck=%M)҈0MPwV6b=P8ltŏW>*\ۃ˸{1F5s(Ex$~q ֲTU_eCWh5DmW8u:cAUZߨ>)StzW8S/I-_ Z:Ԥ%8F и:(=r0ĚVJ~'apSGkM0 -Blle'khA$NJ=|okPԳ`?WRv(B.ȢPD;VzLEEE@L4<#c5hޔ\R?gwX %1KhcO|{9F˲"SFHDeVx rԶ׹ SˊBӢkr=e0F&T[^kh8~ 0TyՕY޹1qWNڀ匔OM [TzZMbUB}r_LXn2Ygm+d%Gds}w$?G\T}]y) h|0['֯/|Ŷ]x i!6\qY\O -0zm)&_~(Ve"I#oi'=>6=(#WS/5Oゼoou^!VOm8RKʴe{ oQ0ƾEZ,ll୐xBD)uP#"Rw%ɳDp 0J|1C4Ãka& W^]/u#ݣ7vq5쯠BўPujğ}Jȍ(}m5onhF<|G8ol{_5$σ) 39۰O"{ĕQBԦc3i{ǜc-~[jb GqA{{AQ-{$66 -5D -0}XaZJF*2==Eꥈi?\s;\9.'xĊ[&f?p2Ɂe;%VyfLOF(wF H-Tԋ<$F؂ĽĴ\Pn)e}S jX2|()F'`2B{ /&O*k\6%w[̥F;&aWl'U ܹE2'eߧ6_ӦvQÞgK>0SB;CNB<+%Ǐ(B -,MQִ*R4!M,K b|Om9$[$TR d4Q)=㱜B=IUԮ.W -˔=T{ރ`_; zB5A{vORmUJmry­A>kS/Ph4aNocpIshqdGRrطWуRԌ60 .Oi?'<oG٧3r3#&.j1lJ2}g0Sr-GڭY~QQ(iwdh^tħ Vm6,͏́?D6r^ٽ&zAe/$cMB(Urۏ ---cBġ?7joDzs%yP}^{?i^֪Bug|Jv&7e.tlLTȫ˛_eXgLY T%9.Inj{muIw !#vh+~ykL&"\)X `C{d%rW˃XP;AbpͰ_VC/Hݨb)9,mv^M!9yk?PLb@Y< -_62w ɭegwUd )9>W`o -YD˦^ # 3,~(.-{?DWD %md& K:",`㨇x8sT%V.CVYȋPʵ=bC{Cm==^osWA-Rryf4?!R)SzNL؏Jv366<~6jMܐjcl@29)}~GKQo}$?_uYgKH:sSIp_fBV҄z;jзBȺb(l+7YZT}o]H{N{b`LxKV<(ނizh@XY$y,=n#wi֎_]qBN5AϐŝƢɑѸG>}E 6#2A9'hee߽>j+./["ߣ0R4Nx0}V2bկ%Tc! RJǦZğ.Texf{%8'^jyw4qIi HEQAl0@ߔY7/@|71=`W -ࢮ_e&xRs{h "O*QuOR^G -MHΪkdD|ejkFNvy3XcIQ,Pf˔֒煔;85ؙ/*@4Hb]i0Y"b/k&ן(+Nmti't(8+ƒ%#EQD$OITX^&б7JqeQNV@rU<9;j5`'!Iv)U~'|:Y9~*bQaY0|<f)(;}%\cqFPWO=dli H#KT _e}nٚ^Q%wHl!V)d6H\ - M9u-*K[n qЁ鿖L:;e@Get'2"#ڒZ2Xr.b]Xz8&z~+d.$[<-fzUmNa]鍷-I=|QC83~U*%x\ܦ P[ ;ĐIqft ,DD6ƺI0[Lv3k \QwZ!js+H @Z1Xp,FDJRߞgOeH/>y~GJ7󅱳),!IAʴM`yeez#lWW9/R؎u'wÝI} xq[G6.r -#|9q˔ed|FWxI?tz0dl&ti;H#ּ9J )ɏG(cLA/XݭX]W~eՋ<4aCjP?X$`ih30?TNO$4e"pi^R oY )q۟?۟_ͯ~___|o~7?~}߽Q _|M0cXb (wgs *dFJJp(JM}3D``\d2\ --g~ N lJҤr*(nye݈>%ЗsH4?ײB) 2AR9 KrJR8cHAIo-iг}xˡPETd{8ۥ &o6V&,0\ڨ@+}XyHFxpVDRB2'!Hs}Za )0A56O0oρarFc:=޺.sbYƎ;jF&. -+&dY ftNӞLF~-3'ZI'֛%+ymj8~D‿JD[8_a%׌Ɯ'nrm"ڛxZQ[WH7bt'8@엤D iRoRl6Cկ @YU.`Qd6`{e""R>AiWsXAm2^D!9jr Z-L R(tic<>0}&sHqG,Lj$x|+."Mq@eY}股, @U>raBy+'+hE -b<j{Aߐx,UMz ׾z 7?>PtӉ%K@Wf,i05?~p`#2ce)zSk!b  -lmP +oJj+Dmu6Ҕ!tM7==gqEyُ|?BQ)S\ Yf[=vw5{Vv|s8``{(-zXl; 2À{?#K C/yŦ.$mf"4 oux(cŻ,=ыqyh -.G(!zurUdTq?Ql59tc!U4 endstream endobj 36 0 obj <>stream -Ö8{@үY+/YP"pKFU(\l> ^?$D *#Q..yr(mȺּqmvU~VMfd)~u[%ggKe$pKN!p1Wﲩu͎XV W_ A/W/v7|ghӴ[%&7*€=Rd`D/1ߠ(5CBZT*q aqr}K5bUW()*;pF.\8%79]x t2Ev=iL>茥SX[v D KAƒH)mZ]tz!w)-z*^Hr(ke9#Qb; 0rX.]|`7/caⲔ$x­BF2Z`g%Vo .U-T='tA4 ^~|$ӂ7y^MӖKboMh -~s=*z7WLS@mڋꪟr -#%)s`PT]q ~~CbNǑQ}\CeFq5ו7Ҽ?TFs,+t|%xzAYqhKh!E`.O%fw蟮vܾ[УN AMep*a3}059xaK#En$H#DXݶ[ޫkhԱxTZ -$}S> oVo<ԛAWޅiS  ~]@uk80 =dzޙ}2pErʁF<}P)4o|+`pp=szJ זs+>{4{8n.ל){w`qvM%, Cg@]nu껡K' u{x7yhgQِIJcDޞv?)HIH=eI}2 Rpn.?ԂS *d\R(.T¡*Ɍ(\v\-b[9ATU}$4(Ad/~2tXChsѰD}b'#epԲb-Kds5%T$Gӄ=,qm"ؠ(}{vv+@5cOmp"^xv}˔/\-"Or(~u@\nלRUn 'Ȍbể(r5J͙۟0)(}yB2c1'erɳ[X+_r $q̤C3;r burK(R~?|>8EW%ۍg@8\q aCAHr?I; GLجO{M-0| +fJJ{pJ;9De&KuMs_sb?xnB@5Qߓ@Ca44A wx?"Ն] -t8Ma -Ů.eO(W+az^fBOЃDTpm°UWE96颰9W߳gE8GTdYӌf g{w[&V]/>>s m])wC3[=Jn1RF/$Iԭ=7|a|Ln7 >_22:.!jw^jy/a. _"-*v^Z~)9hMnPSUt^+[PΎ‰bm{`|)Xnw HIyļ BWuUoV'<^ (MC3 -,%+OY;njqGDGf!HpI7g+RXR8)j#D. ~'-%$q N_tL9d;o(G1j?ž&6N{UH^ONnfk -ѸuPnz;lV%Ba)}{OctCeW;{ -^A FWBmU<}Ѻx+Zw9pŚfq_"79,JJ!vi&۰|sEV0-g#.lGsvrj@Ҥx -B =HqM$0uڮaV0F((KDqobM1(`d/س\%1 -(<jr$~^eǁ(0sBK m3-bTLoo\958,̕<*j^1H Ԝ1VaMN E擼QtbTj{PQi0 CH]I+Ps= ˫!VYby˓{\7Ce )!9P?[bPL\nVq;_ -]qh1G~!YG͈/ODbIa5HO{BّV H6+Lb{*S}E:-I"SjѺtSM2yR=Xa?HU[^ H4-$84"Bk{KCu P<:$ތd/#̙O:[%m8^KFOl_rSHZIV 3Qԫ\DBAġܫ̈́9j;V2DF8%n)N.KVu6 -FF96I<>;W.H("9iÂ*9pG]vtI"EYQ^qCbTV X $n .F?e6l3wjr(j(cr[ <= VuCaWუƒn7sDgV '&( >U2vPA\:MV()zGM`O:@>8}/ҹKJyrl#Y& רw4硦I1S@v`BbRn%Z@0'э~ߑ0B5@|bz $T!Vۯw*s#+SE2D7\%tOɄ2 Pߟ §U(^J~H֣s*-NiRBPx5aiaY 2ba1u]Xt+&~z(RW+jUe8ЪX{dRq.RC5Р8)$6=$\73< sTR -~9UBt5ij؍A!&?NHTS5.r#*dJt>Q`SԢN{f2 1!Dn [JYq;x8FD5) M6L}VKna=QEߓk4 ԧ/3L۟V -Bѐ&[;,ÄpƐ=!/ @w3PHEl90GڅS:l۫0A0EމBb;BZw,:dB3GR EmXC8*0Z\RtQQM3u/Zfj -[]RyIC'~"cjcv~T]D}5X 9~Xi Ds]_zV훈qdJST$Jn&,At~Hz]k2~xTJ/E% Kr۹z?@1L܅\:$rN"vTve{R.uc}Z9HWL%˫w<5,E̫D+B CR ki"0B[G=KVx &Jc%0n JIS{ A6 'Rbbn\=G4qXN}n"(('JLLs] ,= veYO!!@q8np T\q&r-rD*Wu,[]zΫzxMqIzIMP#.%keӵ07)$p +x3qI/[=ڹs8#ۅ0-G)t1p$Q;tG^%TBzRʏ=6[j9"S#(+*b @6G#l\&>k]7-wN`DNpFm+WBwVהZUe/C(맯- \^zOaqvG'I:Eٞ[=;N#` Q2b -8M,+1;ܘak}]bB+tS4=۹)(Gj!(aa 2t!4eCݍ+6v_^ѭ9(8n9BxpɼKG{z ˆ[9WPv@ypnЬײ>f4\L9)oyy"Cbxy?9iN<%AQI`-qGV|> -%(\@(p -5`)=QMޡ8@AB.ǎT]sWڒ6/cDNAlVeTD)m}<9娧}>XuzD<9ЃKehe~8]R{9n%:xZ=OŮ|ZSeJ%XAkx_SH_{_XoXOy"=)Yu*|TZ#!$SE쇝}F3 |w98}lU3Tw  -ՊA{nRTuN=n{CQZ{(7:PM=&tTʬr%C-:vх45NѮk?8yh6\ns@Bf!|h'A)b W`֠pA1kt=nwtq<`f+H}.qN5*=A8WnN&Jb!({s.Bݷa@! `5`fJ0Il b/}TAb,Dп. Ky432p x.XuЬ(# ;:A|oH9 -+oe}8sO2$*KF3AKHFZʶx\19BM7"nopaZ,EnF('|XWHu$80&0Y繐g킭hJRe$< T&REV+B s VIP\RH^zDia1Nx J9U|)J& doL&>ɡg]n;y 8WX42/uM7SB!Tq.Ay?&6b`܂Wb@xojىW_,$Cc_Px=G]A  , ?8kI13 ]PƊxX p8 X{+Y oآto|BO6$d00fmЍGdU݆we)w%-mn@Z[A6=_ü8,@,=d-H ]:z.x7Ưs3fH'mlJ/qZ|^@^.h {gQ:Hl/CU(ёl杈}J ⯈삌e#٢ AsB'&OU:XD8Շ^+B\5VWIS/#mئr%IC7fK%:jC(RpwaD$`S0vr-I@ek2lBs4^%xUBRd,VjP—\$N.K-2Oe-VB (XHBH9_ag8_[5M\՞ȤP6ܞe-!xjI m^uMN52Q΋%NB9$:㼬+*jCN/K^IW g( - lO͌(e \l<}K.&e' w1~<=:%4c[%֥b&9;@\ߛ4[QAow L@e9"B]0(&uґwLhb,F̻yF s4AnoJC6{ /e/$9C$m%,#1&tZ5Z/T4+*R^zG`$ UԌAUJPo0vGKo ةpre7Bأs0"?>q{ 4 YSIP_^ do5 -:S'zΉ˜?S~PĢH¨X"BElsʬ>TCIg5y? QC[&J9$=W K:`H! .˙'N@6*l%'8c(yKC辚/HPw[QNn*$;zw$5{8M9yF3ǔ"P =e}T5K$XbK;KQn_Imká''j?0Fx`z'Ez a:>:\ٳ%odّJn)R6VrX/!+ܡpRZg48ௌ/(-;+ğYGLk"սKn`~E7KҼUnDl9"W;.Q* Д|m5ϗ̣=ǜ+ -Kl\-d?B*@C9qqj8LJ,dؖ̏#(nߝT$b՛f]GmS"5Áuxj\IRza$U96n,sEH;N˩w _.W9.͌jC'Y -}2F i` n`8:>(gQkȌp.ռ-G^ bɱi p01 -SwvQYje,B"A)#uʽ$#YP&B W>N@%OIt1H7L=?tH)) 4vcreoZ0pIbtYXh%J*#[?ag^Cco^>cHDrpT0]i%X$pp,").V"?~渾_`2;H5^E;NۖEIjU2\,@90N -xmsG"IC%v7-Edဧd$ ʟO|eH%(g9";A}$f;dogDo"-c!I:ˏKYmQGK.r N -~ V3's/P12-pPgMP+A&M7IB$4VBK.(;R=vvSGz|? +ⶒ@J1Ui4#Л&db-N`fxPcJ)L5D.BW6=EvYk/$eؠJeFPMߑF/E6O##q^';V倹d66Ca5BgTb5b>ȧ -Hk=nگ4ֳBz yyAxXsĐDBBIDl(:!gp7$*kUt2zN1F煭ݡռտ"QrGۛ,Ԏ8{hZ/^ک~XHEŦ=R&.3Z Tߦ!>ƗCѪqb~B3°}[g(myw*w:$)Z>n Sbz -ߊv ]஗m:#nsC ںu`8DBUW!:%`jz&8&o_$[-~/ -F;3n[wy1⭧7kBlD%2Ms/ a9QI}xbܚ2=-G :H@Y@K`t&]O{{@]'>نyle? `ӈ5}q*ԣ@: S -gQmqf Yؑ-H3cЅO l%l# OrQQpb_3lҺTtҒ{\@RAQ忒&e^S :\"Oiz;(ge -d@YO3 Viǒ%vzU|["TxvC^ڧlvmd֬yQ/?*k͊!t7v83t_D K~5՘MȫU5jj,zv_Blam=@ Vp5"\u㨇=:$2tjA+ށC==b3;<|)gM$cņFn*"ie YGB-Pi]6S'قN{Vׅ 0i bUv-O=Ghy> @8*]_tbw DUJy S eE0:m3/xDy!?iwO&$0zg.LM XBR;6b9"AyzX.j@吥 -dt/K' -KN@!1tOaYÁɦF2x:P}@`)srR B0z8f?]t37 0ѣ$uu jłM|+t I VPǵ⢋%q' 9tJb&)ԖYؑ_h  44$IA_orfLu/t]K،ׇ̔E꿾م\l0V/-bM$Tռ{#IJb,!%[@uSv I+ѭ^1;,4'N[@_ `٤v&s?EcqId @3$Y:Iв2M,sm:U,(FcxS0=xՆx`*3q:A\/ ߼!L\)DX()![TP aU}Q.b' 'Y71$i7HC*vJ>VgLH=004Lh6k,TcѴtO "?{y.Ffs2֜C*&4fpFX -+$C7]PFdH<׬ -jqK`~bF_P2Eyc@$JGqhAjk]"kӒ=~h -T2n~&zOvWJdv/{P@?`Ň~u'@HO_/uF`]59JPph iJ%<؅n8!|)S%劅:Jxlztv V\[R2\J/qY۬' ?ӈoOPfQ9Y# J-h %;1S 6(c/nv#+Lv-pEqɨ['$&Xfp -.O.S"ku)>L{i4'D!,c` -oBҳ\ Z8ɜٸkJRHXfZΩG[jt>~L²2fh?j_nZ,*ߧta?EdC`C6CگA -]+nah2A8t$[en2 BK%.kg(PI@kB]@i/Fp"Xk+xJbd!-XR%G:>/P(i' Uɂ1LTÔ!4TDM!Bѡ61l8P}K eTo?ԢP3n"0^yAf q'sN02} -IW^$^A(+EE -\?Rc_5qXaC't,xud{PnS׸ ~닶5neo5/~H;bOxxQOKk@oK_zD| Sswlg%/47QRI"JK -NBւGSʭ_.&H \]ћb蠀fcCz8,|5;Z@ lH;}E(%AePNP!+H]-_GyM_.t:ܫ)s Jt1&}ZuJfD*K)ME4>b&/*;☣lX
s.5pu;Y1R[y\{dV\0- 1:MPma~跹p} <.zg}Y殒r'onhw)uJW]R%`tAf5yNvg) -}nYtyJĀO(9Y L[~+:(*Ln+KCyNdQ0_mg|\lLKeUS'gyPoBUt[THp{dst9.S@h<;8W0]ቼ9h(Qm()9 BEut&O<%িBVL^m ciˎe[V(ݖw w+ҷS 3㔷??_|~~͏߿_w??d?0#g?b?}ͯJǿo}b/o~~|}Xo/ݏ~}?++_oyťgZb OD7_:ߝw/}Wg,W?|~q_H__Uu~_/~ -( |a7a~oC, ?|_C@A. kTXH ;Xn7Tdl($b(A4jxakvaP3yhDW 7etcf -onD(~ɍX;cŋ,)D#;_q D+S ֕;f;cLt}x`=wD9~FWϗ|u[)H )n8,*eZ=O'`BBH!QK煚[ =NOZ_my]qǁgsѳyLÿyb("ٜHDѸ?h| ?G#n㚋w'sD>tGqEdH#=[[AW^{AWv0+?w_:9ȶ:P_2Yo|IdѬ[)-)h+`4Ƣ ?s!w,t\j{F~v_шݓwHrm}/eX=AG8߈K@h9o~㫗z{P$VuF-Vǹ7'j6n H8pgq+CF$1k -/gAWV $}jc3ek᫻z$t|LY {M=>zb,L9~7>9_ݰW=~h:<,Xrgn_4jE!)|~hY<-ީ>}/u:-_dsoRz}><5x+#guG@r-m4QbO444zRz#0-] -Ln|_njGs}9ӷytKySfa{y-?ZKkyw?C6_][sv g~udzBNb@j4 <.XE\ ŅxAKcok@G 'mr99hxh}3SE4߹ɤ@}#ra3\8l+x} -62>o`t3o9}>b+Ɗ go_L_l|Hb[ - -:x-'~Q.vn޽h@Z1ꕏAKR<^X@>Z@qAhUx“ѼWk(O4_껌¯/yWh_2=S^Jcx4jnXhٷzc7\e[G^sH4֫dh%}DJ!OaBܾeEh^}ϔ{vyΥq{ʠd>w>rȒghEQ sv7W2,̞Wyט\y4T|][ D֛^:7[߽F_eb%xN s|eVB-'0XєNV,߯5mFt<Ȗ3l[[s^g$mfsWґWb^\;^ؐ,XWK(m4%'x6tQބR ('/X9^H'q{IeIǂudaUY5DLg<՗a2HO6/7ֻ9"2%_eyfngD1I3@Sx$g9 0]66~ίfF(fu+k}_yE؅g \/4u2ҒFkpw+-?t _^%j#D\E]63Ot9h[Ɠ}kѫ'E @B"m=U\8;?y]اWp5ΎLƙmx.Q3$`HL1 '۸7Q"~ dsgH.3xϲ%PZYSc[y(Ԟ>ypc.o$l'ONPy邲3crx3{Oc ly/WS (@dڟR&V<0k퉞Vϰz߹k9gU0):A]ɿUu);yPY#I]_sW~akq{ -ߍLJFYϣ7C{,7gsGבynVmDud\]y`Z\7d@h+<̃g!6z垕u6_8)Rq2ZL%Y3 i5r'j&ί(-:J!?o4f&4R7Vo Q y)yPI42 ̻xEd|2_Yn畟VF&lI -fl6w5/^.DAdD!?[}2ie0!Z#I&cu}8S< w= (X{NzrٵVSg25F|kv -=Xxߏ׻zo]\%v"gA@,_A^tܫLybvūMu>7Z=䓮e:.Z\9vʌ-&mK8H -sXl2{_I}ڈH"j=EuUO2vۙ9PiǔՎh,#>#v0qLwc 9@VHw~1O vs2@+WVnj}4yewwi<[WHʓtqX'L;UWL7\dH:eؾW#El~ej}s5lD;Ni8?fdQ1[Jn?7?GߌD7ޑ?6l,w!==Ov 0v>g2?G|Ƴ7Km-*GՕ9% 13Sy %8ɵWap=<9_m59,'ؽ\n}vƏ DRy\f;g_:qOfw Vdr [C#*o13ߨ1]`6gFa9żZ̺JwZJ3*4F\U},8I>k=NMi?RλF;sC gm'y,7*>3F! nlgPO*A zS>P9OOkգpw+-=OY"CzR8l<7EƼn|Z~VxAW ֿ udew]k\}Uoů |sL ŝ+nUw{3j}F=wI]H5X|Ω<Kh8nָ5{9#9.=s_goyJU4^ d@KapWK@Y` r1ޙ[~|sgYɣq-Q} M~O=ͯlœzgCW1Yk07W]yJprh.kޅ]1~ Y.y~:%arxĸ?P9U45Ϝ*<ϋ:وg~JcJYD=N)[ܳxSlЈI%D_vsM&^^cMn~)֊eU_2%u̬5}OI& ī't=3U_/hzxnŦfߌD2}RuLwsGYaXA DͮhiTquxUwڜڋ/:=neГ3@9NhϋT _ :kS,es̵yibSfb5sW6f_`):|yQ@\okDK-%9䕻F}zۃ(8ˤBdlT͗Vn~zB|Gݢ`V=q[1C< j_8uLz# $EL3Zϗ#"0B N)G\:~ae8XEw%V׹7I>uesOͼQ7*ͳw5|'*\xɉWJN^zF}w (fӷ|_9_ -ZyZ+3#nkƔ됕ƉhȀIO#4Y}dq|'P -5/KE;q:u+:FE|%gfX}mW\0"k絿OXޓH. -/ter-uHk6;_a!4wx4?I4NC\|L.'X+r>{3 s>7I[KY#Qsߕ4ۋD_{Mzʅ|{\rmʕZw$NtC i|qdfzzbJXz2w"}k>{2-Ӣɛɀj'w&у1VJ8(x ^sUoX^Aǒ㮕qk{ɜ@,qG"cG{$y5pσ|FFfhTJ #}+|jLlА%zΚScJgO_)2w,lA9ܘ;1(5Uqɧ;2q>Y|g^ $j:m4&{=SJP Y_ @;מD6cM$*?%7,L.;oR{SO|S5cL4S?Ú]}P#) CȗV BYa9zdɡC4W3q57ϕYVAM*W2#^[7y݁tEJ4I5KH1@otRsq#jB̫rʣol5X1ցhU=7Y#&Lmgycc)_ssX :3qc澻uݸ <$˚SⓧjF=&eL]vl^B[ͼW5l[ *3_e4ާ1&)\N:UX` lά+Lg Ȱd]\tN%#2F}%RGvXF $u^]4$LvvŋHyuMۜĉF` rRygJ4bCWT8 n|/*m?/=1^rX4GCy͚[Yѷ9Uצy]Oͷq8GYdrbsz" k 812w9NOzsG;lS~(d.3E[V2<9O2>ۿWW$mu'7U'[Shc&b  R'w%o=Yi?;P頻{}aP"NJ'tH)ƬjB}#vܘ$\e*nJ~HDdW?ٗԪ[<3s7p&"ѷ4dRU7d.3~lӎֻBo֝^^Yv pr INdXup Ř4W#ڝ qld 7"L{܂} 1[fgHS]u=)w5Q{XʽF}5"*I8PTdM5ݍwP^^&5eTeھ G ECBr$Spb2P|\AUN8qXuP8BRBE£t~'U=*?a$̂z_\k*2L|/aMō ЯX+S(hޝj,lTQĀMفX -l^b{"D,e v fP2DBpPf+'q}u T5Ldj$nǓ*w"/f*%Sa/AIoMq"PD 8H`p↸RQ^-웃 aLe4,>4K QS1!FPU) U*_e焙Tya@+LL bA:(=9YMBzmzbT*͠Q8_=1Fb䦼ٌEhhh@_JKAT/* U@s+JXD {c(zڟ(}5wIKTsڇ>X]R[lR5|ia|NtzjނnԇJ®ZzWP<@]WK5ʣ. t` -M ^[Vrܨ -ʂ7wfJf=C $(^O*SD(' e* RTS~Ѓ$Ta\Bn -EK ! -,[+|.eֶ- T5C`0KCQ脥s}!"ӓ*,-\^huQTU,KդҕMMS .DNp*_bF##Z2T3R+Fu%X}PzjWzb-2Hفq<=r=ҮTY/P([Uqe&}.IլvjR@Gnq|TY[ E.+0C6g*TФNYKH(uCQ2qUFu52+77&}#e 0dʏXDl#U7S4`)ƳD䃛E"hX -u@5#'(e!|ʳ1U1#,MuukM ő5'銊#u]JlԕbuNe^~V]5F5Q?Y:p*w+E/ -$mӚnf}æh;RvLU4UTB ݤjVЁTԒ~BB@Cb"5TUKO E]MODP"%YM2x)iUc@8J-f(>*-|__& -k&o nX@1BB >BE}>XDTr*\xVXV 'Ԝ4k)VE*\ĶOv\Z_XMT51a$oT5 UEdļc=84Rͥu*ň뉽z.Ec(c[e  -»(yI7SS -F[ڰE/ -tE (5Yf(a5T[p@2nP^Ձ_o&JD1Y PNOYL5Qa(zk -;"cSrY CWʧ/b4U`HIzE*k,ZDd~?nT?g S;5vS_7WYl'[]NJOU妿cx۟NqɪfUNJFAQp}jUN~S73 jY]KgvbPI6Zա:BDLF>W.co6CP]H][L66FBa& }S Ga(&VúH(&TQW6RFAB>1 vrtbu^L+! -~BT)9eZYEBpt"hO>RB>uM&=5U%[=P@@pv+.Sj6 -~BHèF*ckYu:,GhFC?=Qua"OU[%L QES7}'0a:P~b͚m+}\,})W::nCqG ɺbغ\DDǹd+%}2F3i#I!Op15OF(Y{ j0tѦ}3hGr<4iQ_H5?M:khliAwp̶5؟rG:ș4LBZrHm3n(~|XDƁMj3ʯȀjC%cZ44itXx&l]1 J$*"S1r$`c¼6ma:iX#ENbnʮF NBp~Zh崇&Vٌl\/X.֬ a{-Yzzk?k@5i5elka.sgnn')4f[%֜3Gl3#Y\ -]Hf[?w8TFyiX - %r[$9䌫M{kN9!gP6 yMT>t6<<-n /z 68o,Y=J'AYc<#'!cA~hAkP.+4YA|T)ʐʞHvmhOE| >kEb 7ȼMh$O07x1aH;?m\Iظj۴O$у)($3ySIp)\Ld>v=L2#A mZ68 F<͟]fZg LIoLy bCG5途[@6(s 捴b<鈺ɴg Qcr3#JH@-+[SƸג㦱y #ٲX4)ϰAcZ, - uՐmբCI䡤{`Bϒtg8w`"сchAּ&? Cȁx~ܢy/M}s~2KrȺ%qޚң6^Z[.8o9¹ ⃳)BA G`:"w-'Odo&哹HWnlTdER.i7.tN璷B`*t}6yp&.uKИRlCW}=x;xKBt#^oo 0'L3KҫR*6$w,:HX@U>οaH{f7=Ɇgs.f.es.c؄jD9haxD2k_h=re_)w]zud]g.U|ހE:d .8m cqp# 5o&,a4qCX3: -7}$% :ݓAa:@z)<Yش]sCh>x}x!Yxb){dւti(u%e3J=J#^HgKMN$<ĝ3dߑ> ="]˝|0bk9QS(_4QahߔWp*`5>t*+.c[88-Ƈtdm)s -] Ag-)~VȖs'*%aC1jc{ -#𺔬 zp: u^0B;I3>NhAEO"K&Pa㨐±TtW!"k'^dA £[`:( 2LJH; ef`9@#֗I#mC{P+0v m"_yoySA>HVL]Ox#<;0?>b -恍VYd_d_@ćd,A!!37 XNZՎ0 -=. 2 zF!| )LR 6.~䦙GGza2;fPHְ"a=I$4W3xhg#+uh$r`mcCRG>]@6tG1?1O/k$31B -a|I HV3!nȦ#.~g0HgMFXx~h/t0S 4@>$ܵNZ2-lG]C-8/f}6 -aae|ݦiN:h>&֤]DNF dBl, h%MV?^^^_Ǣr'ھZޛvcu S*]_Тq2G_-KGw!4.٣a"`||8|(K!nQ2U0wP+x0O.,u &0a= -k#ԟDؔ!l5E1f"^8Zd}=Eknwl)5A=裂 TӫgĎ)W!QA9#56遮] ~!KC}3Gb\Yx`&03pt$(@6Ek?]ذv]f q! DDxovҠcަNu&r28 )1r9Px%46KƾG\:G |݊GjY6AB:i5t,-Aw"8 iѰF]E祀1gD,=g@~:ZMD]C:p"cqp֠c@XD[D8{#q+cl~doX7#}PdcA'ba]58|\Xx>&I/6~MiBe&2\1MoK_۟"^xaB]G:s&<l-6@1 -x,aL_6#'>$];tۦD}gitTd*FҎ/JՏ3{+nv%r -RV]Iخ1G9P%׍̶$ؼQH`M/' - 'M$:A:p|+ҟa1ۅ -1fF^>a-I-~0=Mk^vdl6ZCy$#.wFL/`z" 0U9yGekɫ|6#"k~gk_p -8 -s'0>[<{>'aOWHP/ aMV -2:FI̡_gR!؈9׽H7 ;,df2wwtyTXX:񗠴Q_FҾhl^3ͧcK_Bŷ0a_;Ag[Hֽ\N<0⛦]d«&QE'tO*gP9 7dIjԁuV_AVGԶO_1ΛXB[d\5LlO#.oYmCY}׷YV/mu7kB -u)lX>Fs^PKY¤]ߙaӛcgнd[x"yG|d2aa &ħnW!B䖯s?z8&~<ĉ袉Di]rϋMv[=֊)v=CO 8;xtXriȢ38dyWW=2gCC-U|}p,x6-1ʤFy>Qho7cp>5{g.HT\7..L'$\B|Oh63F;Twpif!kK4Ȧs)ͳ+&d.fSA6%P\僕lUl1@КGzk0^ȮQvhD\2Ʒa`Έ+RyeWZ5NyhLψuGk3l0[&.PMGW:|=u&uxF|xPK dީ%[?%jb]>bbL\*sօDͽo膮5D]2Il=bX1ƖOW]3ycqes#ypx #&q`bZ6]?j_v<⇀ 2G#69*U߶D;?cv͑״}'oyZ5{F`"=s5:wpM6lQ]1U{oUy[=MN NM]=Z͵m!ZB|Tkԁy~ -b 7Dn q48ޝ}B?GC"ASzo5({xнVVwՄNa*YGd욧@s&_«0cK҈6ܢ G 6da==ۻ}1S=# #ƌ٠đ?q#'d`b] -?`ۀ_cUSStι=q\a:|3e&Īج] [&docKوZ.Ќ mD=S2B*v*pp73't&fA»"{cnLS - -q[xa BxjCS^ið~G|Xmnl >O 7i>yhhȶ? rG)tȎ'jcDyj hȪʛWȫZ7v}8 |ooYAbaf.!nMj bK,7X>^/Zt -ľlb^8r >,=7GaBrw3ډ0j\.'{*}]|J>ae|C| Zc\"z`"佒c֜ RUVРw[~gdph䆀~*cƇ K"s'Skb?dx8|@.`m\ ȜI8q6-E@a)Gؿ[7#vaĽy=֓׿^N .a@bǫհNaa=T8V=p FX{-LƇ˙9d .-,$-YWHo6JV~^q3%_+a o@  +/f\4a_ r#ؘ)`3"ƅ*8+ozJ穹U khg&3Ri#!]"* ƃI08aMtֆb=A:B8b=EI)[q;sad>Uzp&Aғg;Qt -z.4)x p~`}2I;fEtԎ)r!dPh?o$ȧ窱ndŪu ,%$.#j .>,kgOׇ/Q%?4;WgUxY!ۆ}cqr9b&׵}Ooly;dFl`9ϐ Y5۷)8ߚ5ZO GO! -psYy C A\$6]Z7lyS"^,!%D8d.ۜѵ旲º2Sw5]zt،3|8$${, 1;*YJ7*:O>izmƶ<3'Z?\N̂5@_0L=:G^;;2S|Zl.g>> -Ȗ1y{1g 1iĄa F 4+:"G5 (B1SL,Hdd -t`6}hp:qiges;xye`ـ*s[˸kp -+C/3,=kB=^ 1!YDm{>n݅C}hk`sgYDM}܌j^GgDL̤к )KD_ a%!f [8޹AX|OrYa|v'&펰A&j^4=)`f -9S#st!1b:k|l ҆8 6> -Utp^986}<)p k@o`>y_WO2v/^! ̘2-a(B -;V|&Lba}왋s@E2ĔOka^Sy w>*8D1w6Z2r"蠢t -wU9\o;AF D_KaIJ,?2 ydUu[>}yk'ulbLLґ8}0.Km8T: -_ڀ8*pJes ]=ð݇9&=֨)C'1PaV4'Y8kmaro`"`? yMö=}̗H^|KM7 ! 3>M?X~N12ϣs3k#P|lFhD6=]-oy -|Ttvȳ_)}Aڀ|=fby݃o@a䋠>1{q, > !Ko6jMQ+Ε"Įa35Y\XD50ǁ" .\cQ5=a햄?8G5v0䢀Mf̩ߒ&ۢ˝C!+n([?ʿO5 B^XŐ "rQ /;I`S3CR%d=c>sH\CMBטƾO6B)*;f;qEW0fZ8pܑ_Kbk Ȋ<6"G+[ߒEq ;klgT?'dψ?8n<q~6RQ `+Fdc.eil LkA6{|i͆O&|l{˚:Q)3ZjwE͔i~l~}%d5#޷f8*džfv6K?.8@wwX!ӚgBcm!M4ZI4YNܖ8~V\2 -H'lxmLԴ} 8< ~)xJ잙\Cqwdۗd9G81G:aL*|y)/`ЊQDdD2nty/ɽXe迷!.}J@;l|YM4\Cm͝r/>~Fᨦ7ڤVx]EcFf@2>9gtU {{r;Vle |@XET5cD?3 wH1D؞nyj}j|{&!}\c2gy엦sO.I4X^xj3.}Ktdd-#y˕DcJk=e4wl"W|xvyo@N@!w֌m`C/֍~U=FZK?j'wۙ:b?nC蒱٣W[ȿ+/0jiy͟iw=,jo7ZfN^7fLJJY5]'mn{6:M%IGgަ/1cchtu#6aO-Ec AQ) 4mJ.O:6Ӣ53~WiG^IvZ'yJ=EC_ycw'Ŝ{DȒg>pܹ'ӏ[趴`ke3O/h_=̝d<&y6SRfH~8Gj sjKs>ϼʞ~̜~A-5O5ZNyaEzNQh>ْ8ђ>$OA樼uA.A2M ^˴ܢN(gDCr}t#] f!o|LvOɝ7{_oy3q9u>74q3O_|{ݏs9DJʑ^Y/eG"?I_,[_γ΃ۋ7mO|vvoZng /-v#g9>.غ-]|VOMK-wp\8{ϛ=Ɔ9N{~i6c[lߘ'RaCsFA~aS:Ͽ)e0c_n ެnyꃩ_j2r^w >JEtB@5t3b{˹s7/3=Orm_-vy~ #GV70Ņ_S^q]ϭ.؝~FVf+kűvz;9Q3fZnAzBnG7khu䁧V.[#7|6O,#OP0W0^Qg)i {s7Gg;oOĕ9?j#3C\bG}?ƿ>A}iG|+#[?m=^e5pIqǺ4lg\q3ȷ]wSڒݳ9t1g{1\N}a-? οW~qoQ^{Q_Sz|s9k -lqK~)x/cw3.UW͇[ܧYwU{S '# u9¥`_eUpb{AN'UR'Ym|e~>֭X!+gd]7lݧ rCmnCm\zjܹv~˶XeǻuHd6 LhE*l7B~W{O1ܗ[ܧ̗ә//Swrݞ{u7&ˮ,RҳX}W#onsof/2G=Ah<?9>9Z~[)o?m{nS7[g':nu>`~do>?oEٶ]Naouyys:} =N䏯r y_]yteo3̶h׷:X$wf?IVxߖǾLcwqo:g/íoIvgWSG:-rKWy/yፂ\^pM̻(ydDسN6*VQi9fGxѧ^*g^N/mܩgmhE!K_xݿ>zzfz˃5v׸:RB9a:~2{=ޖ̇~kZûeU{w7V< |TYYWؾgRݣ+=gz.1m]m9һ:L+l$$F}losڀ]yr3`wvZG8x+ ~. ~S 3yk9[I3@*tr5X&[oǖSVBww}rY.RCn"Z['y-xjS=Y-ϽĪm쯔Y[SJl޵2O;WOҶQ¿jˢnxʮ|>/ ٙ7uuYWXWJهw",cyC[{ٖK^|yʬGp?=a֏MWq]2sGjg w ?폒g6<,n{v]f5Oe;^Kz2]uھt27_99ZUZS(QBӖ:í3҃+$U~~żJV/sn-VkL13ٙw?`N@F]wJ|Z[_,\3ei޽gmq_jD^wOˇ=+y|)b--Jd%vyT-u]z^EYߙPQ0bo~km/C/}/c^_п%ѿ%9z^nSI\#kvnv>lKw{z&aI}ɽԚa Y̓Xp8]GoGSmL[QM؃WJO\) -yRt -Ň{o9>Z]ې8!yK9)dOO{No{>o 쮨(_8ҝA)5Q[6d)b]S6]amrRg7ތ/Fvx;YE]MEN={'oè_w;{]_J|Ssjl[EGƕW|ZLe}k̊7/ߌ,hE:мO]A9:u3eioί.#hGxInWrlY`>]-g{o[s֜d$F+%F+$K-Kɣ85jM_w-;E/1JFiť+Rvl`޽My} -W7\K~+t e*YwcK/ v3/B -wmEjR4~c ]?n8oYn*T2s; F_$c%:$H[J~-\|v芪OSvw。6^g2خ7ܛY/eWV]K.iXjB1ҋ%WJOތ.Vd᎛%HS㕘+ -ƗO}eyng꫽U? *9:EIhlH9,y0u$#%%%$-6z/M?Ze(z_m(ڰ]}V-@BYg3K/]N/)RRq%tK]/9w9آyfl1%D=ȪIg~z.K\Ӳ? /)[w6ny!9mz* 07CDiශ+aI~5N2q"durxn|F:ʑ{ߝtwEĒ+c -%ވ/A:9voO'ͭ%:g>{}?Q+kqLB3fhm ^6޶\eˡ %/Xvj~kg/~u* -GڶTҲ{]s7v~Vn8\^v9rꢅ+d Ȼ6JSØ%j⟏#sol{?Udd1!U1hEH#㷹!o>ZX{%f@^u%ν+[_7o49cnF]׃wǚp~!sNgi6ګ?߃UgcI6B2{<R\3sAjxWJ(3"V|gVb _,qrAC<xUQ;m=g˩˅-;~TʗIzFdnW~zyǘjOpL4CH\4L֥fGed[T<[zBQK;n]* {/6nlGhm3Mw_3?g<Ƽyj0*LT3P&Y *&xO21~2Ҙ&Dj@kl+@/h8_R.^yK n׵ʾp6&cOc_ًwazzNӳq͙WeG7Wd5ؠW z+9&/CSJd:.GzEPg!2ϵ ]{&hpdGmXi#x|r&:͎)mށcߋ]*¾Jv}wp;o>cd$ .? )0^V@5"D~?Uͱ/& q -2]&[68GK|7?)7U6Eyǵ.py.UAk͗?=w-ry"7Gh>?8j@S8! ;dfrGBdf-Ff3M,ַ}tEH͙3$ojkM87ki^҄V=] nm~U~WW96 u٦j։yO<:|AmL@T'#3mdfO^fќh]$~ yRd>FgSh4dꎦL"?[$jE x{r洽ANy; 'M)^?3xH6q,24C:)p2ղ"7퐹Z4mŠk3LB4˵M[,7YFԈTux1rr={j/6qbk/K{^(xjm*7=lG:sNӱ\Z#襎cT}ӰEN"i&X##7ykdeFKb5hf@#Sl#ڗ=Y{P9 qϔ&Vw-ݼpfN7w3~xYVϭ{9]7{j+X_Kra-*#o1wJ{8Ƹ'{oiᄚ=Ў7r1slzkrk['ǯm|\99eeղwoK~krA˗rGnf7Pz>RJ^*~O2=^[#,p^{pM = <}'u|5]1>Ó4wdj#Ds\B -"iZW;!庳x|(Q:[U`E"iS48XS0⹑sn'Kq~e跏OW}(yꛖ~OmۯG~7ߤHe=}8s(=kw[h٥ɰ)2IVf=Xf8~:V"4}~0E=2-ڄFh4g;@ VhU28W]u]Ce[eӯy_ﯗx\/}}J;PpSɈF!'ro5_W3>dn(;m}QR|w{%ϰZOإ*Tm8 LdnZz!{99hUlC5u_)y 7J8]@u4+~(LO3RRR2ukeW% ߸F-ZMJ-ex+{'O(W b^zu=IOׇ `, ?oe{lҙ9wCTS{4V->ʯ{Vz MRT|Ko75ܫm~<)=O(n)=O!$ɇ߳eܫ~f S@PA%c81 HvZ ̞?у?z2M}#k-X*Dz3M5gk GvAݪk_s̗P8_?(#|c_@IRR~7G0eVX-%pF%lzi+,9l){c'{ Ke+ǬD;,~b>ȉn.,ή`&ߺR50j|= yzZV`D.YE祍5 4q%2ԟh<_?Pr[wzG -'93^q}~GM+=اbשxiIAe a`&MA~_qkJRa") -P߼%, JȷRqٗag#i{>ŝ|Jޝ?M(}P3J'{tYK< qXHJܳ(|W*T&Wa-KKb?7tD+oO'=xx BBߊ +} -N~,ٻ@ɡySimFd5@ jD' z-ǫؽ(.:h!ffRře 5~sj ߔf]fG48M&Չƹ}zX^+y}eq F^b( -FV;o>a'Bӧ Ǚh5~(8wPo?\'l{X8JQ{ok: VvBHB㓴#7N -)}bG~rg?H|/>uT-ɩ2vϦ==g =nTn92G:'lkq䲷M  y5]wzdwOoUWgIQsdu#zE+Mܯ+ſ)3EUxJIySN$E*OloJcNIRZ y#(/lS6>b9Z9k>Z;o -pqF0<Ȕ<ФtW`/Q0uk5h뵒~Kjؚ9Jj%~\&ޞ~%nS*>[j${!].0WfCxD0߾]WiqI^77Um;m埐MC.G4M69_44#|Qh: 6Ϝז9TϖV ElF$IUT5L.+&Ì)h1`_(?{;62̷2ItљSwn>HŵkY̡bq3l fSKeS.Eާ=rN'L;6#eQrt' (4 BNܑ: -Iؽ/Bz੓$)_[(V ILj@zcJOq$UQX$8]]HoPuvtoZ:rd[g7\ -hfn1H6~F$wײ;{]x+]NJk̖ L^/}?Lz;"wl gR>83'_%kϡsꌩɢIŠC2vy+U=x_YNUHR[ E$\7-2\W!WW@t`JF8I[&J#b5h|Qė{#> IՒ3N,f|FxV*xtFIBSudd3 fRՇfS͒4][,(:qZg@Z6g15g.B/Ennn/y؆c@0C|H&h0A/У Za*BZ/ϜAJ,ad> \~=H?Ǟ˘ ݩ=?yBOq!_XgFWf|ȟ~.>7OQ9Ia[w}ӄ9B>IG" MW6dk:,GF u~o0"A^eZ஁$ -(`a7A?;gC)S&SRt/5]-ÔЋgӪ IO^n4~ -VK5YL7^Ȕ O+z:]s+5ejf(8S nsbhꉃ35@gs `hb*\=NЧɖx@z>tJgG Ӈ X/\M5a៝Źݦ┆ /N.`t$Q!et^ uվh ۥi$J"pmXK'fiՁAI4^4Fc]WEZ,*c|PT WGeh) -g#@ 16Sb Zr{m@O,w_z*y, }#$^zzvkxc'vˠ58;2Or7]>F&9;;/5PiTwkv#.3q6#gdyC֗X?#VD͏DM.d2_{R#k\b_fI7^n?no{woq:cL`mYlV)I6͌hl`:ŋwMc̈df$:!KN(!z;ې q5ρ>|Ш҄>i*嫿XH'R* Lpy0_߻vq?Kz S t54W s {9'ޙ|Н!iju?uoITnI2Zj3ڑbkqjF6 n*:Kmڔ\4|-MFc؜Mꢰx5`vНM i<zD㺠h-m+ёi9mY#z ny2;3{~:{/Kzx6;X ->m{h:$ezua}1oLIj!.l BoCt#&<ƈq|RDzdU:kQbЅaB&&:x[g60 X\W&3=L``LmLv UmLvCfS_K'8!*We3ꍡxL tg*a:=ŀ\^`3Z24\_'dGɹP#f4 }6lyh=M痂 Ah\'Ꮮ`΀|]j75pwq-50؊3FAC -'dC$&o<]8<m'nˑ90 -KwLqb tLb82UӗCl -=tH:hɰD?{5R[fCVJ9T%)l*Kё'Τ <&zxOG7XrU";x|1HX(5d {qwk$_m(,DD޸&M'7JtG,OP -° ClX&hO_ Fbu@+ -%fRAܖv[zF Wr1ҁ~~s9X'G5h38lb1Zg(P\-o qjqh:hSF v8>"6JC&3'K4q pt c p`-!1Ҋ&+@ 8Wzu89idZw-"Q5ƠcZGk/@XSm< .s2tr$8Z -62+ٴVc4N5žPa#3A asԊ  8Ǒ̳ Dgb(BѡI/u _oL,a㲵`LǨAEl1`ƉSāV~n)Wk&ׁn"{ۉk8hm/ ¦3_dUm`J/A,|_}}zPÃ+}5& &fUYm&P#ITV!9+:$ -Oռq%Ĺ4!ф-&7O~)ha)b:Jݨg3U&r|3l.,F}˟|D xHAo9:eO֧h EW 8QT_$2u8iU]L«P1u>XjD6ϥsvta[ˌsh64QU[$9h \b4Amc|<]Yuݑ -hnv~9`J=*N =;9 l -_Kংf*`ĕH7i+Km M1B.TڐIXB%V2}Q0O_z$ֻhȚf-Dpnt`uqq&0 --els6_zvJ{yM]!3mW=7r:uj0GМw?s M:yy"&TP(W"34Xi<~r`;.g0$VN7dɤN>Sa -Q 恶{oJѕtr$?gކ0'R/9$V㹡k/@ ]% //ZcN0!wHɐU-o%kQ!4<\.]3)ƶ^u`/.քZmWҽ7VA^Po.+yuHw\v'd6KBc l 鶡d0Co}IxLd˴٘mƍ#'# x./uLM[^wF\mړ 6Lٮ8%zzĤarCoaIA)F~2[΂&ox$~`H%VQ35l7z:(` t|5uP":"Nڐiۜh nB4ij \ ]y`a̓~" H}MY8fPv`gIᄝ%vd{WVEr1vV)aMJ)Lg?YGn|37bx8U -`sdj\; iiQ4xO\T=n| QXU1B- 3| A5vu]]'h<2]OGt;ozȏ= |._90d4:ސ+[_kᢈMu⺼[AIx&,RU, '^ \$«tx4Mz1hKw?'R|mdgU; wzV Ќg;-ȥ;KNw^!Y\"z"+rzJ)gp<#: - +c -a(fUR^d Zl Ju}ם]p ƞg `lrցA#>!;}*?u$x! MY i4IT&IH6lm5ܬ*TE@HVך\>w -?`5LH$EN ucbO+5Yxm0?q./ql |%݋ĜLE;;k:AL(PǗHUO,-yt4b8>2su^YA%O6!S =]k˵ѧTiy ̓5n;h+:00J;1zX+-n.֐ |33䤰(ז*-ol: -KP','3Isׅk) J7m7{泪W,%Cm쬢1v_TM/Xc9\yQT3dn}d|X8Jf|>ҞM}k4]pw_p *;O]c{&,-g3y @Gر#DZ/[w'+) U Ha=;@,C`..\O(  ?RgU(JvL:m -q lYa{ -f}5[y`g^I.HYC ",oMUFԢA:zh5 i<> D`su:4Dg -;pr*&|­]3Qg-P\:>Grֈ"BhAmb}ts! w ;Φ:.v~ӑrہ sQn¦޺OvV;K쬄?Y㘠h5ŵ ;>%{r`l4y>;( j\*_}l>yS%c:ǻg>Yqf͗ï}%=OV -R4~@FꄸM05?o)Ѹ& Xo1uD?Ppp䴚q5^}=$[ fӰ?7U/+ql>2|Fa~+jSg~3? -񿳳`gmRvҺvbI -wmýRyVdYA%3RߚY͓{UG+q4DxM8߼^3!V=L׵t'ka?2=Vp^\KAK=*..lAiFlXbC6,!p-;Ɨcg1u-tY A0 tqt *h,X_+m%9`++nN{a}|i×v ])MՅb0aD^m6X:Ҏpc:w!vHUsl|yfhuok?mv?p5rXu6Msl!a+ ->k@rה-bcl$(\b'A?׃EP6l<\[y<m;4_ ý9s )yP"=?8@.qL5HgHkU`SpCc(ya ׄ}' `F!lӱ|e -か"b&h6y d}C?1RpKz'=}&!GK1 _.ۮv|1# Ys+3-k9KY -*l;x7mbYo1_nIrM0zڎ];/NX󥃳dsW-sI)3P~C6\3{ǝYCU{l>'Y剅63&2N?4dѐNTk,RkT]w\[˷\vpPe1JckPm!al3\Plی֍G$#lmyn-=&dhȚ{˄\m>)_0€$>8g{|N}e簭aMDZ?Y-QZ-YM\//'j@gTM" f<68n }±׊מFXӐ~$U}w\xuGp0jp +% b.#u[a_wb 㒮PK"35%8g;L&-ʼn>h6:W'GK!|rTӀkKם{Vyk`'J -pMrK2g˫>'c M* -k|}rz|t!Mz}/I Uk;}l1uc ycl˞9i[󑜵\_>@Zj ,2zSWr IclIU灟\JQb@).+rOwr">Yz^,S~aB|^YaCAp8$1{f s\,|BaP&*{o{~ @֭w^6_s[9`% q֮ >ܛPb,>{2`-8ElF (h2*pNpoܠsZ)7b{یx/V kprFir>ab 97yi>#-ߟ\.a`rį+s -I)rt`or90?X[j u6d˫;d Vt5Q/',.zjUl~qw -ɝTXDQ j VAL86k;3M_!W:`EooCu_s/Z/A/*|L6.CKe,‡=${fp +ԑeP -,mr;=0l\p 𦤉:r}iZ_ԏ}TY57_Z+Bb -A Իp!OY.>S605uO<|| y启O Aس%+0}biz !$Mdӷ8fL<^O2MLx°_10eh7WV/!WX3y(qn1S -XΎ4 _"lg>l@˘/8BNt|ůϓĀ -aXurrDg|}tL:ηa/mn[g>]V1IMmGf~W& "9]SI\>lK=3V춦OW˦7C>G tpD[Q  }V77s_v&*MC c7 8=8%؃ }y}|t|:>Oǧt|:>Oǧt|:>Oǧt|:>Oǧt|:>Oǧc,p=Ko (dcJD^ެE)na) !V-ߏvr ɈHZd4jA s_]p"QDH؋Z[ 7a!c -?(x +-$oڸ^?Mm*>>$."܊| -j\V'z%V?6?ـfdT*~_gkod/~+ǾW}~??<4vi=c#>%gu멷-"5:,՟bV7{pXpb{{+pvgOxVZwd%RvVf"lnɊz7]?*B&J| -Q  SDxM||H$Y"ӄIId$2[S!%; к^ۃCtJ"I5@"7@!D&WEl IT -%J /E#%KQD(ǯ!FG -T U MFgVO $E~T͇Y[=ԤWfcB1eNyq4]J:4I] -֠ Zgb4>.GhZ ZD<7}*u=M5%d7U C"25УL+T(i*V=ЇE$k%o3:z&L4i@ӋւKdKU| - 12eٵi(Va6iV9ݳзLj@4r,EsSMelJ-~QgDǫ,K48rZȾrSj@ "N(؏O;tPޢP -ܠ,TBT|2Nbub>KU,S5_~UЉeKrmIhh @U$ j FЏn5 KR瑋ClH&_3KfƕJU`>*RԼyo -h#qP:#OTg"5euqyMerIL`/~Ʋ^+FU#ʨ0bӴ4M)KA"BtAZwN[caӵGhu1i`Afl=yr<4B}Р`B6j!AjLXљfsu?Sb}|J42Gh7C,Ƙfo/ۃmWg#4@CBm#zKk,5q:lB69F7[ )Ft/GVC_$;=$x,=^l[?.>[d q'rƓF"c5s.HGGz8`D oTu&cXS!7(c(ՈMDa*BJ@迲㠟+M?x!D]f|ͥ6qQZby йfiLLcڠ_ $6&ctCD&a?.P#K>I\e(֑dhAo"Ƅ މLM岷3{<>ڄǁWR* h6N"49z'z["/k#vb|޹2 s<zusd3bc2C;،<zaI?3BuS7UFrir9x-cUCzQI]%C`Jwͬ~AkoV7Mi=oNBR.akz$ь\7 xl6NK}sL -'X%V{3>AӀ9Й ?M( mыF~ -$OÒ5$HU?D *}fI5:"Nz}Ȇ25<-Ʌ z`ctp܂+'Ps/DWZmEҔC vD,VU -}8QTp:}]U{#d1ڠ M.K Z(+ﱆ>h`[| O<*t~?OҶAE٤,l,/&+K(m%:|l>E-F&j>0< 7^WIҍ|F$!f0 fC/B"?DK`QpN0UZudm8  !;y;,AzX$%וa7-;gֳl,yv%e -s zR}У'=廱T&S+L< TkA -I㷞 #?zUqaC62A)\h&4"%Vz!Agt@Ar2]+4M0^j -TD_ ZVseGl\X})5s2:tj"Uc#TVlp-q‰@l:eqy:w GXs6 bϠ5c~nZ BQB|Tf)r;Cɒ:d,ˆ)aEo23 s(ٌtUFg -I_$0/AaހCtNIt@!^Ȃ6=m@4#6 Z"gMm,賄Uҏm (@4\4Ұ/ۗ~Дecl4]r {|b+H6ZmH4{)EzԆL} =xaLzA,X4h| x/p|_\Uۺ6>-vw' Ұ֚ -;FB>xswZlswcqϔsx- 7ރ\Fx=nl*[<5z?Z5cCneOLA6YʉngsX.N?_ZqD Gm\ե 0FeAS +ErĦtb/{E,'GAV4#YφpហuXqϳbmQ0^|½AW&3g&#,| -\4!- ч=@Wq\74F{yFlj -Z1tо>Wb@우p, 6raF9/{-*a/KӠ$@&EF|1Zq, Qqx/c6`MHM~ \zf-=Bn,ǀ7Ħx?=&ڢMR*:h1:19?8|t[hй~kSbX t!,MW _. Xd5u@źX|}p,87 @蕽 qU7;ִ{ \ ^蟻r"[ ~16B9n=@-|85i1]|j{+hPӠw-:K"Si%QM]4OD5b Y_*q\Qb -xƀ<5kL]13X;[Xy3oKՏx{y_^fhΟu9Q<(rKR$/DS| endstream endobj 37 0 obj <>stream -R>hf 4X?q#+3,Υ;F@\ G?ǿ+bGvx4XxMBsQaLv6cBB ScZO91&cnN+D#EznYj60y~Y߇ɘC5Uxp7f9J7ʙЛvllSDѤAWfz(؀'Ϝ=ÂGMGhm}|4wi4 IgpxBp"1GV0p K"'뱟gt|2UOk8 zok` | -`JWOBhp|^QЗ4{3vy5k8zX"(@;{ý.ɕXrac1@s <):ťd?x{,)GAGtH=(λDJ(VcB c߃_=&܆=&P(nV=7w>hA_Kqܝ yWɔ%:K} -=PWx9>|e7"R -V `;V-WT3_>xz<PLu8/_}:m*[hNmm}qpiOGi=&4iB["vc5O<k{%:➵@ab_y0':+f&vc -zyX4h6^GuWuTl]۰"B+e($/کGgt;'ύd\cva ğa!+:+>K;}([DŽ˰DŽ_=&MD'e0ޅ5aT=lt.N36b+΃^M*uP"K .5oÜ/0t`sSYˡ\/xXY)kWK:\Oԅ< uU=BYEP7 ؓx=p'\=,>~F1||A-GKõSՙmbTp:`&^N@&c;5DpZV?=&.`[A_|kh>QaM}< xH >5R|)xֶ=K!WA<za;) -0/ -)bϤŠ,yѪ'ڢ ^U8ƕ+J+y䪃lTv Lv&h:C}TߜUÚ_ /eQf%JRX㡎;Mt߼Wx) AZ/q ;ek϶}o8xo0VtB^ab -RBT(B+ k7"LhCmd.9*d|/L9C̥lL^6Z 8m%XF)J;dwhIKn -逧khy2d:yo2AMG0F# Pa@e15!Ћ"=M>-J|z\]yi_|)D*-x?فoϵ^U2pxxLqzHHr%m?w4 p@}\㸇<5+ފ$FUSom;x/=~ӡl`*zEr3R&SeK-;(ɨ^$ -vbOH(Z}# -ab f"d o4Qe_s=mD|T^g|30\ =/[B1>1!z|$?K\RX&W+u(Ú OO^Z*ZxABkZ뱕Jfu:h&^= -ziPGݪ:+yTsAJ-}:8;%.mv:M]A̓د'By R#Ijf9?W,r aT웷F✱քb_7X4W r[MDG__* -~ns{ C?k?C־}iB!:$N(cx9XyOk􄄱%ZJ5*,f `JGS@@m| z; p5iI'7)EwW<`^X s}^ -W.䞸ЁOvOum*%?;O#qc ?B.BBy1b🦬"gRa{ahY`Lj9(QzaE=c2pDu+Џޫ{%pS|B=S#^Fuaz4 -֩`}ֆG{n -x_9Ax u9p}GC5XrpF8恗j%. ľW^S|E䒾 LOƗo.#ga#3ߊCA߻ȨMoTg'CV=X >{ax^Ff=k pW26/ ߇x)wFÁ"|XR-L/pIYJDX9KATp>m>g]'x)YNz~ 7x+Rn|# w Bq}haoŇ80o/w-YZ=>&_BB-s1 )ʽx-zX!^2 Q\fa=u ;|d(&qĸ+d$ZRx1p:sa31GV5bL|p=@B~6)R}|MNO>O؋W;Z*l? n茶dV -B Ytg2b0&ܗFs8JX+~ owAn؆=`7 -nӀ8tdV:WCXKx!`er"]|zY)K^lgĆex>?7/(}µ}3 I|='^ O79;zK|ó3&8'Y_r=aS0!0 z>ʱao.2 9})lp{9j*>g؃t=Qh1G%/? N,[kKcK웷 /ڎ1+00y|}r`}aT/q^pN ^ו7 ->=qetx 25!XwGBP=R*1/u; EA6@? >h; yCy:TP; -cZ!;p:$hVdd.߅ u/IE5mtf!*i/!J܃jvðVy<-5Gs po&}*r7흹{G@Qށ'LZ*W -#aeBl/GdlgחЩD-:෎\pX< ׫ -wUqX옾a/!=ɐsxc -Ō*2 -]ֱre4>i6풳(B^tٯ˿UUCz͐*x`kȬOAUv_UuQUgc1Lzv%UtCgٔf8Rt84N-bK߱eLC+ڽП2ڽ%9'l{m&֯$wu8繴VE_=PqhlhvD*xC@&!7 -03ۿ {{1mlQ)wrWqUE)dPD?_4>?mxDQǓרJ1)-QJ?]$+]mDIj"+&,1:9-s0 ֎:GFss`6!i1a~z'Ee Q{JN{aȻ_u NgD[Œ#FEN5AJ^2GJsLcn5aF& -;!6u(*!QF(AcPKjQ5 2"?g }_٣CԦn}ԡ|cHg}(ԋՇ㢼âvP¼Faaa̓3WAW]g-xLPw#WR\^mgEoHVKk:L 876`+\W>?J6u@ER#6CwH𴄵Pb+Jsѽ^CanT|S$n$iaZ(Wd}, -:t;% +EyH6Qz(ګ,KCQ#y-߁noYэ"* :~Ɏ1@Q{?iWcQwEICb‚ޓF˦sm:#㼊Ӈ_X?*߯Y_T׻Ҽ>? tQҗ^߮>jxV -|NTe!2;m8Jf(xEH}2f*z%ޒw> -;{c=A&w#3>هbq^1{e۵.aVQ1o -36c@_:_5ɻu[$'PT~.z}kVtge_`Q/L^z'Bf)n4x&j -r:Δj|ia^r>iСF^k8#\ -UuWvI$ŕL_׫1Ao}W'o̐Oi~oʂoECҬ6^IiqaywnFeu$[DNUOQc4&.@WC>Ÿ́$.@=2F:*~;u&zdj4\[uTrPn1C>y/%6SQaYq~ǝ&:A/T\Ue'uT{|7t ۪|xac29^Sd;(֔h ۣ=':nHG_F1Mּװ%[2ٽZoo w4lH;4لTԵ ]%U'Yn "m r%y/*4*؜Q^\Y*i+:.pi -IjkrάqȮsY7ҫ7owƘ>egƒgM$/%ŵϚNZiFc/fv{n͉?z5ټZ[ɒZ_oAݏdOu95mW?mxCiԑ(S})@8Ey-zP'3)_U׺i7ZXuQ(nd߻KCğ*CϝҁP۞w>=)*;%my% 6xZz5Qc܍;s+ں-<&=^}DIuhQUȫfb::Y]x.w.Q.QɕQ1OAzP?l,?( 13*+u3j* 0, id*QQIqEq/H=Rj#RK"f5;׾1OD–fWSJP.,6/ m >қePShޖ,xv5Wq> 8/u}Vu1"=dgNcSZ[sEXqZ\Vo%zd%Qzŵ_oo[eHsMHlR{_"55s'X[^e+));$:7jpI ~t[ݹlS[}H&/mo:W:߫ /i -Mmr>{7Ew y߹KONFOjcc"3K##-#5Dl͎~(2}!,y im>uZ5i)<גz5;1^D,Zӛ5*VxvIN̠uXXk W^qZY߶=Yk4]!inr&?DT_YؐfظZ(Ӟ[qt9CXkhsBL r ~p{勣N'֎lYS8".m19v/ѡ62%+15֦96U[/llvf:mE .sMIN56ձ 7ܢq -jC9yt2̤(ڴ'7bkR_os]X⩎+tW0޼q[ccc]c=Z}vT7[^=g[jڥ;[+(gF)~FkuW_LZk{7K\#4嬲jࡖKQr{_Nm;gyV&ǘ!Ol#rl#Z=Ua;"\R36kT ѕ73X^gVwڭBtZ?ur>mӳ%"W #r|b1 -c.#b;u4||b1b1Uf.1{1rBazbĪU6}swլC/=:5P%;"|ܨmD7aoJ -mCuOt.OtNHzskD+1aB= ~L5Ե\nlPMUV242g]PJL&cQH9 -],Ay$ze"Fdk/V7=;a[DDsȈBBW"cҋ<"G+p|QWK]47:G<(q|Sn]~~n!r-:U+B[p O+Dq8?tV2*`l&tW w`1f4u21Zf2i1{Zb#A9 C#QGfmc # -2߸EfuD9&,!Խ*0Ó8GŎw:EĖzDudE -mgoulyo;w`[i -gk4:C~(⦣j|uz#'xBsqSo,՛jA8SYhUZ%%=isԓט'%Nq:EDt~U'¥*$&':+* -JNIQ+nʦ62o'fL18s28#q4z {p^>':ML'Xnjn&ȩ{䔸Fjˌ>lޔ x%^>M]d􉎜x=sx%uVX*$%֤?7 1 #kp?ΌGwhcqhG-&q7c+1_n+1g~b2Ub}b>1g>!?OH!i{&)6߿p {qKw"͢bJ#Όq޽s/v,.qD;,HfɖݨN XFsblbĜiyI;ÌZD[Lz,yUbC hbc$n?wԤԀg~e_%&!}c`}@m`}b]c`Rd6՘OmO8\` 7 ;=7a1gjB~zWr֡3}/!?c/1s~|mW󗈉N4}G -Ꙧ˭QLs7 8tUlDc7aʛ[yrIb3b~+b LřXhM,P!~Q%V‰2|ڧ(=V pDž=ŎK -C=Ny#9 -8CPOes|l v)nٜ9Z>c-zDlKQ_"rsE K܈ (/$ -MENK9KuÉE:2;<'-Vi>-|q6-(U@U\ѵ8=-_c6~6>1-Gu" c\2ǡњL4s1SB~&"~Q&)hP",TAB(gy9{ys 䕈+hbJUb p<&:$=P?GmҶm4I6O%q10˙ 2Gyb(8siK>x1r_H}׹ϸ's+&m;{r|+)qss/%5GNX1p"oZGV9%սs#ث89~rO@c'"֩[+)kbi(>o:77 ?jgm~4Nvv1ݫ&x̭;PU-Q -lSVsZ@ipBwRmL8`lCch}BCz-B*@\EKVRYV"+,'Bl[̮@1O5@5 iOdn[#v>js>m3c?ی!_9#ޏ7^NxȿlvdJԽ?eDϿn+H2>q qa9[(egu!0Ӧ]fhd)b5A=dIwX"VU%VT#nI;/<˦d/VT48>ΘѴf+o߬jq졬j&պm)8W ϲZ#}ϢMz^F>vVwDP$VXUn^4h#.e!m'm1 6&v.ʞs*q䮰j?8>7t^3[?QkJwNO3IrGO=:=ѡZǩ.4ݜ?w;]]f7u݉Мly'QW_`bB_l4R>~ڧmjڃy1/;z;NӷsNC9J7wN|ۭ\mQTu[ׇGT8VF8^BEŞKnCn -NM3p?j/trJf2[vjD?b1eȐk:Q[θ_ۘM:ȄU`70y-qKIoE^9lC5)c'/B:]mc\by^8V% ؂W '],?puo -ӯD9MF0KUңƄoS{T7[XRTr jWMh(wQ;V)+zMu,]v{gR6vU'3e]G ^﫝NQ?g~z8Uk?\wAa.y -Uv3.zMt˚?g=$1k1c,ܨG(;MUmj~GWj7'k1);48EIЧ)(xLMA%UBmBWQ2fY!皽*lPOBA'c˷y+i߻+{+D魚&Y56|7k4 oҺu{U$9Cߕ)[ȧCaK{/g.vj\ΙwPߴiVt]|cT y~FJJMعl B2a$6=rq-JmgSI{`q#s>{ - rз`_75^LAԍk6Q6Iqm,~jƠ63K }J/w~;co׾mU+vprb!NG~i J9V/zsiᳲĮ ;vzuhD0c:DX@|ҖK䙳Y=dr>7v#@P_yp OEXpbmtR#JW)}֖3秴=o,-æ /xEOjOgW;EBD6G2Us&Yr U%tM.E=vsCWӤO( ,<Σ$xڠaxTuKU AF"92d:h:?6³lNY1Q^DpФ; :2iCSjdՂGkߴ $uvqht4ns[tjRT#%,bTU-o -uHB+iJk{ʨ{_"DRYs\S_[I\C3mEދ>(?* "J7gO\SIRzGg]lyfb5a.2_sw~JV?T U4+ߨ1]]˖pzU~=sfg|E P[bflf .L}cJb6w DZ,hI.-v2*GCtN$|P/d[|:_ {vZbRv(!<]P! DugɇyTY׾~ْv aA)|'ӖIRIk͕|NOտV1O Bѽ4 S<]+؎]OQޭBTAV2]phfn1s|Lq-´CTj f?v4 k$^J=qO_zw1)~aZEsfWQf.|-byuP~%䧶Nա?2:ʬ($!Bp N@TOUbąw ;tC7hh>g{wg538c/5F5tH%U3״WLfv.0ӫ^)܌\n'4'wspᩙ=bf]Wq~t]Fx}tcފ'es {l̕Y{<ˠ+IBn4bۋ͆ ]|.n 7b7ySibr8>z,?w:m9N߼~4 -h'}mw77Sg..ok-~nO|}gnpUyzU}V/yS+oŷݽ kh߭qټ_sPh9KmD4sl4siW]K+0g8z}`oE_V/kDc%i_4Fo*FxK/׵>Xw7ϼn6p.7sOpO짵^}aP?;qwxpVx{WA? -,&n -" -lp}u :#1|fF#P;# c- -س[NC,ȶ -G =,_` BjGV_]u~E~K8x;/~}GOO:i軟o7Z=Nřoߌl6~L-x|Jh}tPqi~._vA70+O͚+5˜fk6]ٲrfϞ==Ylcq4]4ݽ5Gh¿`FZsN|dNﯗz{_@ɵ*犧{W`b)e -43_kO ՗pg/n{LhW7ktp7ssB}ݥ=luLL+o9]h}(ْuІeXoZAb|͖u4v`~S#j酆O]/:jF!fNdCE.9RfYM[NՕ{g:Q`OŋI42?"]cV 7 ŧfe]S7\9,ZTK.;hRGpH1kXvu!w/hbW9-s#slЎ ѷ?D3uo-w} ,=>5oߏr5"a6khOE9Q0F7M7o;u'ۅ|.?vA LghN:--whgNKܵCu&͞-]j5:^SAǤjC,$$+>I>u5&5LPCRF(R!$Ƙ;[lZO೚'eóާۅ;s*O/ E9X'\x =]ۿ -GϢ[g~ ?)s'quōfI_Xx.a,]اku%Wf듛ǹxj6,_qv@'X_:1Ȝ4?ISHTK7ņ˄oqwIct;y:xsX{c9~ɿ Cm*9IE炵;'"N9͓IS'Ճ,/)f7O&-|t ]`Gz;o-?kr!#5`U֘ޞT~m\r>`h|;)s*֋_wi7ۤXlҰN~OzuPR/ R "Լs?.z;77VsY=WӧW2br&̏Cڑ:C\Z8l>YÅt':UsCHcҾЦ -fk9AJnt5Ed&Xj,o@JR;OҸ QfB]ﳭl=nJlp#qwp+>^a<_~VaBp;ETObkwp.x ;4ȊQBġܠ/Lї]O<\uېnd|1ec+!i4UxctaC!cΟ]7 ͸'pEf!k,/D+ RjqlĚBbP7V, nq@(s1 \o.\7;!w VQ5sZ>x!1p44\?SK__P#@38P,rjhπ ³:?g7_z^nL\()m:n=bѹ9Z5@bl(44,O>$k}xH> wJxzhnߧ9#kD+}tġ$Dځ}B!^hCCص!hqВI?{piғ岾yr%R~aw*bO=p/}$=u#= -v+c |QuVz|M,׳D].Іٺdƍt[8xĆhsC^ohĀkhON /V%Sۆ|.տtTZ[#\V?6 E@^d9e;+ĺq>jr=YպCQ玔C#Kf>3Nd.Qdj$}H,% t +9h 8dbN@J-.#>8,^a.&к4c} ,xw .Zp~&n#4YԷ(&pR"}D 318ub2O,I i]`$]0|Ig#g:brOoY)`b!GfؠO-Ln-$TBGp)0Q*M/t)5\_Ew5 vzл'z'}#iC6kTZrO^FcN5!e&nМuė%gM{s֓‹츰\%ʜ N"p-ܼ$VlNiz^r2g -Uc-U'9u`S@lЧbQ-$u? -fMq_n&[ oMھ Sֆ rr}4]=Hvw8N`2͡wé|Zޤ1JIHSCvɵo] VO|Ilt k5|+8 ja,p Boh:HO8R?aIJ%C 'X܅OCml[?-Еn,۞nnV8jgAHn1O3;S)_~wr>C'{BTR23@XN9G˝{q7>{Uz@?J~ CNj]r67PNrx`uHO/LL6q7/ѷ@zBqLqO}j>ԎOlpb*é^˶=[vh'Ʌ-0N5buVAV`T7-ґشlZ}?(y)Ё,uPSmg^߅_+-:AK c9*@'],DKQVYǦs:9ǧy8K~fcD܄7ZdyʉH-mĀ+9uNS{6[ӆ_JwW7 }OHgk- /8u?l;=H|F<ΘPxj;Ef c"ِ3j?9s*i=٭z5/YQhhl+ĞĶ{>gA'=%/vz^ƴR+{ګ.CoߡG`/&0[Kˠu'CܫˋF\.tj]V%64Nf?t$avCב1*/4T^]i,/%TUb(-Ŏ;תI zG8~ggq'X^vo@T!s!~"4PY'C,BXxc冏7]}+-ww;~lr0|H!6{_X{rt+o۟EC]y7iqu5 Qz>BZܨ)`5jhQ:pXn_b/:g޹ ^G$YD?5K==% Wf5¶tR9|^c37Rz)̇77e*=r|#4.P`׫Zvc9tԱ8ɡ_048\g|}ycgk9|ǫm|ǫ+;P,xpnp[wke7_wkP -1|,sا:>{_mf^WC^ 1Bp"qb+ǂ;1 B3lrX.7yO9X >q;w}7c:\` H[V/EXpsq  v`$k4msGѡ2H*783ƮBlb Mrwk-nlp>w>۟}^tq1q' DZ~>3o߁uRw{Eb6q2Z7;Kv_w>r%;XĶ϶K7ϰ,=r׋=dlkHs=-ȧxORH1|yC=r+Wp>\'1Xujxsp/tuW(tk .jV"$W;A\|qYEھfgU\{54hY%FiY|p^K梁.CR@E#0k#XH|h.4|&hzH-.^oFɅr%hq\: 92 3Eɡ&-nL:`>C2h<{#lL}Tb|sFFgؙY 'JI`g5^$ n!ɶ&EzYA#]3[k,X-q[C1 KCnth2/dU -#gpgLf5[f\2poo]wT7>Cw;םzto+1 M5}7Sl>,mPn'w̋3ӃVpz\Frz?4kg*f'a=R8XIEc՜醤: kB=cy2{y5'vNRY!&zy5{,#>RGBm )6JP98u$|4Xħn6OSmwt0~H>yr}M76(5)u0go+X( 9)zJhms#*읅~ { GGsіrb1bkvV]r襼fg!* `rzxe`gY&v~/r`5.4#Uȁs 3g4٘Y;Ir@bo&L롷Gu͆61k4nߒӋ }X C?{AGX,v V9:0]+u5^rAP;S5`bKguB.)Gxk4<baH`,l:rb"[`K΃=f&5Y}:@N!Ʃ`+Y!Yp|TW^]BO05X^b9kD,4aJFd؇kS?z軞m r=QQ08h<Ƀ2G{<9x\NrB~.zNs,<1Y -=\7qd|x!XW-ß2j98o?w^ v4#Rltgg%uvRws_2F7{o{Ij饾s}oMxIf8. iكW@lIrZ-˽NE[?*w+t|oyo= e񹤆wVCKղ+K%U{MM*'DXmY6Mjl+r0ղ&%;v{ AF}@,Q|pmH?5; %0T=O:LͫJ=Y=DixwR+Q8+5!YCfb@!!v'Rͅ%jWI{3GKq%![wg~XA.8fA156OC/#Ծ m ƷWC`H=6`٭w|[?WV(VMSġb1yj`! & -<,@s'`þ0cf07uCĦ+cmB}EGll E/w>cN}?@ ā.))=}!:RBûփe8T vXsvf>Rv4hY sY`U쳤}&y*0co[߈AV -)d~‰k:KgE=5_44OmN:Fb%x1`\(uunϪ<;p>{R˯/76O#KP<QoNwb5Wʭny_-%dk|<pP[CRnߞ{ĒI\g7̶ #A_r0fZ݅O\483&g?9Ge+BF fKJ% {TL>r0ħQzg-2+Q'YMs.#^Pj%1P ) PmV!' ng]{MeLw{R4ԋ_bσ]o^+kE) yXd(' ;Kl궼irU7~ZY/&N+M)>gJY6oc]-c=3`T C]9@Ll&6,Գ<?pC.@ )F*V<ܡ{:n;칫חӹɔG:럄_p`}.V=Yٽd]y8&dTͧf%af.y}n~`z1\eN5Bp\‰?C_Փ#tXw)s%bUX|#`ќeыC"TZ!V]^^>beb-QR|~QhLଡY2ZY=LEjyPrqFjc-i 7T\^{~x\3л{3\˵CmCqVJRx|i8 |%B;}u6jbyr>Y+/B%T0c7ws-.i1ЎbRȥ±db(p=!;cogN4*,+ f#Ū Ee Cx8{& ub{k9b]8멞Z_K:vrV\1^%xO8@q+޴^X|!( -g2 H;b'τ1!8i|kƙxo-W*,B{|bb P|rxk=3J1?ԒK8!Ff*)X6qR>:Ku`?-OLBMYA^^݅eG[ f{QV{l3Ex {U"|o>O`J5=\:pbWO2G:{^#](|c?=;>7YM{:,vv3[> 8;ql)Gns\ǔ;%Cs+j ps 'ײ84QfVeԼWtmv ا2030e\i&CNT1ϙ=t3zk1*Fd؀)F(3$yó0C#Ԕ*TfT|%IVs xSJLxAI'21|fz|i/GiG6A< Y)*Նliv͔8#GeتoCARP;#$nzB#9 >Ɖ1'2"6Nәx8Jn8Ѧ#VV=bKMSsV,l)I3;c " }DN(^f?}N≁ -0<'RϦ?99:!8K[̮S#^˝P']M:\~f.λ! b}Q-!cťʋˈ >tk6i"1 }6{i|31Bb מvwJC/= $k̇ cn8=,,`toZVכǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛǛϏyFsq[_$>(~ -=Qq)Λ%mfS|WZyB77 -ϋ]|Z 煦+.4$4}Qd-il ^r,_zH|ykVnX/_M//?|a{>~E΢`%>t-\C#6+/ U>{Cvf{=Z邲1δgXkX.^[k\%'ni5ԇ=.>HykXXpy"[T+! dtZdK_>3t;؟ZbQ?pG -5S!ebH"cN cԕdz#r0L-G*b8zqLCAL`?k`<'鶐K+1292Ӗ$(؟JX"i|?F'X - q';BDɴ#iTkFyCB`F -16,YC*[I?Bq>4# HpI6Ngg?:VͨZd陉Qd5LH}yf?cqGǒQVt%p:EH(vI)uNBHHCd[Q$yb2'ɚtM0:sb -Fp|C7܂!m16d|ͼfުK:&H$x9~:%B>)Has@RȺ -E\hP _, }`|Z(6bdPvvRui!92NδcrD1 4Q0 -t$٫cn[nebG ^0{xf- )¹EeҨIj!cP2F -KI${e#RddӝHWV`͐hc,r8{j0󃞲C4!lQ$|7g@nrb`ţ !f$>FĆqRHgY - +vQ=h5&;SF*avz5B2?m٩ɵ qjdbQTcj)s2jhT gǖ>Hv $yYfEZbKͅ4k!4ݐ~Vˆ5E\1Z.$Vdu yW9Bm> F+ ɵb-!A2, jx-$2l0t2lKg'=e7O,i$TK#~Ƣ4*~|)/蜩etH -}ԊK3 IchlrMU+G)u!B2d2@k(dTJ!k]cd2úBrm3>I&!wG4cDB&CJ,ؐ"ϤJ"Lǘ)O2[t!b4c] f_!+H`gB8f$sa# Y<Ƙ?Q{HECgO?2OvMX`U ^xi+hm76r˅7 iki|1AJk$}kdTZ)K ?nOP/.뮮h8]YI?v_XbQM?1Ř?0 -~G;l $ʗJ p{|lSkq=Kv*߰HL85fqM  Q9v?%)(ܯ1 -|ɍ8`IɿX@KN_2!%v(#'9΂4G\Y -YlYe6ԒgR^1H QH@yH#Ё>_lhυ'gC^ecR;gJזbXc/$k$dm0 -A9RL|*d;h<׶aj-IV2[d}s|`3-^**ie^5a?HjŐҋ -$2'^3N.93Ozk $IzC#48S3;'Yst bl=Zc9rRz&3269vqd,V >  l;9ډ:_PjC1_fH7BI>>y5ސ[`| [aGbr~ oQ}Y_d_)`L 4C, )V7R.bIVRIl&hd``M?EݳHP@֜:dX=X;(LlHJNYaQdVC['|c֣t>qRG+$!kc``ґ1@G:ct[j $xo/s0sC}gg!&\F) R\h'enXc-))ͅXC2ZVd,ћ -xKoJhz 7$t)4c$$ \V{<< [i}eLn~uן{un&S,}$ 7R*G.0 -=R` ȱY7ΪG'AFИrQjt-O5t S o5EYd 9NXn ) *Ɠe1  `gJV$\8/z$YPv)dd@מy|'5- Ŗ:FP x 2;4q B>j H5hk$ւz}X~Vִ~^ -6sl%SȐqD l-4p8s$jVx|5>rJ[C::9%|S~G,i1%|',)Q/2}Ȩ;X|(##H|fd5.$ӯ~qZ`5Qy錄1oB[KшE| ݐHA -{vzJe'cNLߐ -f5[AiɇBT;BPeR6]o<=C5z!$Y79|m>J*~&?RM^ExǖO7JwVCP/X 1X"‰O7Hu2'!?BGBv\hbl;I9U0G/$?)w>-s\IŕiKIK@9S~̞J%ROֻ{5e.zM:+)p$ÒF"PPs g6ݣσ~S !1fN (c*/#AOIȸ˱Uc>׉Rhwt5 yG䡆#EԫT3z̨7yd9\bz$]?d| ;fpml՝?O;?o5}YHr#õ" ws'(?LTn4飇t"'QH/eRXu7nH`1cI&!2?I5T)d-n>Iܡ^ζS X00Hg6! c1IJaKѱ诊IEc NxK3 r5ח'uOA.8!U\["t}S<`?qQNo,6z]Rq,1ڑc1/9EXJ}V6 $(Wk'uwY!OtdQU[[HR,N|sf9'Qu`!ؽs\LB7B{᯼9q7}Ǜ ʮy ŃYXjİam=@:r*ԏ$*3Ob WL)?H;>MzuH=R" y(2ѧZTCRi"G6-wrdXԳȱAP $30ÇccGB+ NBI!HN ļ =v;D8b~B#d  -j+s% srCXh9YgCLl Ixyo焌e[k$Av:gW{ԡ}pm%,;{4 Hj2)wؙ.Q.Uu}DLB_C IY? -{ &LGzk7Y||;"I1#!Fc6h QH*j4ZOCi&+U\Yl_CJ9czHajhV!'?I~YX]nd IC}NO{m!*UZAl;U-c`kpmh.}G2!~N8m;b2lH&Yw -,PX"Gj"< fbȄ/VYT~}1pQ&Wnc >P7͒0)ԍEd-Dz|)@bDY=J4M,ؚ$Y@#c`_/j @TbJō`Lhb …kr6i]z|s!!V !weP>턾dp"fwۤrGg}HȦ^ye(OrɵM2É#)`k ?hf. ?ClL(ǙVHSX3aϓ+K !dđFBt?ܭ>rқ'FBd3CWG~$H8B:01($mgMܮ ;Kv]?T*N{UO(TJȵ֯J~a"iXlG jj؀<8h'ICKy[~39@=ڏp_>t>Agf׶ TkՅ<^ͰeQ~!u@/u9@2q5/*q]Hֳn_ؚZ$6^n5S'H QCg45''}(+38 -J` ;>$ oSZJ~9'z@t5\-y&dqOo6ɍL}Ԃ6g죒U5y!}z ؓPqc\DjxVG '?䑆@VaB뤬i\dd1Ojoe>>F;G; 7 rtu*m{Or?ȁlk3p!!j.p !R~GBď4rHc[ӱ 5 S 8 1$yzmZΠEXIIg. -W^AMrθwΆJ /y/Rk[0 ]HooCK:9SPƞk$HH?+CqvJ%Cs?bͅؼFBm϶.2P}n!nwڳKw֪P|:=Vnn˝= ލuѹ\[V%W ,%Uqyb(7>} -JwJvҎO@݀z=> J7K g_B%BjD!Αp. G3avDdy[/dы~;V兆+ˍE(9R>5P:-~3`z.kp* !ԃ@gͳ % WWL)NwKR=ÀDn|hI)uDCýJgL5;i8qaoz} -GpO-O?>(zhq7G}4@Y/{ܹ6OCRմ7a,X͖V7\3MYys߸  X;Ӵ?7?R3tńHGuTBԂ(4!!o$YoH`@^3XJߥ.RTt?w = nX܏V0I9 -5CN>UZ{KCR5|qNtH =/wY>E -,ΫQvF DF*\R0䐱we8 )kK '0lأ -8+<5`4g( >=WP @gʫ$ ەR˩YSQ>ɵbsGHw#-7|A~)UR}z bkXuy1B7{?\H)CH]5LDN.=AB~}Žз~X9>(c62M,08hBZ 5qj/NZm(ujڲb;ԎJ=BW`XS}w`pGI"B?s@&>PhH_r9k*bTqz! .O9g6GgacuA V3Y,G=Y'<,>B68gJ,@?6`:F=p?k/>@Y 3S:,ce@ 7`P!(pVA-rs7`2G%W"GQאL9|jF<3[^!iZ~z1@8"g=tT:U0 -g qFm7g zJ,3g`ή4O -dݵ$+=ϔ7K}kbpltП)o;~{M>>2a&+,Pvf19p])=?i[CF9:ߞ E۩,<(~/ԭ襖[@F%.9pvoaV_[T\]{=k:}L__3 ΦL諒|:gH%cɏfh @?\=sO]wcRe8S?u&0w\@8ʉՎbt3c*#%9galmSU3{ [k ]}e)"l8/z8#h0&9j,Jg%S5ֻ\za1,i+bk`e';ʙ7"TM/ŠIgCsmq}4oL}@%zK:h 􌹨,[.$q`Jb_nZ~:cl.!_Q3h'Kjo2]cS= RBӽ @R=|+D} P]V+G-00H,2"KmHO:'we A xI~!sE(._2gu!IĘxc5zWͣ qQLʟX<㻿.4ZGV@a_4 U Iz5^] ̷2?MC,fYD9-0_XDg;ĒY^/bOJh&y0~V@;ma1k=0QY}=o\ -3}7~optp6Ы -xKv_uV5B1'1cT|z.Aѩ߈. D>~A34{f7gD$W_ey;+)?,-V^]g9kj.~,9I;5k;_=uW?=͗ேkIɿypCytGzy'ϢķWI͟n-gLC_ήk#[ wVJvO>)zq=wJ';OPdjkx;mjNKC{+v} &xWD~HО۹ԗj^~E|G`r`gjٹKO< -vw +Ͻy亾ކ ;`3v|gG?^h/}zٮo{wW|O;"H!W|=.>.<+׽┫+?|OWrO7jCdxqڣ2S9ag7+J@!ᬁxMj=Wt'` 3:4_zKJ>=n}/> -*i%0J di}{)1;RQJG <p[ =(|V?Mr 'grEf{>Y}O= ܟ?WOߕ/%9V\;㽻Y_Vw~S[_Go~{Qp~{7v/|J7Jg2k&)v-'7`6 >x[/o>o$KYzC'!oП])V+]F=.ًOO_}.~+~IoT/Tõǁ~?;\'}j+ {͉﯄]Ƅ\WدmzO>gbcWN>;g~e-jֽ]*$M4R/(ki;PTR(Pw7 {}39g{_כ\ISsd%9H 7zM͏&\ѐz:@?(^݂m,RvKAGk̂{_M_9Uͱ_i󬸲U㒂Z)nBsbX/>J> 9KA_`y̜J[+ZUFP7oϪDw{$5tV(C]3AVԥ;+YvVF4h_D<*&~o(`@di rh -v8{`6樰s0zřG ~󑌔EXߕ麑(n -}v7GTwH4~ZE}Ge/[N -:$ -_9[<,;)[/rS;wz .߅К1~'R/Ukcv^M"lrq/.l3h<"yb/,{EH<oNEGȧR E?{oE:B}!"+Nvx6of—_hY 骼$y_$r#} -D޵ nz^,fAmN#j6ɕ>9[(}$n׺M]^+hBa/E_m>4Y{p>?{I"!pPHm7mdsY-lO?0&DuN0/EW].HV;>z$In%#f$|_5vG 9ŝ#ҷ%.f%>ő*\InDM\ʀ!n]'Lj! +fE |*Tџ>SџZApeđ\ى갤 oÿy"}'7+;$Bn'؟[刍05!y`^\)}q~7OzVgpqe^TyZRR"0{sAT~VAA\zzmKhXc/ySqR\\{<3˽! ˜%D]́ުH`]=~IJt~pTBP9V񋭰=$Te Q-px'%pwWF5ѳ[ՎUIA^YAKL= ŞR[ћMŏ;D[aM|_eMX-md[{CA}=l_&5gՠ9Uyj6{k="hͩIIZG;s͆"ɑ~a/~7A?Qj" aCʐ!m(v -e|N6.ҪHfXb4U]*,nh --[214a(H\de*޾VlfeA(QqQ^rG`髚Ե6V}ﱮDhs)! mę|zi@$cm2;NW\v_C{FڭMoa]DPmx=Ժe<2¿{Hˉ+_͟4<îq(_Ϗ[/|vv?K:q@] +idW' %˺ş~ di1auxQ}iz[x9û8w1Fߏw\gV&%6\JkH=Ӟj{/Q&Z3*j tkFxG1y& ;a֣"Kܕ3bc }:0MBIz!RO(ݎ}7Txҏ-9j c6`oe'#)z%K+DF*c[SSR|䁍aDSROKTK 1- Wd 17j~%ݡ=/;f>(|_7V#w ƻqѲ,޺EU>վ񁵡Oo" ͋X%c4"!K^+Se~-%abEZO -s˃6am_$ 5!^L]y y0.x@DmM8y3|¢XHm)FTtPy$c]"OjݨsAGA{#8N/d/ʼO< *8~j{__z筷e{l[|g}dOyɲKlz`,A5&DS=:Zȑ6(ο)$QG/o9{fĒsQ[\e-qmUaﵡ(Z ~u4zhp#&vP:h~Fq@ vj`}`v q;<tO*&F˳2:6bEAY7 `p5GN*ü(92(%]<7> r Z~cQtvwKߞ:Gt9r$6l,V`.P>_=f60{Wi^,:of)L``zxVj.L1chagw5yw,b;we1o*]zĦU&$T/ֆF LŎ,BbLˁ'2s[ktbC۹8- W?U ].O13(tafmش\o.\X -0L0d:*MK ;L~h%s&h&mcx__瑢uO({jfⅺwqYoeɠ_ZS=JoDzgodb=b2|jØ^/].i =֝9z-M>¦``@⤢A@ Ct+-[L0eۥ -@ϟ+`Rb_'7z[2oٽwn1jCA O>N a tJhJe8̎VB;Tm4<+Ehlz֠D=0V -'QO̩km`` 0#'Q6УEqob->&EGMܢqT@UD͇o=c Jd򲀸]9q/oIuFĴ{rcƿe1X8a:lG3D'6M - -5ۭh75:7՜a0(}_n,֮#?\\eM1Ʊb/vܐ/};3=V,=[n 2rFw7L#ڨgUŋ9`9ߧnN/r=[28k'o&>.JWOۗ |"Kd>5QA Cv+6?9ٮxky 뷃Y˞isl+vk~Z(hv -sxD0LUY -+-u]sEðcWP=В2TW+.>oKʗ˽ca3uJm[ `~!<5zެ} n_*vb{fq>?=Og[DzoƔ``[*7u>٦nԩٻKhɌk(M)/Nhc\7+#;h}SJFɦ0};'jtCm瘎1l';[BJ l*3ڴܼ<(֋}Tͨ,J{V#_Q 󨎍CoMxﲄZ?uHJh͊v;~zC%iL|o|wi 20Yy)L̜VV|lx¼E qQ ⏕f/]A FA9[emboӹ=6;caC 426J_Ӊ+6YfNfO fw@= ̘o&X0U:Ϭv3vD:e 'sJZόZJTTwiU3'+A>RWY*ß&QDO9З,ӕWku`ڄ`܃`JzT6:SqOhT/S28 IE>boy[ -Oyi[oR7П,GǗȴ47z>>Q]e1 iV0wV0k~0gf-YKy@}]AuFQ`GDw1ؼG2'`jo`srƷ^qoK<`e]G#l c]Oa=29DZd0]q&5n%5u3s?XNV<oQ0gY10sLWgm'u>0zAƪ̰!q_M1^C3q=qU>PᙂrRd6kOfsf?c{?ߛߝ -f_fMX UC߼ -̘ο]`^LS϶mJs0w,`VwvEN(dVj19CP셿Ob3JJd47zduyft5DPv#o6♪,+$8Lc8j¶m3fm mfo6;EZ`'*< lz7*M@9H11obaU3qe]wy[3ɱ:=&=TӔԁEM=NO{+?c7~[X(X,˴.`y0_ǂfwuNx̬1޷b>Z, u@vQw<"g[ŰNhrc!E_^и,5kÿ˕\ 0z)X6~!Kb@ڦOS۷_}#<3A,\g6KyX0#q[bFNgED -_V'+I{:OCUi~?׉c3ϟ%?spù6 ,4O09b0wNSrXQk9a`=![?U=aCfs@alQ0Ph{Wi/ɏXy7fVUqJ.dM'׶b3S:?Ƴ9x _NSsp>Ut,&%`~|1 `#i9ĜZ >8՚,CQծJ=b++bk=/m^jG ?c9ON]1N Xa ֺW^n[ߍp*m i-y61۝FY=pY>C;Y53B.FdЂS}b,YPraU%xD z~ro>@;),YKEv̐_`Vh@6הv7Lڛ;O-MمߞЦr6BVi.k*+'PL:#f3O~a?F/%~F} Z18m%/d%~]wFaa4|| $Gv7NTC4M{h=41`_֘%;.`?? k`Zr.X۱PgudV1چMc}iFso?\:J?׵k3[M*!5eN}x`2^}(8/g$GNԚ5 i#//إ"`l`Μ`SY.9+tꁷj nj}zZj׻hsp>3|+cM~7e5g>ʸ1T1֜?v<`L!]דuߖiJ?v*gH*dMf|2 e}ڦ{6uU{:M6_}XN܋`+'`ԡƿ2?X٭YlctL~g4b52XK_bmO%CU1^p7pˇ& QE-;@(uXVj\詴%DFa3<ws5G6l<0g,cM^ nV4Ž]jKwƞ @_`*3.gLx͌pq5aqɺ q3 -j~!g~s8…mxg}%H؄E=_Ni0/KJ,߄ҏ{,dL2~i2TWƭdM{]_4L3NZm`j#8vSy {o}v-'Kf~su}qԍ_1d[ד#o"V?yN1ǩsOV>;08Ɛm Z;y -Ec̻صBIBKW2i'}G$~fO貢Jڏ+Ls }r+u,/Fs/Z -c B -Vx1`-a~fN1f_y0_Fo087uؾk8Q17/j-:ّ&O0Տ덂^3yhp_1Nff^̓弇?IoS씒`cJ,' 3-{k8׭N'AቋMTOMkr -,JzŸv(6s XCvJC4fk>gj73 e?ߚ-_Ģq {,9.nlT{QFF`.@ -H'Wn=/t\$ZX% -ۄI3唼rYN!}[b^Y }x.|/;XNAL^Mrcљ iٵ1eZ5r{n>xYc< ʸy ɭ6P106`7fhyuOr:b`ǘv, v/cl`򢭢WMG'ݔ &LdAcc +Q%KwdDfFE®v~Np!^WfF-2 ͜Njո׿[b9wLT\fC&k+>%B"4GXI Yf+p066yŸ*/%/"}yz'G*k|_UyI -}[4~9u/*Pi LCWnM):mA~Ŀ|Ň~fH&3iaؗOVP&L@LA m4y+IJ|s;̤7~K+aW+ȋwV r$TBn-b:ڃA\guk {'W?jKPi[U鍿k -}3+`OFH w2{KqA72; OZ=a䖵dkyۉxIz-G#J,JC\_p4JSI)Rx=:_Q9v=/5 _Bj׿>ݘP ?wKNd!cúm׫Y}y] '.n|٪٭7p az#a3cl\q^2Fe }GȷrUSG5wkmBB3a&韽BK >[O^M,+]䐡® kiAf^zXA VwygӦn/F:_U3SŎ+]1ZA?5I,úi| ޽qY1WhI*8'/NSa[x$ݒDt S9ƒ5VR,zk Ln?gHiu1h] ~G,h5wT#//E@)/:_uL|?he byѸ!1gAcgC&!o/FJϏ2y!W"'%;k.ԼLn@l3byBm.E$jb9h8} -6< M8;!HizmHCxoz%s!.dHĿf0ބPTB'MG̪H+=^?t7R=!V})X3q| tI;?Jp(Sʘ͹QYe -wzlؙIx" qb fX2m4v(1aĕ^=5$΅N#Չ&mR['>vuwc̟W! =hńavoy!s!r#~{Vh6Ʃ}慾X"8#녭{@s>0[+}cc._NTk`+3E;О<ɥ(y>U e2"DZg|cPq 3j\zARVAgv?.ұ('#?pk=DFqۈ鰼[nf>_@P-& IGc߭g}݃w,<>B3]BL,r,2t#?o7'lYXٸ`_О0<~C'jre t+qk~e-?JaXZ^݂ x*k Qqq^ E􊝉EY-9b]~'뎆S*9_=x+* L%po\&X3Hi} Fe~\e1ш%dL:"UvB9O62}\9@y磦Q" 5z$8e꜇9]Y@z&bY.c~YNÕcThĚGAJpu'x{TUtSZ#0Ȟ)ϴ9h?j naWaaF>8Dv6b!auQ9&dA|)!vPCD5;0 v0l39 P33K߅#?bG -pY+a#ڀ0k.+قcG:Hр:<))/gPb>s#0;̷:4;H1Dy[>YƵweY0VZىV/JTvqVopzWiGY?oQ™"B> V1ڋa$ț;}"G1@|1;s0p1A墺ZH ˍ ]1ڸONaf EL1D:OF {cAX|YBh1  -p٫͈=ApX'X c3aF!S^(y(o$n.AA5".F6qE|q%<9ɟu - -Ʀ4Uh#8@qH *zF0!`_C!t-N)# .aY*br:({z{ J {ܭ'ވY}cg;6TvˣcMk#]EQhboՓh_>cʞDRCտOlHmMػf'05b:qcG,9ȳEpL=uN4Mg -9($kОZ{KơIs;>]H+0͟+(ǰicX¬H_ՂEz/~gN 3?S1a$qE$􍄍i2C> w 3g5l? 3S#,g7s(Gh[TAENA{EBX(#Vm,Z'Ga vE Jr-" -=bԩ+Ka~qˍDF`˼iv">gm?u6Q#eِ9*ފb9ݒ.8q\ s ˎ(N10>%NMFkUk T# 4]+v&o}NE qP2>0ٱ<br#4"?nuFER-Oӈ+D&;|FŘHwGpC EV [6'nsLq1YJh_ Ѐ2(Vc80;=Tt\uC}b`ͣ v,vt4RgqL wV%.XJ8MExReuTQHo*3rDqX}6ħ]bb QuڈSiUY 'ܵi!P4) ؗ둟}}.@zW8OCSdZ("ޱ)&RYF ùY)!\WJ|5a{FȄ]dZk(c35]ІڏvMò벛鵻Q͋4кټ$Qv-2z?>A~HkH: n܇8hM/\[B7k#|:euZ{$,Ddhsxf9(VO*߅4[;򿾄սpw(Lj#.2S|NF| ,Z~q*j -pquMa t׹aAhY$Ҍv') X1VABIhFiِ")"7,28N~UβQ|E>v[]<&k>/,G+Q)+H/9Ryb--Zx.Sw;) fu"y}2p5n$p=2;46΍euyIȼUFUE 64c';RWrTt,òQMvЛs#ޓ0K[^u bKXxĥ;q +'T o"Ek+PElqg5Cd["C/NבEQ0-7jq.dL*b\t ũRZA#: 1S$-NMfOI 2j88Hˆ,l+6}xMDDKXS$®hHWZ=(yRy}Dz(@Oe},ҜCӑ>iкG@;AfuD':@OU>Ps$*(.Y'C"jعEN|{2 b".7Wf(|dCacvaq+Ge-+) ɣ-9?Ib=iLYKQ˴2/,i@8NA:HgFh4VXmcInեf͏{NB*KYKbq.:Juf OęHeq\a#?p]o]iPtHY,Y!7l%XYF!~cOV+ն99iS,6{>?#K;K|No?1|^Qm iͣψV(f,@DKٸF򒤆tF.=S -~ ]| A _C>*JA\]*S10y,|vʪj ]7D:WѪbXZ"6η9X4Q\d5qјP#\(U\es>9 -"z5H(=s\t݄ -}vV΂DO\ȸvy,`<&I ,(+{Z&6 { Ue`cDN(#}&f/,n4:N\ܢf/孤cvR_sQ"`t6vV<2RNH;K -x\g4tݐ^CbsΚX^_Y6ncEQϷJ}axyTNj#6هr ]f@gj^2KsGi"m<0v5Btҕ?uO)#D?w^& @xz6G H>*ڄrIą< `bLcCJאREH嬶);nDk]SjVzr қGYt$em'V;@!jbG)fǜǛMD(8H d:({)@Dj95KO%Cs3^ FQ|=ʩ'ȨDH9FˑU J-l*G f̢bckmN ND@E9KEΈ9E(Qَ_x{~78J(9{Z{9}2GZ>jN:$f -p'7,YT$yM=XJ򠝥m(i!{ǀjSﮦYJ'C;+\g,Y;{VrЎ)~oo@ L+QVO\t>t%ʉkH_Ob@HEWF(vry WyW/"c 9]`OLX6k ~ICQGDAE -NL^2xsEqH)z -|)$q[?%>2O~+yEJao&tޖ[E.,v tùCokJRVvS}kg|wRKCW@3G~{퟈8[&ԯeȻ94)uK3K*m2ZٺtW9!h>f0OrYF;YM? /}؃jaSp֑;4Rltx:|}>t1eܱЮ݃a8&b}.<>ǥT7&@EǕtjriRpHbٱ;s]X?^]s`hҎT%jݫŠ􅸲 X`ireoKNKfE _p& 5Z1q~=1*SG@>O9:]*lLyV5|>Pt6 {~HBS}Oc$kTg5Oa l9p/Ffo?q*:)lA}S)4XCEb(pj~(!XXN B4qQ©On-Vĺ -㡋.ljЖ hPp/uRyMU ]:Sc'kQȒXǘn}.f\ȭY,VVtCSGUF˚5SvBPJ SN\/"4YBم\#h|ep5߇f 0saF;tU6jGUH9~Xs=HLh׮J*JkRJ>5zvޓf7w$k#$t6\DHEs3{? ٷ'Z0 -w|$A}(wK*3Z2~iz -|]FlU20Bz4kP FuN(FC 9R<BTx:S K>GH?0ClIL<2T}[.ś}`01d.RDĨF戏+QsFCZH|'a`&c*Mr4}c\Uϑ{Os#$vE]O9>5 X睯41'<Ί,m#s*2X"Nмo B:z2v|&wu1%|Yh*qTՆ&vO>X6N9%\qxQ8H^\{.%EM ?9syw#wU잺U$Zs/Ɛ$@}lÓhΜwu蛡grb a{8G-̊`CKBŰ=q]l텨K|\ٍjyc'@ -&QY 9M9@rYԢ8hm~ggsI'9+=CGkbTB`,tPF/ve֬!j3ӤСVc tUMR& czGZ(o2${+86{ꈻ҇a_wDyY6ry?R9\?KՓ94o 棘5T/CsFA˺0_m%^B hC -yݕtmNy/b,ޟs ¡SYoױh"g - kcSwcÍӊ֘ShNE kgxEb40Moyy3b4?r~RO0\>б$X-{_ -BAk p9#gu 2 ^^љ#TQHB9v_NxjBC=n(nYQ#|@tkST-z3n0{Z#G\ }c ƟdEPΣk:$vv珢뀨G`p@H FEw(vb&m}td%[M8?pO 0(V>=+W_[uz6)MIJ -}yx^H!hG_zhRyޭE Ћʹ>&[0pCV=^p"15=Z" +=<6Ir~X{ޔۗ_ܕ8D/'>h4󑜉p/mjd[h&wq߁ irﱗGGB<<xzZgK3{70pX/s;GRttS86yfAә cbP>얀}s_D}ٹT5C13SbQg'sLE]83I4ͼ4L_Z$$ IĠ -ayP'DJ &>X}t7KMEGʰN?y0}H99?8] B[+eH4.%I55KS;H9?]xf*9x^_D5unϲM}ύ#Eɬî#cgA>=v|;ߎoǷv|;ߎoǷv|;ߎoǷv|;ߎoǷv|;ߎoǷ`-klvrt Vn\hE~پSDjJkmw8m_8MkOdci5jT8w۩3K̚@͛_z::8n#OZڸi^#y\hYHsf-`xZ0ob}<Ok^ǛUݦkDT}Օw~kV3i\eG.?<=Em}>yZT9+Ƀۅotȗs?·`Hq"Oҟ;GX_T߂[]F?|y6|/_~_@>}.-ǟ50#]`Eu}6ld,cl렅YTnܶ} Fnch$2,{SfCfbN3CkJSf u ͣqk`JANEwQ%]\ջ`j[d'| [aR;hVE[--4⡃fI4Dv=@n!62B -G -OJr197AAk)f)lƁh\o) y2l,%nH#T(@^q?=wLAEcq|PwWtnG2y>m6ueܦ BZ=% I7S2A)"$;4i1n A  65ffaLb@&e ޅUoc5l1h]ez䞒Av& ec6{뀔Ĭ6L ROCKAچj)c]¶Akd? suWtغHp [ٝUwg{HN!}DVAi6sSJ iPJ -IJ7ûpCQ"7rFKKĴ AI#ͻ7%(Jx%А-䏅[Ty*=*㇂Ml2 fAprfmPK>gP?4GY_MɏBFLN*an1dDl_ᰭ;g2 ћA P.&ܕ'Ѡ%4DL=)^Y7jAҐ`,d,=ЦĞXU>$Tn[@D9XZ4;EdKƍ6ڻ%xfֺGc,X2ߔ;[2rMĈӈiS2]dv3@Dm "5>f-Yn \CxޖJOm|7\-:'4!jA !'٧W&k[JďZuJީÔ %׀Oo4٪|x[4q@/B@2>}J<0T7M$pg0:NBҹhD9lEr_AA|/a(SS>0U$hG} 񟚆dⓉD6ܒ}{61MM3ѴDoQ{#~Y3a#f ?_s$Kw5PF3\*&KӸX56E FDHV9~< !DGNjhVDKPH/m%61KP*CI Ơ OL.z a-*Hp -K#π}xspA/`WLM ȩd -x ORzȔZ?P'Yf㤭s펦n#ScmbzA؋q>lLa&f-4ц-pr 8\[d?qg)0d⎤ ,ܸf=#\D49[{t%x%\_!91$S@o4[J1%А } ]@8Fa%FەJUQh87?{L$` Ȓ=R±MR)E]AٻІ42-=t+|҆0@IhT[B/&v@ 7CdU&%4܊ gf⌫h84pP1xo@ScH?1`A:6PKhܣ6Tx{T}1Wm޻A"ׂBnNo+%< x[rnI\p -\jGw~oFOA\r~AS&?@02];Aد{t?Jpn9r;ov[L?jMOv;txKi+Vu z1o%M ~Q(4ZѠNI \)\XzzGzXD0aHhj !R ,(ߜo`;!% $8'MMyEv N6h$6GX̡Z>1%b}4&M2_1/ADˈ{'%@6CѦ\ڀ Gmܑ) | -AjK|Ϥ͢h -ZJl  Err/} -K>M =-0]4NR$63q0%s;uNX[@ 02Lj?$ Cs?y{O<⽿X~4f@b)b_ p.)`HqgtcoڌKlTI>v% @~d.T d4paţ)gdz}h|79 EރXbxX> 4Vsdza p~ A-T@z*EVOçACpo3$݂Du m ]:>L0YXn*$W漫ɿdFЄ=|m== ôq726i"~2D9h%2n.0w d CX<"O lh% p2z#Fb$*7-`RPLE_O`;RP; Q" 'WKJI*Wѷ7d|兏B$@z~aDÇW؊א5 HB$f7F"r<gI|H|2_ LףM8D0%t!y_EH4$rYhs=O`*@b,HrXg2|z(H<`ߞ8h7\Ea $BkE˂w y `Dgg - r[3~%^%q.w.ѝƃq>=@ F k 6n諰n|]ܦmnB>| -Mf rJJKt1nBIA8-zE- J!/i\U3ZˢgK@I`dvyX|yW`Op@9 xߤpP:j($ D. In}?%!g v)+\` jr 9IAW(w0kÎ -{5DUӳJ29_]UjA O)i{kJ=\ۃ]ww"^CtB^_GlVxpEc(68 ># hvGv[h5&d.HąG3s5g@-x><)̐bF?T '[̥ dڜ4fV`ۍfv{:H墧6HANy(ޝ1cQ$^whԅ ;H*ld^]H @^ `<5掾s"`#3TQV̀ЎM9;3H|6_[aՒHEIR0X$$_)y<"~gXN}(Hk@K " q7`^885C/YO雮! LIrlEqOTiW 3)Et81r2PjEUT2|y k!BGKlν||@CѿK?SX4ai\v -iPXD,2FWBG#/D D\K}C?5O0˺DƠ06iubWST`iW/ 9'ɟ@F&{yPOc $o:v@N*+^[ ᗁwP!=lG@[rZcPos@qKP/&+Cۣh$Ԩzg@)y+p;#QR(Aqd򂻋?*|4U[ IZ˂l8c?A9BգiM5zd}Se@"-Z -$_jJ/SGh~%~P 4<<BB[p_{'P5JT6D 93:!ˮ݃P_vE 9?>B4vʙYJx!N %WpY ?p#. -#̳s!LGLp"1ϋr}1~%[شLQl}D# $J R: K8 [`GJԇ즃|C8Ipj_)IF`-```a#~藧w 5Fs/@-̦^%ĝ&{T0/OCL3G$٦ #[d$|zcMHKZ+$@kzd)EB0=lxEzd_.x^ ۻ# FRpg8sMI)9?Kǁ\VVHC -}I^G-%ȱpn24[m@r4o"!Bk kMCN/$ȻK6KMG TۓRF>v -/ȹ9\ɬ{R4Ԯm$?Nٯ8MsIA!76$fN&yhC -YR~*jc@t^eؕ{}uR|7cl~ZeQl|GE)u*L漫_JJvfQ/%yFhk yu>tn!XM6+"GlѓIwK@?u>,7 - 1_xqX/䌦 !xAƖ֝&|/BPgbBiZpMU(+]8{`q{sDwm䩭!u%?a8 _B@ endstream endobj 38 0 obj <>stream -@ązI3S"דi2[#QCD><>aZ_rG-W)\㈘ dr_-hHzwٹPAp8]TsDD~Ħ P]*v[x]$i_ h &*g08{FΤ!tO7>8O89M$?ImX?94ɍ WJxl:,$/WlCEӵĂ1 /ϦT0#vʅ́thF.2p͛h؅13jSXqoI} \؅}@/ aȃE]x_HINgDx*4D?rgC3fJE7R=<57-eWr$ĸ>b+:r~m.?{uL-eQԂطѿ'/]yR= Qr"=@Zq~I0_LL8? -+{ջƛknӡ_upD Wᰓ!-2--~Ne\e_] H)|}nH5e]G(:*%8=l66PT>ėǖN7(+[,Lي ?P 2O7`  3[X1& :**vY؅WQ[!:iQ5aټKx;i se LJ6T}X~`X8zBr47%#*9M#!N -dK;b\Xq.y!w5/;R>-$GkM3כ3]dK-.QòT@Xɣ'Þ/(իOri\TZ˸P"}?!m'~ϳT" ،b>_.vRRó  ښ%O -=!XS;JP=Qk+nKwiW0J=`5!bUh>wbHA,=?;n*m3B4: ~ }e|WҨ] j?yo}㟅WbSSE+XQl )C[кL"yɇg)FNbzh~qd:$vн=c»˄|ij -/jlyX!uxGE9\̩IlG% -1M.$`:ͱ!ʉ|n2ar/[y,}{&?%MN#G6Cta:[8J,L5K[u7sbA8|&Z֋L  ^Gc.TƝk@Aد j!|kvP Pb|7rBB͡5H;NSnL<5{:4d 3vf|0@#j]:8j+ƵbnOo?8:M5{*IסqJ>yT@pq|3)ob nL=Xh2>2SB \}wHAM# E0a]TKrSå- -Ε:Y>V>gb{@sqQ ߤ!4JQ0]Dj.쳋 hAWz| T -ˑ<%% +4?)m[5AOFCZ1`5tAX }ϫ[!gn}5!a-9:ji$G7)l_sSmbJ6,Χx8Hk"_ۓR_R4$lYjػ!k6QT wm}U#Gu LňєkG[=?$. - ?=]Z1kBT`kX_!cb9<"Z֠ޢW&ɣLSχ"[_OQj.Oꨛ -7pd*FI ڌz&LI/^5ZiʙNA^ ͞)$Ϡ{t1L)AXo:]:XֆP^)D+0 GpwuGOGC5>9# jZ2L=F?0 {9S3V4BUVl9ݣ-b -;/EԷ#'98G>Q{`JHh:W!vz25ǥ%/oY^`15 {"4BKg*DueE -LQ -B}&TEՅ+siXnL4N΀й24ws'b5B;c!d`e$g *L -2йuTȻsA| qQXĚG>ƘuE-r:g1%GTҡUBJ!|4nt=^Mq6^9[QK=<ISQ0'{HE~ bRb©[YcbK u.5S{Z>jX;3xAԏB kͰ3sX,@/OE'揅=WP^޶[P_31?AV@Lۙ6^+]ԶğKB)Sd\^@O MEΆaa+:ȫ:VEG>+zIWҺ4د|CSVL -omE{bX_:/j؏fZV(+jZ"Hu{%QS5{tP4e@NFڿwP*RMo*4(MїwG1&r쩷uڒ6jmA}= >t vcp1H^eI|,p1Rq=A -R+s5 k$b*=gAJ0U-(.o]cUDCЄӱ/)L>"Y|3'wr:A xIBh>|%{r_@A[xy~]CNc@kXº#jQc)~"LQg6Bn"nXSF=K2b[0a9ˊ|i#1pwRL  !Jc \L8CYq2I"4.*;LE-˨ݧ"EQݏ$f-:*ɏ-F#ŝΧMk>b([OE,PrڦCi_R^?X=\wPοh}`[ֹJh3;7 9qhȧ]JqHĸ3EUL,5(.$?`CưʣN72DZſWWoՆne ~u|bx޹ީjå [{^.7.W>R\NVel>PcwmnX yGu]J6 7^;I5~-h釮9[!xWVVtp॥tV["P3:L2S}$9`gu -&[l-[x=a!j۱;p^{pߺsw~qTV -[mܕlj KmcodlǍΟ`>p'^gt͆?sO/V UOMUg`ߪ {9{pN;m~3d+N=}P\ybof{?|ʍkx᩸ANߊed‰vٶk^E[!}lIw[4u+Z~5㮿SM'1?g2iR_Np)UfZ©J]R<^ǥay#ɮ`-RveKŒUUrNw}jm;rH(V?3XeX=7LH -;FߴXvO3y_B?_ [rEJjSV˳3n}q8[ᯡһ'_WKo:/v]h_h'c -Vw[U:koؓ܅WtǺ&Ym5O+6*4Y7ތ{)>vʼR˄yM,w9ѪWSUSWw׭Xi/Ց})@ܘfL-^}5ߙæ^zHq/[]۩]uNyJuX wS?W/7ʓmgc|H>ǏBUm m^tz~遢/O۽+~x'uGM>w|Pw2yн<߫(l֒]ɍxյ63~YKl.~TvؠYVo+?N}sFDMmAh!Y{Gd(ڽ:y8W!Ezߞl僯M?ˊ^Eu/FrEf,٥9x>;_`1Ch ^6^ec"WUv볕广.VppOdMo^= Řlyy>[|T`~/M+7ߗ2hkGe^Y]xna}D~bˆEN*O~y,|LNOgۼ;a[͎m5wWSS?LSv_ј{C)$@ܪLYiȹHzSWpem}p/d5)gZϖ_(W>bëKIh;['G>N**i ˋ~T쨉etyO֒Vۼ;'%<1D]q>8\oVl]|v͹9ߜ߼dw.}Q^lqQ^mqW~Kogxˏ]o/c]x-qoW~DQ<[ŃUʚ(o7';]fW֙ZhRӝdoy}%xռ=xATfI<٤yZ\w<,ΓE^m{[yяS23+BGfxVۺ+n_zM> |Rku d ʬ Jso)ϵz-UД`Z_<,wY(NKܙxfa'3Ҿ,wwV}S-YxͿ||8M\~x.,^A52_-śM.ÛRJwhڻlۻqv/n}u,ߎGwjIv|7cߴȼ+k0,.<;!1Wfim``微‰tfWvO5-wldwZ=dV+ޭdN;֝-jlzXPH]fZY~𯆖E͋e~]ǝ+ -m^%.O[K|w5oͩ[^k.*|8ȽD~*IcmI yCՇ38yՇ+5!yk=VFf9=۟%~HE57;]}->Rݣ uM ƴĺ"P]]N[J~Ww7:g'Yľw;sS|b|zkѲƤI?=\aTR'=8C2ԅfo -ȼ^XafoW?vb|JPcf^b܂Yw#rR}][9Nl/.Kx_ڔQYU Eκ קs];w6E?I(>+^x.[]&F'>.ٔ7(e5]+-^M!9>!&\Mputmbk[E|?g;ώD>J.:~;T}~`aG S_s/2%f ']Y^M|փԏm?]"$)dcG]^/gm νv_}?+-DaGC"jitkI`ʀ[ݵXRb~Xe,X3h*fޢ̜?13`,2e˃ 8?hmտN]kg!{fq+>;F\vHuĜZo^gl޲x煦>ꁫDfh}f|w=f,njf0ߑ>~Z0VF)@k*\{24h43I^5cj}njό52?z3urf;jw ~4nd/Kqkpww"so ʸSq?½؆Ģ;ѹG蘆f܏ZOo۰ܦ6])d.ܰt?gm:8зbqq={Կ-4<ӵ0ɤD}1L_ӛCOÙ0f}fbsgtޗ,8f][z_YkrU1Bl{-~pnLcR~#/fUފ>W~?0coMxKCodܺQ0<;>:}gR+_;}|=Ei_Z:$nsf&Ogf̜¬O0rZG?m@?Ӌ0?r]_7F3U!A~Ҧ#ם̙'2?*.λιs/&+Vl[QY{oFfufs2y&T}nH֝ڀ o/_~Ց{৻rBr62ʉ2r -qn=Yiѫ%i7?ZjJ]gAkV0fĠ̬[5эzHL|=ѹ@^Ȭ[7C2*DdU ">&ݠ<7Ӣ65%WJF{H_\d_=M~azAkJ,n0w/Wn>8gfEakuM3е&Z!ٶRcl寮<ٹ׮,Klcw;6xZd[!tK j y00ST@~Ӌ.]]w[jb "#5j}#_=ioZ8` ^>z=27s ?y/$ͰWsJOMIͮ'yW]PmHfqmdo]^u-Z}dJ{?ٳ1#PM?ڜN?_{sO3\//fDf5̔E6Z뚻ydla5.Yȇ[ʲːWG5e8vWC3fonI`]ayN Vz3rN|_j{;Ӈܡ>:{5Uヴ\ko:c-qf:Ywku]lj4φ=9;e5/+4 满mK6= ʹv'4g[aمw>v).W2tй:˘ z@8x3nb3_*Se_Z_>r%*;7 - / )t+,Ь[Q꠺,<듳H|W4D:jXe4}uh6=gn_~ׇ/7ff@7=2NCOEbXf3DfP ̴ҭuVͿLpĄкSmՇ+.mjc._YJ| 0^[oۼ3ӧ=3.u'hdFhJ5^`kˀ>Х!?0Ç-f/da ;ed&,^k.G#I{Ӏ͎_*$=7* +{{/raBm -.mo, .B޵k;`3'? O(K2úOa =o3bfօ0n 2_2Vx}=8j|։1n=Ww;Ap޽[!youӫ|(ήf__W чz_EH/$8\g<QC00#Ǧ2Xˌ`ƌ`Ɍh 6n#3z24Jc~ ]qkrp,[n:w+TMYvnMGoBAYodݾEQKS&_JbuO;^5sE#aZ#}0#fF1d&RxfA7rwݺyiSoߦOdYo_×d\s c8>LF2͠c5ѝؠ3:fL@fX_f07fhOff"2ٱLmzl0tmlzҳZMO*߹ɥn{v`7^?üo}kI}N Wfoؒs!ه$i3ɇ+3t;˙ACB|&gd>l8ؕ1F8N1ckl;3c)%Ϊfa߆jʠ`|tEƍ6lJy׵E^.٪kco R_\5LEI׆x \?Wol!%Ͳ18 7NYQd,fK83n3j)Hpi䁘71l)3zLc U̮zano ݿ2|gR6J}_pCmߜhRUsu O{v~wcK񃦎[r6};~Ǎ-Y㹙󱡱?3+[џA/I2N4fh?y9ɏϛ.~Q?2LD>a’]hk^ XX|za晾K1a?R6$?]Í)OvlF=ԮW~|yO?vQ -[}fMc9>Ù3c1Ӽ|63!tZf1Ӿ32Ϛ(`6弚gY+w~֕>n۬8caCg 7Lz`{d`_4O !3&,8}$w.Ӱ]!( xOeOȰr]1_8C\A<̄tU234̜&..18.@aފ;km2CSo1ZliMeݶZ?s/Fw -fr֚8q!iv}G\63IŌ81=irfw3}i 3e.LLL/3Zg,̹f?x5>46r?Z͏+տ[sש^M;hpӠT|nT 㷉ғWFh[[5?|Y+|>3nN3+qʘ|>8tadA4[bs5e4+՞^?T~t?"?* xed_|Ws_-CD,P>m~S`KGSthk2#bĆZeyZiaKm`f45sKf i0 _ "}5hW<5,re#U6U|ds MwKKla-!Tʐ̾G{ -8mp 5v`G}\W,Mڄr)gaSoãչ݃Ldیւ6MHEr~dfnp /VHKWC/?"_2p [Cn78-xr옣۹X!K'T;{~>|'>??k0_8~?HsVwZ^Oj߄JmV]ĺ?O=C^}{Nq ZeIb?LhRGcFOcfd3.qM]^r?F1,&I}ѰԻ`K/<ŧ_~up'ŷOJ_^5( V$2UI3Wo=+zR.=y<6GaòL; 5.^z/]x.]{fFоxp_{~~_)u}V',uv$fL2 FncpѐLVI./%/JoՋpjt⵷YOwE>Zm~՗>4*.;l<7^oG_GelW 3$~ _~z?Cn1Xeb矲zI@ -3z\Mzvi7!qmf ,nvyTGe5߾Tۣo/4ޟy _"Kӊ%h<)|V$zr1>2Zd]\R>C}+}o<߫汅-C]#;K7w?<;r /*\5n6SvrPIT$fI>+?0L r|$WYyp䟋# |Cow5 -a$.8,6:|mxyKUa̢Ù%xLxpa+s5}-}2OGޟ-³w}!.:^k=Ļ4מp{k4M}g_Ht7>[e`>%yڳ~&{[8Evr 8aXjߖe Xĕ4=|8z{1a ɖQ9#+O,O§/co?J}/C`kOgkOtƒC]sq<5 /0W1)fe+E/<οU[?=3Nn~`3}O Z-2gƓA7Nvsq z0ίW;/Mg^魚CƖW9;N ~z:_WfVՐNYaO0K(`os[_ggmV.aPhT49;Wc,< \ƄhM" R Òs7 |3BS_?zZVv:r5_+=j9l.Wm=i%YM sznS5\vSyܰ2po |y1Šzg}dn h a ~9$'%x1 'bV0@0SЄETab~p\[zh+,&XYs/*8 E-CCY u |-[yt:w_~bݝ/JRzpZlPqph~/zeTۃ5F>@=O¾}ӄåƁRAp!o;rU]0U޸s|D*Ձ_?,WB8 ]{,_y> -6uVnj}"N{v2;oU^0(?2xn~j@+c_!80I@m*<׌ 4U7YN>}}7̛@) pŰ$S}zvGs|MW2qso0 Gu+9 ۆe]xingyt>?qώ'{n\)>Px$n[7ײЏ^ܱoczy*m(E >LcO.OkӍFlV;՚z[̘>@R7Ͱɸ/^ɸ/Z)(XqX\_gƓs>-]Z[99=R=ݩڣ\ln nTo\#cեsV5^i={5^!t:ٛŪcN RGб=2hO5Gƨ9v d+0.~Sj[WϥcW^cG0_a5&Bq"q3Wp3E(n!fn37 s6;[HUvoAЁ77J++utho7˭P#eH }?=\ŧk,.)OCCӱ^hfQ_dT199Aɦ\dZfƒYFZc+$YB+ KmzՌɶM JZ7A\E>NpBf9`롻k1Ta/I%Gu'&N|ř†H0IjA[TkS^pV6p ̒"o&@a>KU\gKf=3f)?_t|ztNO, ?II4U2#cM)Z5%å-.co/&4\}=ϗBGAHY |ù·ݯ\ptP{4< ,VuɋH+E\>Gu\5OW>/?5 (>B!#_8H<6|2}+B[?.ЂK);Hr)\ۭBC_)}zPWߪѧ?]6}@e[^RUӧT?/B l[7nϻfrGsc7_vv^̜ 3ic33g3+Wd|$7Hb|Sx*ex h zZOÍ9=\1Տvyt% n.J7V<4Pw+Vw;KEĒ>`5ϵ\ܾƷ[k(qV>W8:H>2B}o^ٺS]:_88Jo}#eX)V:|,fy+ohD :0QvS2讁C^3A -zEC~x80R(ږ/)vfw>^H{?|!z+I ֝!|_(_~?]9"'7k/UvS V6gKFqUY| -VFaMC0sT\aA!Y+1K.dV.&vb<ֆLZk'ZSLAI/f|VTsv*>3iGg[hc]t~mb :/ﻊU=0w̷Z?Hq:qduYv}r}.8u6s[ 2}.ԟ'j>Ҙ2?RFTjoǦ _zq7e\+l#tnt~3<{Y.7r#c68[#NEۇRN3I.^gX}(eIf7 s-R+YD3}.:Xx R5G4x{SڏIA\Q:=s %VRapՇxq{]u`۟-;k`{\^RsVYB"aYb' ֛|u=R-/aawo_wߨ? W.dIksCܝ+|^\o~ꂞ^܆'1 :c1\7+8RɮThs@_ x6CbzY?0\C_˧hCԨ e(Vr|i63Ixs 3 3)ERG-ܞoW凝Djd%Xt `3¾#vOT3˼ ҝ#HH(BR:*Ob#r-ӕM1KFΔU=qr)n˅YTSd^ڃ>:}>5gRcʣ c-x*h>Jҽ*zʁU=rOD_>MgI ER }ݔ̒) RDfr?uʰTS?E8eTDe++);- -(薀/f; n>BvXLpT/U R+H(? PKrƏfAH#zb!gYS5U6`ri -,㉯Xo'7<0  1p'XaKġ^Ӗ12J92⼠ -\}pxu$2E^!XleZSm8yt9>e5c…6Lb%1cBo$(DQ}CĂ|zu?ep<ՐVGͳƔQ%P)3|XH2H.j -M,syX'Sʱ$G0b#rͅBtnK9EX=cIݾDqo W,ʼ4hvBO{>elȦKs0Gs叟מ'O5<8BH(eMFwRa>5?nğY8avuV\䐚dCRT35ṁ1685'o1Ow聬;L>Jمe;FϼE -:jNqdCUfJYCNkbNļz -GƙI*} Pˌk*K//T2z`i6F$Ò(jں#fhNB { )U } ";r30CnvѶ`j>]9P[/6G%tSL -+6" ZRz#؄a^*0#nu9*kwTتBH~Bؿh,Ϩ][LfJG@jIV:$F@oKXhO5 'R9N͐;o{jWjv7 υW>wC=~u>Y.巐MBnߏ`N۞-zF˅;$Idr+nuE&2p-2|y3nr)CL;aݡBzpR:vzh "PÀD"QﺃL}SJ5vk*r4DŽ[27H3A;tq:x{+]1)Mf}1xAQa`ySFtbiQ<ҎKtVț>R][(XTa͵_]: ڲ]96CB{*/aM-gJu+vlAڏnTq`Sa)Zrdx+-՝xDnVt0fXKH<%Fo&K;/tOu]_,&A*!8zPHs&[n̗۾Z)wuStQiv?隒a+֛6]hNFrbh&Q^B-41K7~R[`քjڐq \t%~uptRxj -^jZj c cA*3 8cBbN06*{$fMz!!'~rnpʮz5/4.FʻGuBW+} טacI,㶛2i|Ri`IeU4]=_):^.*Ǖ=ΔoBHOMW)*kԺABZe^&O9Ќ!vՔw m u'gjh5[/׶>4_^gY6yԞ~Ajkw9<׮!0DJSe0WW6R0 T}6G`kS-r.ڝ=w4tZ-tONWp*462-6^^gtRsvD}|@yS ͞\ǵŔōrRCsvM-Fr+RERg$ހM+X^x>~:< uK4%Gk& WO5mc;y[hOMEJFA|+h5,4uKr͡km%k?m'f~<]}ہ` #-7R]`/ *N6\$5ձ㓸=]ugoF?;ws;wtabN+М}:qm#;+{xyHbޜ.VJ4C\YɵwagyM-'ב8*T;^*0|v@;kU:<ڲgŠqlu1V8Lٰ s2m)Sy]X|nh@dT7tf@cj'URҽck$BSEs,nM\ /!7.H'^ߕJWiQ6g^'=RW"T;l3< Y.jgiM;;C -hԫUNMj )6X-FQhWC9uHMjz+uQh}<ʝq绾ԝ|~bvCXwx]7CQ|z]W;9UziUi`$/G\u>T`̱ -9'+.4Qjm({U9t^ #R5n278},jgkvV H~Tl]m\~ʭT$X2a,gHf`-zbavT1&ZяYm -}&0)zy -Nau=+ $Lv=rdHΔPf%PE3 gp7f-Qul-v61ϪW;QRR=>}7!i3-,+C;+2>HM$Q굖T+eP]K]fGuyqĔZQ0'_{_f5[L$Y9@k|pMНwiy_y;h3{B MmQlt9$9} v -Œ| rísa#rBJaR5e{FmvG]F}^㓅'+KE5{-s{xS,5bigb"PzH|2F|EfEZb,4i}ԅMô?l {wA 4~(>mV-|E4MTe'`,n)}@fR]7XYj -ojcuz -tM4F -7RBդm=˹+vQvVIv!q/ ts]0kJzf97 %>pb݇jogl׃G-5mه\c兺&k g[ud{O;8Ў6}=X?Yg|z)?@ -dF!G5R2B@&D|XerI9&H &ܚAj"T[yhS;xq桝R1XAbhgY>ﺴ{mzI,Rh4IbD&Ohw,Ww"49tv^&̦A'hT<>r*>1Bm7PI#Lr[7W 6Yd5 #u/XJ;.T;ϵ|BQfhga.j=`uSmuv*vVY}N$y_|oo '.ϦV'uM^ڄ#K'45H^9;VK&ȊŤ&oP~'s]OC 6r/naT<#9JQÌ:#"~b \ > -hsy c2?n]o"|i^I RE|.ezVngT; , 2JSC5jS+P#|wm^.qvÁecSK5s "=p-z{7Ѧ;P 縵T^Ip ˑGX$ZHc68`g9yL*H 1Wڢndi){K).D3Rb=ȥt#i$qb͓m؟^nga]Ps MgfB@e+lqD hA[{bԪfp]S΅ K? ľhþc`\oh!7)o"@;(NϠ m<;n>W޸_}G."QTl(yMe?ǘ/%4~<~c>t 7|cX]s>?jgA+Y5>+;9vVivybt|]a#5߇f aa۹r=9ryh5_=Ntvk{.>_uD~ǃoIk)гOOeo*DśM=y]zd>w"55֟*\_&oyBtS)4k>䵶AfY2;H>wBIdr!I=$:Kl[10º1hAs0sg+h.|rQ#47ccBיJzE+/ ,"kaTؒϠ kmĈL#T nk"1F+QKf5si:eR T]V@Ly@6ѐSEN"6n69ObkHOŚ#mqg`ʪdFMQ07at=ߴĦ shݶy\zqBlT9Kr|1e4kqQYemm$aNm?O5ֵ{{߷c$ւС7A?>MlBllt,tͪgރjU'\6N9*֑Zr<+?"=wmtdVQ?=ukNM -?i~ rw/:$@}U8u j*5sEAjjcTzmtDb?qV1f`JQ}㼄mu ROQs:#I>KS }+_Dg[?h>Rb-J3fÇ3ĺ`-1Z)tɦQ=tMő T&ՎQY6z sqϊjb vQyz8Pw9abonIQx]`t=X;=]J)cr-İ3MF@ yyo/=XC'g-v|L[o4-hZ{dh ~Swyʹ1̊ƤCKi<%0]i'D;|q \謣Wk⍡_A5UH\>{X&P 7i ^;4Q$9[ PI?ޛ4A݋"Ͱ'k)C֘U[@S{cBj_jy ch߫gtMIXC=H䌚[Eb4r$|7]EMXT#O[y|8{"KMt,8}b/ƏAAk pۆΦ B zyG!l/Ljρ{T"h5CJ94 wijH.]%ڍǦOܴ{T+ڎ=Z#U(U;t;.e[?[o8$CXqpz;eho2Oi$Wv³XЭBM81w3$ߪz8齲ͧfm7I/>oVqH,+ĵ|k=ʻM&rmqWsۮE/g}L1>BS{ՇȫI _k:Zhi|TM|)IRsY 4IVJ[MF\I|TGj&ZoA_Zb< ]\wI*-mCc\3MIH,Mg!_AҖw9ck2 B <ꦧ{с1J|4TO ZftnFSmOpyŚ C1ǥM{O:WЊ:;c rJyl@sga --ϗ7 IĠ -a`>L:H)D +PpExT1~FŮ2RGÑ7gUfJmYě@>(Pl{J Sɀ~ԭ2VE1 -M2Z-f~`&@ƀO5e#KB2Mg{>䧊 !9ARe.v hEG+%[ۙvRtc1:1uͣeNH>,ThNr-AݕDG&|KJ ?5-4I4 IRI|t+G1'R秭DHʷTls5y 7T!" ݄"SAVqÅƙH)I3S(=-)6#f$?b6o`mIQB if*s;NU}뙲n:jJ -Z ibz{)A.K0UJ*mCpJ)@  Cvӝ4cMx)dD.mAQFJURˀFWGI&J,Q&ބ%ÇkJ -J -1\L%ijRE(Wzf9-0 (<7@fVx)tf uԍ2kVL4:C>ć<T#P=@#R -$S!*\J_hI\Pɭ,9_5;۝@1e:HIVY).Â0 #wDm#/.ԟ+HvL tP*II+g7 'R2t@+45kmABט< c"'Q"dlR`NJ}SKl5QTe8ur\j9\ >`*F&$^1CS4uǧ2 |K9:@"BjD;JaڢQxr%` -z)BrZGƂ:N%1(P%b"3Ȝ7RrzU|?Zň>+A( !ڈ9[YJoZu)& )}-jtvU4 #16fuM2Qk N4լ^k4PRcϳfY U]7H -GC9:\K tɓ񱤪d('AZmCJKoH)o t9 ],r]A "uO֭;0IK) _dM} '.H%c%fE9lFQ:]]%%ǠvU F.^Z9@Rd?D,ynӕ\Ӗ Uog_3 +-1ڽ@4H.ZFˌv:WtѠ!MC rw\%URk~/|W^ON3` Sfrv`|U MHlћg +ć(cJofCWzSLa,D 1 A!fBwhJ,!߹K,֤ڃ4h:;|Vz16XbK.$dJ@% /f[I)ʨ:݈]Xmɱ>xҎAA'ۗ26>}K6w޼mk,AVu -ߤ:8HQe -dF;<@n!Ǭ郮Tm5YA2P 6l<u%ĖB2(w=d7 焹TM۶tbs Ng(%p#pt+CljXPuiO>k0r[i;kmiL<sEH >1]zԧ_ bDo% A8jQou1ą -RX9J/rc/Z&fA>:zbI֔yQ=]L3!)iݱ )-,<\*_+*Tӱ&A Ǧ'g+^ݣyBy2id\H"QmdX*1d G4_ qM-A<]dS2ް%h'5:fqM EV<(WJu\K |%WbIX ̀?:]h2!%2^4#gVۡ#7 -"6V%6D}%}dI5PRqmJH)\я粞1 .f.*XQ҆SSy,.1]PT[YJOA͋pmK݂-Y*a_X!O9H2RXВVxcXm!сZuj2D(G3H~L^<8Np -hb!P 6*H CU@M0(.&W@CO4FNJ<GAʎ&u=+ޠB+9g8=swLd|o:;w'eN!ȫAyCnEj5$n}"O% -#oEK8gI|I|9eN0vq!CP -fbs,i.Bb)Q$2aC[``N?)n@Dso09;#[q433JQ "?Aj8Ԍ"w<UUO}hPԲ\p2h9~*;P@bCjX2"yj3֕,U#%!/wQhR6 -?tƙ,d [hOBlUJYߏIG~(ƚrQIlD)kq1Y݂`"uy//kBBfDI0QƨPOằI&7RZ,ӥQ5 `I[JyZqPCZ/ ~`n%bz[\ -&%)AmsMWfKiuv\Dp@ 7i=\Ѐ5RKo>IyLKڜ*{3PKs -&99H N2Hn -P֦A HA*3R_KbIhn'>=VtjL)e(\q7AJ.I_S3kOlv -8|J %Wr<9AZh^H)$%hq\sP#QiRL@6P$B*l"2W>qa '(MZma֛ ]/@*R2u)V.'f)҆s- 2`~loN -s*pWgEAI'P$vu'HIU2[@$Ǻ^.st9>$5ZN|k &ApC\-K1rʺM֔ӵ:PK;hYj{"9aO0k*tH)yEul:F"^Eeq.a㚨@YJE!ck2۹N+a}N?XJQ]۠>p8y CK -vsN؎|~&ٞR3}sVC|d.ƈm. "-`r=kJL(xS&ꞋrLb+<43[ 1">b5rBIk ^ --cҖp1BnG..ܰ6ES ~Ӯ'~ #z4_jhc ÁӉ.N%iCnJ!׽ -:*t_W.+uD%u:X ޸E7җaͶxOMb x] ^䕵l"Q{ky2}rױ%qQNɰ%PzOki̽33Os\t`Jg/gC4'g -|S8)\MloEO6c%q 1^]B'v.^DAoւ""(:s s%R*@TL>׷1g|'q}uzP7tث:qЙ˯yub쐴Xb6릘"[.얶E"[+Fg җ+鵆Mک-yS8!1'%出bmM|0G\w$T ' ~Nqg1t>_np_" y`CD*VP.:)9q)ա#Ѡvm!S TȸfeI 0&}lOڏ#d95A:c\G ܟjnėS5Yqw8IkCjUQls*tW`WAY1sXNT!B/(BK3s\(=<&`;atl2a7ׁ ,na8%XEg\IZ<*Vn}]9\5tEx#ȏJa'A\:~m4t%L-G@naH&~7?\8. `kxqj7NwxMt n*S  :b?P`0lnd 0؏h=3*5N^CǸYx>^=d]3Z{τf?84F \5g9[ -?`ep]{ϹrQ[*z8e7^!Eĭ)眀cҟjA &K 衎J]cXBs"y:-X2V -]j%xQCcC1xrf`xc Y ( Zp97P%7h UimαAN)'O9? _Q )j1Quw)AIP8 -A8#/p .KȊ=b9̨Dr*USشp. 16 A(mܕOSue.6sXNG/=7G.yCf -O źדs0|y4u ץD.~V0`@z;sWN-AW)p ܚ8 s W5!585ndM>?/8-)}w]ʭ3J*ߥBwRo7qKnȔOK W١@NVPT@ -:*\sf -\<*3!=Cy09> ܏<9"(jiR.]T -WLP셸>ⅠXǩo@,x9(voN\-j{}xOm5lPiC'pap (">ͩAPHODke5#Hq(N5jpjCjU8ĥ1yR|\û~(̈́d0bwV8U -:ҭC& B\Zt{&z.֡Jk煮> _Jy\]e ?;A Mb~u̍IVO,KoclSAwdX|19MuRUDښF;je4 !% AyHO< 5_FF2K%t`6 m\{:Z{ؚHUeڵ95fAXqqSK.ޘ5O$Ԟ`) +Z(GX"+~3.PsᒼlWAӰ2xEOj[bf, 4gk#K|Q\&4G l^ݗ!vՃ@'SUC/5S'J~M"Qr5UdKOz_-4@RCA-;P Cj.R#@Hs6+%178\r$RTA iąCɠNZͩAXzOxWJyIrj.CjЧJu_z xENy T0~Tej9~ߤ -9PE;2POENu1SC]ù:bkG5)M`p9!PՁ\*pt?I|4}i!~F*7g=m]k_'s>f>tQZ``yeͩ;Gc@ 󻿎 -{ |5}`uO]NG+Kb*5ı*Q)e4WE:UP:LnAE3UPwCB%P#ʁ̵`n{\/ p3:Y񼽂SotIM @- e2Cpș/%Nja'BtDaqjρC<9aM^UbdPEC5ScB-W:P yWF@ -{*HrPncugu(FC5\r!Ᲊ o:ϗx^ 47fTʧveFx1.U b&}a]|T+0y^EI,vJc":z"jUywe2j"ϜRSVN5_st >㑹 M@=͉G&=%p\MԁC"ID}"+P\v#} @6 -~QSS.Eυ'#V߇9N^ն̓-p"Τ]@]8Cȷh+M<7q'9vzC$>ٛĞY`n!g zN5☐x!B9u1)\.bXa\>fX~O6rJO#1cXHP!~>ퟻ -+{0` js99ȗ] NPlz!r 5H^/SA5ضº:Qc%/ofP< e)aI<1AJff]\50]p]*\\{\W2(( QA7s9x^I˸ 1c~/GθM3}nxT95|%N/(k#e2iax3 ;8L -`S;ɍE?6嗿 USb@vk1 {uޔȘg)<*[!-v5L \ o7廨9U?=wޒعLVJs5t-Րu,*m8Iѹx#9O/pJQ< }y,wVb]B!T@jdar#9(2w^YPfI\ -B΢3[۟}ԅY? ȷߍO~YH|LPgw $/H֝kLmWB6#(:[RzU`+vgbZD$O&6RM ^K$O^Ԟ2~Xm&KKԥuZt|l{vü~/ұ*f#:Rۦ!|Sbl nSS!w)5'?wy~#&aZDuGD9m$6A&w0w6sH< 軟#&v -bf4INJ:]C_HRŗ -9FXƨN QrkE6 djH -\A&4cmRQH/<@Ӧv{x~ہn|Iʼ9*<(ǘFe''-a'b̂Y _(&aMDKk&o?\6y4RFj֧zޘܭ 8I*2  o0mj. IȅX^?6e$VRz%6Ӻ nPbn>\A)q -o}_MԮ#NM%t ҿ -wT6,` ~{BUI&Q ՂL}wy|ndGSQkY|-'ZZW銟z(J8E*{Pcb]v\ ӧE$eDWuaL.N,(s #wBbƢl e)BVˀoR MA _d"Ω=.i8%]xUH藉 -Ήr/{e>F݌k;N~>LKŽg_&}7*"?e]gm7ʲkTfJ&ɟ~uP̓v$ɔy魺Dj('{ZqַE уeD=h$ME/LɻtO̽6jOH2OF~;|>˔u\/ҕ:D> -}Bѣfto$lr3/ 6ٳ֜lrﰢ&3>kS؇Z^9MΖc\ -UuWeuHW̟\FjоO -$B(A^%A]AmYZ a긬Ҹ`qInuI&8݈*)(瘤~m $R #k 1$Q_%%%ޢ=_E@3͉nޑeÏv %~s58¤8X-moj;y~7hμ<,LHP45/=k9.zsz/\RQqM\[ kiUtcf̩1G;G{.vTKk,}&Lq9}Сޜm6'F^\z1.Dkz@="$\&O]HTn 0):`w ^-4D5ig֖lZyeءa&kaSǬb!:ƈvwI:ކj{1)X˓"wkfR|Hӻ&uM-b3L{ɶp£]C=J<` ~b< \g$Z]0&KB؇$;mu{++X۽piPPa?41]i˩Z&/j.Jw#R8@UNZ<;^Eme[(jiptW^3U\0m`.ZR#ʝ£+#jnF;\l1z.Z #%uIȅ}?>]'j~~@Sd W+ޭG-RnƩuBi\] D)yzʸIZZa'zc*Lu0h[\x1HHkK~|}U[x4rcLkwKwL\c[wUvѴCca NaU5w+xCn{z{xU ZvIB_ J_6i8+-"ypyL1wğ=%Ʃ挨)qgoŞj'M*yq{P?%vm3LKC9tK54]~c&C:㣞qLI;cm"?98RSbucp[gMoO[PjCZZ +UV%5~~Jˀk٥A!>gÍj<ͺuW3iMWg}upika(q7ALv᭯^Rc\{&憙I -j -uu9ے'/c:udF97yG{FD:߭ +&7eׂs#^مfGoj7ɪNIJj- k7uQ\P[UCu8cFQl|ܣ" -’ -]BmB{90hc?> ;û'ldά0JT^vѹ? 7Awm\ *lHh ;ҝNh3) -㳽Is_۪ʛQ%!.!*CDž;ޜ,)5~,i~l6zrw]ѫ_5oJK8Ӝ}cf!z^>$z~{߫|t5{lΞ0j(±>q]u[V 6 ,clc5m2*]LvڞYju/W~'kJtYn+giA{'{^r%~oa%z!M+ $EV&U[Vć߈I-sjHvWzvkq]|Cr}UPUeD|Ч,#~!/43 -YPs--:a+nĶ<м;;T[z戈z:hf5553(d t 󏘥1OUw8-FgxbS0{w JN5%w \+؏a;쎵gFT<,p~SlU#_Nvؾ@/>cURi7t -s ^`/`^tyupVuo[GGC`Au_*64?`rQn@vA[wCJ;Jhֽh -ڨCʄ0kϧmFA~m+ Jzs#;|Ј\|`<;iLwUmˌ(ʿ=:[DRSh a?a)7 ! o/-Z?hd~6gyƫF hb5 Ľ]AgqS{׫#޻$.pv1$55Y]b"l_˷/ L(s - plnvfK'\M+iZ\]v5S9u1+e d4F4%?!?_G=H}^Q̷wїzwώWZ6cz?>L5k|éFỒFs3_p|C &< h԰)D4Rn"i5e-Z:V5? kmaI_׉.!yC?8`ShRaߵ7E!'BDx15z5FV}l=u ݼ-{x 4;~ƍ_= ܍oދkD*3ﲫ أLGǬUбЫ5ob,$aDPǬ.oy[,!.&H=s1cO -~Ŭ.s4ܟO;g6s2xZqsjˬ/F}%EC\?؇9q -{=ر?ܷ=̧Fhj]wKbK]BKoY%uUͭ6WB&qkp w皓㞿`Lcӑs47Iĩ[ѢBJ -"75?pFk9a9"9F9ŗǾwww - -˩'JC]tJY5+61d {9{ca hҰxa4hڈehh4eZ4kZv}7B5ar0ɧR/MƄ25Sm/ nntsNPaďwH,AV اU1)^fM܂L߅fOہflG3nC'lDGm@SǭGSf2ؕy}SU)v ƾ995cB2JJR]YIo_v8Ka"2\4 "x~?b[MMM͚w-Z= &J=E+k&~g#r#" K">G8D<vzhkZzz,Mc9>Gsvd̟O0b1ih̭h}h2u4!Df/5D -sьEh -Gm[&g7H> |ᖂ!16 /r 83 ǃ<_0+. -)( c yWnɖ]طNvr4gs=8C# Yhؕh h}h:)Z4Z_'b4w1f-'Ь<4CA͙ŽNPj^?[3Kd;p1l9@K525PWB ԭJ~h,ӽusv=**P͘Wqu\rsB3G\j<zs]l /a-{ Ǿl"K/+r6r3Y㖠iaۈɫ/ALzshIt=Zjxu嶻Վw]`|JLu[]+:㱕( Xe::&&9gub a/[2t)ͯa®[l -vj'ot/ ʻmg[ kRw->bI-,ok>ُx,}_Ex*hB5l+Y~ڎm&gx͛͝WPAZZ цrFoo`O9͚],Oڸ퉛@\פ|B?^:F1qiou2`OiTnNSאoáCc9zi椵h.6hv3l-^ru͛cJZB6rh7ZOEG_o);GUV7dy HSuia:jLHx{#"͈MM{Bjʬ*,\BXr޹ql#L|dُq} rQM">qH-Q{f.T~ɮ<]'owN5eCWQ>E5]uU5̞7̞}-t3{{1*prπ;`TZr-&d>.df_< lgmӗd0j.7e=ZF32n=+kczMH0^Rƕ}e@82DӐiY_PT}QQ¤20?aʼb*ʞU䵜z'BHE%?]{6u"7|h Z$Za]ZKhchVXV@kDHQ; -Ob*VM5eM?|.B姵n hV'kv~)k+a)~k*l840 3z*EXYqŹ/ϥ'L-vpbEc]k3A$ɨ'4.Ō[j7x(lG 0νz;bG]^{;ޯ!adKݢͪ -(p -v q^{oOحZe5w\|a~U10>!ePGpF*&u<)"%Tﺢc2&|o:MA{͆h%kS,&DKVX=>m헃?Sg >u-e 2+f Y3kmɞ䕱kV0mK|^BVA'ւƞC=K]Ez:K619J#qi}y);xN{lhӦ7^2o^)KoM$yhhEGoCV h{÷(U~iajV:0V᱂[Vn*>Nl0ϗhtZ謇mխ);T4MF{čϵ%X4E%? 8*XN?eUxoY͆/>ElG}FiW§  !;)I󩨆wWd5W񃻅gn3w>dh쭜\#dyfmA+ 09ٵj>_Ykmo9Ac[\ھ+IӒFgii== !bg"];-ԿJ>aԇ 0!Ze/cvZ%W3&"MaQ kn+QYwFx1lemd7E + +uRcod_H]j~nse>؂P+zVoBd/} ό%Խ -|mF~N?bi@6!HhM#24V Y Ç;]I6U#ݥJ4Y}zVOk5*b^BQHFhk۷#"]I=4AGE/{A$%%ݓq@Km=3NiD\^-EM9b[()?yS"`o*xy!ieA>| ;);KS^V|b-" SϦռ5Ibx6'*+Y3ZH]EITFwF³cmC2IEx~@L:! pN6[$:'(B ar292͉T'k5?&4&'}YvD(fdRu=t:|?^Mض{Zt 뻞Q~%TAϛ}voR=3ZUDʀ*C$Hh#E'3W6 Y|>YNӖ] NӕXrz /N_🨪lf`޴aR۵><0BzB9wc$+NM[ElÙa&ZO]a&y"#ޭZ$oVת8$EJ|VHn瓖~Kw ߈Q7u?e|'𼿘rwZ q0/?f(Fp6{rDXۃpTpj.a:<)S]tT -͆~F\?&Rx_vQQFU"Y ΋ئP~ȫ>SHT;nodԫ.)ׄm?Bd j/;'NgL[dm鋺eťTN0RMVa)Z3a!:iшjH#sÉWG -dWGܧc#.zNڏ㛚ˁ2VrTN3pѩ+cWVA4""SIu.MkH]"SԤ?pa|n "+ -2h3zHAJ^Q{L2z"n7[NσԍEDX6^UsK0ZϺ(w'rP!?0<7I}HsQ< SZX@9'o=[n +vc.)`<: >YkزT|~N.}#LVm2u 0i0:~F -. 5ԫ~ yp/?:~p$1´U"ep?$,'-Oex燲JTMSeFnb}{ftgha߆t (CZ:쌼"p*g"I39mqXӏ {$4 Ug7qa噾d W!K-a#@O,ѝZ8N*jPzxD'u"& ##w39&=S?l^MfлtaBv]; ٌ0fxpDk#wnڎ6,Xvoۏ4 ЈWJc?h~| (aΆE䑼Αb? Vc cvwuOuU/O_ʝɳᛠM\_AϬUDd["RAJ>"ǀ6$7.~|yyuTob98>tD>u=&#$:mY+Z%X_yI9)kw$ro0a'w:a\N8[4(A*˩8#zWw1o>]gmU¨Sʌ `Cd;!Nl,kc[vDdr aJ 3 -Б򵥗2{{?[kQ9-#uk{~O/_վU{>vvӺC߷ߋc5ud&F}m[O1?6@1:'cTKެ -Yp#럾4{SC <;3}/]>11F`ŎO~dhRL{\_ZKro+N ?ld^9'cy1Foъ4 oΔ{qm|_Kҳk{/{?k}}M)`lwS<7 ` -WZgqs}\8svf·KM_`|15m~%ORm(n|{OܽlpcLy̫P-/:"}ø0Plxo^k56?[ca΂` -ʻ7\:`_WW>~~x#+8߿%\D֝{Ced0ż!45>Էc"o{Пn8u.\E2xs3aВga TyX5_܇6ƌƵ!+Cy0S9=A`'^9cfa?YsFx3_g6vݽl0Ph W"b תS76#O1ߛZzRէ{2۷x 3o]QwGߺdBg/8(صt́ ݛ*}K&̞J\\0k 9cɄ(~ WQ,~5͇&Eq=JƵ'~RNyvd;?e"|s(u>]w~a럆\>chz&A;o75mwm8땊9``L'w?77,̞8fkE$=ն' 1V-w-9v~`8]aL%|ӂ޼ -cNВKC]/իP΢][u"siO|0?5xgx]'>q%̶p*FkjwuJ[U4-k>aخ5. :d4I0&7Ɵ?К t,{xb׮EqO|(6y/mߺb<7W-?;Y='[섺 -;1\cNJfi@Hy@2}i3Hq1)_%ƄE* -Yv(si1.>fe:{ūzmWa\.YJO8u]?S#^j Wz{e9?UB~qK݀&bN=W/,9x\}3çPEpw=hx{Ib9ayj+k -JYq9kN,qnW.vƉXGxscn}`> -D0>WGA?Xě2ѴW(_Q39ǂ sc\@ cm{OΞTqm`1qœ 1X/p<gN|pck"~w*u=;ヅ-+Iz%7b;.wh~0a`jO2;س̦)g>rz;:ۃG:d?TS,/_Jn<-xi~0W:31#ca53\KDyn:$3xyWtYSbQ_A oy_ ?v^ir Evӂ~;# Gs}`?LuߡQ7ǵy033\{^~Icd/pߪCO~ y{1Ů;ڦ}6/u1Zp -=Xo_ք͘ h)sꖦC߄qBqM/yW|ys  _qܳ֞ 8q)lձß44ݿT1gkx[U.(զoMȑ?79I~UD[_12w?pںw yËapE}#9cCnQc̭ ,5އΉvo9;rׅ=m?b+&BF{;sY@/{O w~F1w; @a n)o󪽗5/M`Sboqr>Lc,9շW̯ h~4_}y?NѦ[0 #gn/^;#c7?x5z|k[.v/{ڗ^uYDz#o]8Dc^>س\9߹ߦpb y@.wMvO$ȹ}5|=GP#bϢO~Olٜǘ?{C"ܻbM?c}MMЖ}.iG_z|05tⱘsB0?ƿ_'sf^1{&0w35w;3؞rfݽ̕ Twڳ"@bUMdvg/tϷ7=sg-4_1lS8uBShxݜ^fsrb.\zRbڮ=b*?xK7y1̂}+۸{㙔nYwv>sD "Qݖ=) t<—(w;!̝]}O]1cWsgRNo=xތ@m|ղpkZys)?1Zn<˟Dτ1)?)79Zқ|u-+_{Ο*aŽȵ*§#^Vp%L]O$Xܔh(,|8ߨ˜F{;9U[^N9>,^s掊WzЋᥘ;kAEC=3Yz2}7r(ֹ4=w;+OYpˢ(,X51gN]+v_D9Wly,>~)o^ 5t?>ókcV#}@6kZ~t{Ot3|; /x}/L{$MN599(1o|q;5a_*W -깑/Bm 91Ztr"aYb_ؚ/m^]׆s b%E=[myc㚂f+pebg6|i96'N&zO/?y4ԫw^[?C姢|S?1ŧr.1\{=9Uч^rm}yOf b, B,jIq 0\sZ,tX^-wKoMH@f4rg&rp-ȝ6yHϑ['b2̝6rgrg-{ԉ(_,y%'m{p^<'S-߲>[G;>aߕsrO?muѕǸϘr>56+r1,xTd'w}_>5Z̉+z yG*#|ъp8q={/V93Bʢ.Io!^1.XQ7"`W`t))ʝMMƵI} -fos|;k>J[c`"Ƒ?Q9>ߛ{:/d-L_9#m'] ?1wCWcD̡Fk왏o?M5l `_D=9Pܔ=W\r$lcAf/i^;v^ز-'7uӂ?F_cCc'L(w -i;k.̝u\/Xݔ)wV3OYYYi#w֒-!-c΋<{)`.楛`~s+P};"PλNa^*(sj^9~2ڹtO=s~GW>}aC/ܦ}_L;;N@C[SD+`'=-X8>r϶7l00﴿ {0[a -=wVS9MoK0ɘ˗J'[&ҷr?TGrgaTߩ>3w2=wV (w֫ 즳}Mqw̷{+ 7uKv&{|Pu=WEmG68Joji_|ĹBw4.jMg}ۼ 0 #o\;<{=y~8L dR(ǚWd$5ʳk`jK_|]/.y?q[R;-wm(ت7P E=u{~C=r`%?~'  X``7C=$LTq_sc^TM-d5g~u+g܆u͍M$ )}Gz6{8&T?0wVK6=խ;+ȫSGxËWWcYiS(w ->7^̝u;+wЮ((#hd~] |s>|{Bd;i \O|O ?Bymq%>~L:73?),c>;b[6/`{ï^kW> ^Dkp(Xdkl ݿ9POoW,91_vL̃[wZ-(=G]  `7m+0c>\ )_oPfC#;@n>Ah~OpO]p9+Ïui]͏&ubSc(G͚._ Ϡ[dݷwXǛ|Ծ&CvҢ\`<v{/M9+ڧ;?;u/||GЯk>#/s)%$u w>%kfi叝[p ԔC̻Ao -%75n5./?c+q]ɓ}q}U -('')b)GŵPGjB|Fжo]k(CU>(ztR~ŜT\ypmϒEH=+ykH޹.Iy>߄[<:|MCߪB&ǵnev9Hrũ ѥ;~=W4E>锳(Lh/o -?˛cx-4ǜκ)_< 1VP3wq:֟N2WC>To9EО'ޝ\C=HugRN,Ѩ#aߚ76D7Abޚ{\uZXBȿ}"Qet\<sQ ̵VBy1gs9rųi됽*-@"7d:CK`^%Y8EuO|')ג 5W'7^]>MM{~1G{:@v リq=}W>q# {~FSd}{N@[V΁9B+97#Fjb=~1=6ÛÏ/>}ޓw/Y9dlkzXbc [ B W/.{|Iy{K>G ~#AM$9^<s:S>aW\rvP݊-Nu8 啫&bBE:U=\ft Wyw휈~/r'ʱ=7#>ǹ_6ر$<$r` -G=t&wq?~܏q?~܏q?~܏q?~܏q?~qL4mF< V9zl"S9rRLvF5Lw3}iXW333.ޗȴ0-bt9,)Q x3Yk?{3ɎdZ㩄tWY%K2eEQȊx9c=X^^D[q -,ЋF(YT쪼RL ++,jg]&Z槻2ɮlJ+I\*w/=+BN5/^ {:S]St+\؛M "a2'Z%SmDyZl_7 da&MLw%[vu>$՞]Hv,x'= }1aZl.r CT=:ս(:+O >3⠤ޕh֤{ڠo5eN!jf{WN9DJ>p&DWk)*agr -O&ӛrG/̶-zd*ᜭq9uvַfK^e¶0ޓI s9ɫ {@6IhrNe0Fx|Lkbv&޽(Xr=0'Rs69 eWhDsyB=%[өtfEkvӗrr?=t'Z{!ck0zz3քtr*Πc`t{SeD+8P dm'VrT\S$-wazERV4[̰ }\Tt+[W̒YL[ӎ QaH@vJm -O[d!L+?P4/uXWY< |t żs@9m-.md; ($:Y.Bǎ.~mh;J9/H &O%*V{Cr:GĎAǣt:UI$;)Y*1%p|bW^g3ds*5y(nPI 2}R.OmTܹB9ZҙET1,e r7IJ6:Vc,t<sΐK9ז˄ =/jcjt62:GcR.\1@="E>%VxvQ+%Rb -+87 -daQG3=ݩxk3ѕ.?oT\RRǤ\,1\9N!+(:\ҙyG)-g]3 cR.L) R*(?d*UWj4 ۶I/hOA!iAf~>!yFaѳ1%[[{;{﵃g2˝y&% CP%%E YtD{&ãpt+w|5jv~Vt7i6rzОLQږ(Y&dg8Q)wLYG·\*u)>VfZnjL 6Svn3cߌSqC||98VGquqgFX3g-Ǚ"RcqugʈǙ"]3 q8;ΔQCy4eOHw07Gā2,H ,)|L%Hnx I_gxoeffU\V-r7\n.wsXnm\6s oНDEL"<N"wND!k)h)z}rRGt\u:[r⃙DgzpnLhŤqHn@7iX4Fň4=)deb0\ɮD{kvغ"s;c<=~͓E)Uja1KL+YˁwclqBtA&GM!H7j ,?0TNamJTAvmࣥ{tr pv@9m-.md; hdEs.JgcH=8~ÿ\\R\gr\w>`ܽ7f9JJyTl9u%8w n83w: QޑI$=';ӗ$өDvz&6=w .ЍtD"+Vb1Lq X|y7;HH;7՟I22Peߙ[k7MOwt<d/mc{m9t:\ VkpGX(^i,.渋9b.渋9b3 ҍКSڶljpWܕcOwij9 -{ 51&/نxrc <[3a9Ra9Ra9qr"t$MH1jHv+BKau#["Eh8-ܨVCa,E-)Ҫ|ؓ{ؿ,L0D!h+9˄rmaw[VҀ8NL'ZCncX(׈+q#INtQ&_ô4V/Cdn2]Ŋ ѹ8c18Wj+史$wdw&2V?.v?JGY-aKeݞfZe14p.ێ?ߧr1Ҿl2:zƧ"cn]JzǚZI$Mt:7jT{B7\pEn"j[3Ñ3Sc5u)vG70őդ)eX[v#p:]==Њl,2ew<}%V|bi9cze*m嵁P\ءV˙[.wmc`Z̬=vS4ma*޺xG+Jw[پiE,:dRG⢆o\n,R=Ov,M⸄&p,2[.Wlgyc0*rhʅ9g_i(8Kq\7[0{qm2ڈӭ7oMZŨ9JHiTl9uiqhnD֒6Jন5[[]Ԍ/Ovj>?j֌$1bSq~cIYBrQ\m ǒ ˺]"Š3}-Z/Xvړ<ʓ<'|T._iD#Mmcs/6ēk)yX5[<_ |$qN[Gxy; -3DN\Zƕ#=duKP瀔uNZc|ݤ_gͨ|bF@Y)?k`ve;ДpߋggC՞ʏF+)t9-Jg98Ơ5!EJ~FT?OVhUu7G)|p@>=tWC`rLrb `0w5pW -'2xT>Bc\k.(n,jm,?2+{׃f6~][(;=2v.JWGܕwdHCxթk#q@ЏPRXM2-3TVX$bItW4A~DGCnjC~u.L*'Wyfŗ3D*O5 -ŋDeU_x%UfUUIaQ0^VPN4?/+1",/sB$3pȩbEE8YUax>stream -V*/ jesk%<|FS8 *ST:"|+,[(ysmYd G *("GxQFP*plT "QQvT/Щd/xhWUzyYe@$)X`8hAUv5QU VGyF ɪ <(ZAH/FE\2IQ=6XC§20ˬv,"^K=`Y4Te -r}LD AUâ({8ŋ HJI0cLA=0^ࠂY00< |Fl a@3#lWjUVcpLyHS,S +#!y6h6ҬkylױD`?RcBW3:?o#cGb[JwHL-3m{,rhr֪_iSiT(IWf0/%ԾI٪hh:zΛF+Px'}`q7p -*[*|R֮?uS4T7j\$&UQg?V^RJȥcWAɲe}ψgTۀ -8NKcAaYQsOPQ%gdQYʉ`C ZVrTBsY+\%i -l|4И,"Q8II#)0u3` 땭[eO<8@# 25@24KU~(_T]`d*N=DOw$T$b.oX?y1gY8F /l6PY$T*^.8X]`wif0'Kk> 9S5g8~Vxձ5j$o|KAGr(è6NQ lvDp`5zt2Dp'uQ1W8c(NG&78M -d+"~grN6{_fxᑜ DG#IKE\͠i 4Ӧ=  A5` Grh@[Ž%Eb(nkj/)mp($,Jݐ/r ӾF_Rϡ ;آ\ʝf0B? -TNhHRA$ KFN9#1GK 1 A` ͪ=V %"' -ʉ~+R5iAu` xUc6E9 /itgEмY:&!v%a\h=:ecу58cTwSgk73vkk߮7q g.eir9s=Hr)Ll<GZQ*E.T9j aP*pyݰ9` @^=2ң:Z[Y Θ"Y Dt0QgAIY\H [Bkre:I$'J᮫j6dzae,Zm[%ՖQfuhEfSTOF£f3pFj>O_ -4:]SS٘Κgt1њδShK+/ 9u6Ԟt(h -s/ۗJX.1Ԇ+'d -%(&h3"(.FBYd#M +Ґk ÅNa&*&=IA a=NCAnը +ӢR);FѨd S>n"h L?]]eU! g^۶p%y'' ZGo 'GGGUPTNy6#asQކӆX5ur2 +p} -j֮Żd~rڂ`|YY,e<6X*b|n]6a"SH|n/Җp0J -|J4ɠLbş>(,@V8œ>IqqrV0uWoXV3ɚ)|1%_/F5A);G]%)<#s:.ʂHF_9Vc)l^ZĠ3%e :W ƚAKSn`MߠyG -"k~ -!YTM~ ؽey[B]NF>t* -dQgVȪN8F_`TL鴃QB`6U0IaQm@ @g  BqW90XYU -d!yeDIbUëEQyVw<܀QJ)JG($'I)S ы> -9^b8zX -{HiERYaM )`2+Q4+p( Ј b`xJ~#dbFYW)xRADgNezGT; - -Ȳ6lXT`GYc\v$dY9_΋,+skFx[Xm* \$7%φn -0i'?=1͸!N r-31I%$)h'4 -& fz@] S-d 9i@ - !B@$9(UWIKaj^խm" "lĂzngcִ+IOg/I Tct!wt!?6RK%2 2lĄ;1j2@162Br6(\( b WlS8Dǟ_Nh5n`ꂅ?Lh" ^e,!@R.E-vL -A~HKtaPކ8+ ` -mV5{fknBC e&F֮^GYve -pN"LJ]&YILr1&:!EU@v:Ƭ"c"lx0L" JYܐe 6ً0D6=Yar0oLF͆m:Ƭ"c"l׀|mZ=PfBaV3۵(+&t+]SAyTt=T" zb)xƽM3lUKWҬv6 LIv,gz-Ⱥbg:ٮU@-POl(3L ^׎l(3t( EˬebfF ef2[Ѱ rPfa2!7ڵ(NfCQdf(;&FdÙ8pfhWf5]2m3J,Y%\F&Ƌm2gCŸ́hV` ,79ʚ}ZE5tdž0CK!Pje6lPfY8i /KaMLvsbZÏ];pƙ 3tCfEL(2+YBUd"^Dp /f—QYVm:bW,\%Pc@mh: uB1%Fei[x2KL4JM^Y82nmuîY82J xkʍ#]PdHFBMEhW!_qS ޤ^P>6 -!PT2 ButlSPd(hz[m3M#fZM^Q>>Zn3ڶS aӌEy}`,Ҟ:=m`}c" U  P?k{G{= ǺT-M7:jPU(Od7&r_Q^e=\;KKW1(x -ڏU -QP_l Ѣ:hɱyEIQU{l=,k9sBy5cTC肥 uxPSoxV3I-GQlrekh&s"6x4걾LBo]ZX5ө^[wt?T%3 OPm)pTl_PB3[t)?qfc,ҥìoi-fHo -%MO[p\Ne=o~ڸ_x o]WQC:ɀ[UqҩhxA~O -:J9<ͪ±b G(@WtݚFx`C"m)!wt .9DpN*ucv/ɛTXd1\qUgvKG1䴡7][iE;*UjSBk=lyx 0:Xđ~Wzئbk+f'C5i:jsn -!; :vёcf ]ʦpEcpxyE1XJ`kHK,`l6֔ m,L/ y%7h5 `4qQUY;t Fn Zti#W 3۠~k\m9vP^R:$)lqBx ac%Dў!: ;tfE_gWsl-vV18mcPe+;pSr8U) iɧi#xFvbSZ)!J/ oasheNtNx;{I,IkCMDzygoj~ PL^@Q`К!U〽tF*mM"85e9 -5F0Kp:H nh[TKl -[hyjr+zK&T"9Xku sԣnHK,z~G"IcXkD -p~0P,F.w P<y*#ʫ@~NdQg\Mx樋z5o~t hVKp :k)aΐgv^BjWRT(H;>8a"dZP9(A6H ߣc^S ,Уj3Jl%#!E,nIA`1i+h[J=O26p׊PcIW)2LplizjfW`]/1V;+tu55v ֻ݄)dJގ=QQxb7&xf ,jZ ‘3^l sȵeEem5/iqjZ2MqѫG,R+zk e"F%#//fN+hF'|AK:RI*8O{/Ƌ&K${KzbAo4=ȘxE5-;zF'),63fat[ƽ%em"ĵhgFeh۸_mT;Xy8PDPd\Adh!XŸ hS|aM0|? \N`[;SU99Fâ -R<C} tQõt<4$Z)qjM{4B<{m\wu&gao*u (ΩS<^ 0@9Q+:pQ ɊK%L橞RyJP uɅ0Zj}Ԃhm!8B 0> Ys|ޛy/s+{q$`jӋTKs`ZHns ʀz X1NAѝ-aĚW #<y - ,IЏ @f$/0l_*S9unWzi݀\鉷ML!4$뒄tg7΂Y]Fhh3UP=In`a luq-{E46Q{LǀΆe5uF3Slkt33!Ym7uQZA`QqmY7HfJ2(t%ʼ%/ d|ħ I\oks "f2«ʋ -Z( 1"xtyQC2ӕӖPpa(I%چ XѳϪ? Sg.Kb[$pw!o59Dv - -sR^o,A:&4TzfRbؓ{=`ٜf${S>6ghu5ti1r3-x+w^UdŵAl"z4!1cQ9-hqE+ZJCϕLd=dW*r6JdzK*5jJeWO9;=5fַ w%Ƣ1pĉe8QD*O ʰ(9*)TMM s'-B=@ 5M~ؗ/}2QDӋ.'9IM7ᙟ(}Qf% adYNP9eeNVyV GHőN\#Y \#%-=v5Iq= RdNŤh<=QV$,N(k+N4a4DثFd>%  J~D` Y \ގ>Wd5d a Ʊ>Y8{[* -Cv?fD}S.,r?1f<0 -G%z#$5}D0<EQ$ # -%ZlQY8E'$*#NJ`1ishVz8RSL 1}(>`COtnTT'0c" -E?]<>EA0i?=f3_/L_e-&7ölD%JVTKm#g-%U]VL0}\faɋ-#Kql+ngnYaF$@uAʙ\JxJT–;C$k"{%Ioכƴ7\? ୿8GX@1Lqj밷p-QQN. :jހmb5vWb+t ς>JxH?7=xݶFk -_+l4ךoA#y/ QYq҇JA+"I"ZpI ɛRհx'9<{L! Ca[_Us?ՇYLJ[٣vrQc2vg*_S}_{'ZfVN wKd~ϛ1zT/[a9Y^0[1~SҞ#ٵ #\˜,\>#!hTʖzߧ}7 =y|3Z It† #~ɳwz!Vl{ -ꦡ ^|6")`{^Dz?gz ࡑ>%!A&02=a:Lb_hco*uO c'|ޮ&վv -'` L LƭXE~/sY0=~|S#$%j<(J2W`|&tT @ ~#4DW5=VK EpO\%Q%3* -pR(я^FJNQZA&S ) -臄y(a8 7ңA7 -? EҨ -(ˀʡyĀRpQ \AAC>| C"`UfZ!R<L( $?lBXԠ0Gl"*( DOmOtOO܋H>,@B-M2Y'^X1caq$v^</!&Jt,o"QPAx"*#!*w3r?Ƿ8 -kz7Ir`^/Y0XK݇c|~>?te ؒ3<);6 [..e$;E/zڋ@.""z:EB.ovuAs  Dxf;`l0v߁ |AXya\;@q -)L`B%ickM@ i -@y)!f@y,+N<#phbv((_v h(DdZ+1x@v:>B'^ E9G sCS?<`A`@zQI@gT$%U< 0*(mWj=SDiG?I޲ ' rN|K8 Q5_ZQ{}/1~^+#"c vf^=ZŅr9]4Lm9Za|=TU6 +p$0|kr~؂KW -p;Z1ma1ǧϞml1v0 =t̴EdڡL;(vVHb|4ԂcK;l5$o}%&HELh B73:l_IR,ɡI_G]=XL+9.ݍ?x7` e1E{\dq,7鈽Lu-^qL{)׃OhIc6WɨNmΎ IN &Բ<X+Zfv;ɀE!D_-?5 {VN<qڴ2?GX06և`D A=hq9ÐuPh!'^cxk&cx%َ۬Gnf.Q%,"D6qدo~53hW4=HzRL۹! -9Ivרg=B~X|xh _Ta߉mUP'۔ۗj:4qt}h Xe3z8R[N2 VSDꈎːZoط(#;fѰ]gQipI 1-'UĨ8ӳq =JH:K|ɦuj3}Aܸ#$\şWmk6'jp46} - -Q|'M^7}`zՑd~9B8]p$^]IibSt3pI sm@=Fe{;Gdo5Ƭx q]ke4W6+ӪT,7)oyfiGgerv5<0G}KF߀EN] F:mL`%i1A& -JȯR.9s?ܟXZX G&7an1ѯiUUZXHC~v$ߺ_OL~;[avBI~W]9) JHn͆m'L,np !#б(w^c۟{̠#n I zlm4zK^l]K΅ Ft)+jGI]-Zal8~_,6Y0ԉK6iV;d.RmwbTb V;%"6{PxNm:-zu<ƾ, -Ք.j;jJ9#O =4 *(%PSH"f=c&xl˻BJ ({۝:f2hhMI-oe[/{N8 ahhW{p,6xRwLGjv0Qk\E?޹VIt2(h qʶfׂ`q%jHKh cީ_JsxhR[mJqKv.xnt(\D4@ -=!p(H` @{tudH3NAJCO*vݩ'(Pӆ5 Twz1"dR3#Kje١ -?vR.cw˛-O)Zh /Lѳ5X9G(z?m["QB%Gm[9t~؍vs20oO'WPѥiI1Q쑭yҤ h+5DͶlw#4:m} rx<)z޿l_3B} IO |V͗A}௉g,zw$}56o9+6H_x@ogR]ӍҮs$~M|ƾ-C}Ijx.A[gS_ fMB |o$Z3f3Igw؜7KO #scȷ' ).x*T5D|_6w8MgP3.cz_h/̏w[@Al?si.uVBS'i~L-}"sK=QޛcqMtl͘϶\LCCG3KHk ˛4N,דC6-Ti4hf|Ȟoϔ0/XcЪJ4Uj6o[̕q6=|ݥ_OT…]C1a%Ig5]7"$>cwƞvP ;bc ׉A7'38 N{=vyJ%&^Rf-4`%:x:0ӥ^mJ/8ZYmz[g mB c-!kYsaﬓzD3H?({_g뚢Uо9DtūΚiuRإ?:G92_:Wiչ'Xu?y ;D|HQG; ]GzГ BbŪ+ҮKli]˘wl;7oBucЕ3~V]DtL(T'I:|ukGF'x}6}]Uoϛ;x+^77y2֭{T^+z&Yћ2}~S޹3~J/Q -E1s/o;Դg%^Xo:xJo5yK,C_q@gOҰyoj@ٛh3Suo :o =g eog|džxŐ~(V 554NC`5ރWm IciJ_7FêvN_ߙɝםO }|J]*Mbo] -ܭ]/dxWJӻp\F]1Me`~3'ȃ)fL17}+Ǝ~l.׌6~}|֌`i {^y>|4LˍׇMj)GJ|ejQco3i2VtpZfӮ4;Gg2odi57g{Vcc7/˅~gEu8lt --lRhi&[o`7e"IЖ}՝׬r9f\wzgCs1ն~u%,(Eg36`߶wn{FGӺgG](coն_ڭɻ -?ἾoOc#+[{O3ڿ*}oˇ!頲GĹ~udvٙ:1dԯs;!g™xn;KyosO '_+._ @qZUܹzkQ\-'v}w`hS|] =b s׺}bIDϓaNzY$&`)I& , -SdLU֢߳EEv*,Rۡm.k^'|ɢ=x|']%n^>eF#~ر϶wԹyw>}_˥RFߓj i-yOOxzDfؙ$ړ8eM+|<, Mv9Cro)׃͓JPXS~{> .]\4|V)6$6kMlNei00?e. Y93%nTrv6OK|矧X~i[L -f)VHX_AmP b9}/N[XR}ݕ/V , پl l;1愭$CgxxXFUW%U}\=Cpv}GȮՠxc|ik{ϗ -ˇb=2=5rzѭZ7M 4#ZRmNm2<%_KFi [nlUJkl|ɆNLO헀Qގcg:\[ϓyeб;~ -zKhZi:BeZ~%;k3؛5:н&{wnPQ~_7GU˸;۞>\OO OpLgu?ox{Ck~kت~}xطnƎ|KސvLb;\^#ojїh -Ǟ`\m?q3P¤0}L滵ny\55]̷ۙ=>^g2h_tmPjٗ_I!:y+w_"y ,:r?/cx\vlqeͫ|[ Dtb^OȆ"MYuw3nzmqqf2ųoWm'`'=dK5=F\! ~08({g^㑗#糖ze,oq8njTQZL,0Y{9qJF[HE\Bp?*(t|ڍ)C`WXq -H[Ogj'4+Glr-X(;þB߱1(wHQ -/G[7ٸ$~A1MWFuIqajzGQs(zLUg2-JWsjs|6OX{*+afJ況 vA]-qlv]rn{lT''r<5Rhlv̓3PaYcۧޓ#\wBc?h!޵_ sƘždgwz|}K4S,SaBMdLH6 asؓ`WVB Ow% Or.Q$1Dg2.DBYf BtЇzp6Ԕ3+{T`IFf(4L4 dÃzBkP/ZJ-Ip>*nfeh  \j%]d(y+申eE8PXyc< f5g3i?I;-,p\d@ύ-.UkhN`qMS3nJ򔑖VNBhSF -fZ'DLv8 ۙ"pFD;m|]$"ɹe3Fr'_'5IK}iDO-{7j=|Å$KkYLOx$rAH)I>C{z dbVϟN侚Z㉅w.h:ER8#92J{aIsNoO-k~e=2ooIDę:ɠ&}M%QS? OE|{#&@nx̄Ѡ|~ NPpb,r5X(0zqB%n`q5 ?r(h`|rP".`!DBaA:$DGwAI!.90CƟ¯ Y# Y@ܬN",(YQfs舞W*TQcib] G 34-(ZU7GHHJa ,n/G2`c,Yxjk^F̒p=\B(vl;G]W0B[t'iٍd?IlIBR_mGHT%ķE0+]Nh!EbfTrd49gm zI?訚͍#`rj c=}v[1R"fFEoOAJştARmFW^M|Wu';"c2 9՝pN(d6ysqw!Y+)cp`(q~ bݢ|`z_k5q-rh+r!9Ʒ7Tica>1 -d>=$ ൛KNA%-qķb>k: `8+؝U7E3#*~BS{c_ 9O:90tqkdhbtӒ_Agڸ&"?zNNGe q/qjȫ|wJԣ+v#z@})-pЁΟvjDCe28Ev=N f\b.xQ_hixɅNBV;n ć{k|OtdXS@wFDI~ u,_ hJveLKēe&a$pN%#vXCXg|$(NJ0].=n|S3[Mb uADW]6M&L)Nn7;%uH&Cztg^F{ ~XO6X8u }; u_QI,J{$8Od Əq;2#* T}M'],$yBIo5 l$$AGx`~s(`ZզZgʨy^"Eeisy__n< (3;2[w.ҮЉx9i*p@kr {:~Q=ёnvN.19B@$vƅ(v^5]RXذt.)7Fv;Yd|\YC 2OcI8DSZd5}ꑅG=ts@Lx N/ssǛD}k p9>ӥސH }8n2MO|>8ط-V;Xj'2c;֨Ѹ_Ʊ01\G@u'fh84CTVK.d3u'O -)bCh}1,<3]Xڢ- YK)u8ּ 4'fe͌$_bC>d#{>սSEݘ8 G7\tseYHEbj}t)g* p[x‹-L&݋f"pvEקlP%lmeO9[k7؎!lv"j~ -bK]sM2amEMƹmol]Ke/}pU@g$KA1o -/U+.,ze -npT'XM{߷nm8ӽ}ǐ{}ž> gn7ԣ=d2Ƹ=Z:'9Qg#:KPإB 9 -E ӥǗ{﫟1O2 x[`)CDc1nh?<.Gڮl^KF pWGOX"zԧ._%i?>%7`K4ݜ1}ZrԽ!߅14uG|wmxھ-%m0(1n9'h - z=e<L'auL'O߷mCH/59yâ~9Ft;CS5BעP{xgV<YV;f;} -KF"!^qsz -գY5Y~1@$vTԻ1R7[T{9mdlI1»2 V tx{ׯ4Ј޲3M[ јIw)H.7S`>" R&`}v4zҏR@zVjTG9 x6WogD /ҫ&sw@Н9qDoi91by56 -Ĉr!A@mg3ϿW -(Q^G(hvڐZ2\VyF㗚+ZyK^^YhXerckd6Gc"[[ý$жeNX93/=ׇK7Y$Y\EPoDJwIg,P}ksYbniTܮD4-Irb΃6 1rno lC}usjm*u߉gy ]$ -4>TG"y"sAhԙGf(b'Qu; {7MFPjQ%f-n3Z[`a,3(8OOv1{,^Ⱦ ״}Jd"Cicu.ayLρӊn1V_%z?m3i&)v>qSu$dr}|&f45I䟶jw -O7 cӴ߫]R===X};dI=e1Fz[ΞQIi2?}y -#ߡӐi}3Sӏtw/}:H/O7" :gX+)F6 *+VIgfzNb;m{{pL{s*7`>b<EVXF}$}] z9 9 3]\bъ_sW+3X GD@#6~+y -#9JE4|5:4 '`Y M굾g{.>&`)! Ѳsڿ PP @2Z'nz> !Wx㩙6&8B(ӟ2l3S07HCN1pرIy`iwgsN4XqTR )St<Y ;*LIsdU .\*f(=?GmzC/XAğmM#1?^~Djרu m4̼rRx1^JYaᝇ1!?br)[&=9>7 W - X@5QqAtx43Ýynz?$K҂[+ԜzqC1 ?ld}U`{ -%;ItmtKSѓ%4H[++pʢ(恽Ƥa}qc| -83IQ{ʉ9lm=H/WƹhRdj*^?eNU5?\?jbl3n.ꌸ&a&<-87\'ybhe-1|JJ)VNuli䅖orwc%i,7;h4&h1eǓFS.;N4 աH DqE-a("Gq*{ƧbǮk tKaFlX5nJ#|dki "\w߲{=,?$Y -*۲auo5+̺ -,Z]~8?~4!16?_ϐɁ'Ѳ9F#441 N➻nxdY| Nv47K%+8sJIeQlj^ijspH D-+7ȝ,&&4Xi/ߧw5}n*,/| v<6R@isUzSB+ӪdTiݠ/D))In}Ѭo+ O-{~ٔΥwd2+%:/=c?x˓7Fy',Nxho˖6:9J6hea0~Mn4RorʲOn -+,L~nBjMOI~4rT/_T^=.g䂝,zպ}_-y-"}R -E:# 6B,*+)TJ _UhD$$Gch7ħxM:uTs]7Fu1Eךo$ډaݮ P/MTXqK4Qq~KGZ.rqi-egO\ni8sl~cF`AU$ԕT|_]̢5{ #'Mc4Q$GG!<)ڗ(Oj.r7t6*@gsy/%bY"]d\~l5\ 1Ku}Ad+aP -*)ޖ;Ѷwq"Rj}5%dsh[g7'KxH;MJ"(2Qh-ݚoqg2*' |> I"p<*{1˲Z_ڲdǯc%j}vɡSΠ: :9tt8 -9ttl)gCAw-: :WɡSΠ;Yr 9tt“DrT+C' -H>߯1Dtn: 3'pSqH)|"@72Qiw`X O:dl۴x. O 831dQfp?-hKkg|'8,f~9#JsZg .TpdD3Uw/SjdKg ] l9Qb{ɻD]ԞIGE:'?64AɅaʛrG(lZJ ^!ONv -yBFP:﫣C p#ʒS$&yJU>i#%: -XṮ>jzƉUҏTRLndQ<}"/hx,vot1^Yf܍A]$#0$*&$xs#S#8-bYY?HY2i]hHϹ NdW.Ƞ44Ie)e4zdpv##wǝb|%]9%砹j{qQ%F 9% +9eSa܎z> M.d{5RhQ)t>h5+՝JjyuƮ[I1RHTc1n(YcغE~_2p*])9Kg];rI>T*dn>o"T)e^/Y|W·JK~ݪ1Ugp21W·;UC~YX'uv_O~)-Qٵb"Nfox֪+P*Z ܏r֍~~c_P?T"u&ݦuysgsΆ %1 7Nk&kaK*4Rmf vq"bŸXL?$Ber~~{EMg:;vB/mxUTiѝòoWH%*hH%bޫUHGnՅ2RWHm_)#}Զ5put=;n9M>z{vqZAWOygI\˩agPGY%(d/ CC,~ vldTfNBQ[r3gyY| 2@q=)f@s y=?RZ6~=tsߝMGp)e\Hj;ߔ;^t#ك|$۳ԄkZZU͜E|A̕|jPVF%9)wtJr1:r?¥H*àh6YK"OՊOsڸjEI'bmʵ-:G15Rj嗰jf8M'!;sM'e-eI98M'rytR gIul:^dItEl:\:şdI0^kfI½tTiJL_{52w\,d_{0Z_I71`Yx_*XI6Yb.Hj?5]z Tddd/ -":?J3–Z>Q,2ZiVYkPz ]^[^1 -:V4Tm1J9ͣ6G믓{S8ju?s"-5hDuZiB]4IK}y[3&72NR.CNϐTLdbC_C{\ڟe2gagJj`ˇjZ$ǙQO8Ž\υ RZ?Hd%j *lxW2RE#UӖ_ -w7MsqjUS|9 -zAG-Hk*ɳ+IJW(r 59־^bm9~ybm[٪Z7S2WH^Y\1\<3>zQvT.O a"U41}l~Sk5!Uк$&.h6]CV.?xwnh4?Բ~K!ؕ-vz(8_ϳT縊/:bVʻ^kG*dY\|+NluqGmj*+lA3Ӡt2\\)OkGPE{|yg7zѻtʜBقE[&3߭7NPҿ05M\) &#Sn ȥut>yܶ\ M.5M!.ri1^<ɥx۶K“N.&{%IřDHjlh{3Oru` n\ &Ѫ"tb10Ƹ T #-=Qv0|vYvXD[TKv"mfZ΃|b0dH>d3UT+SԦBd5]|߸I%T' T @TēYv欴BjYiSء~@0Iݺ kn WtG/Xy"cH?U(|x -ىܦAJ UR5rTrX߸TND م9P]YG~eSc*'LhHVF/LgLVcˏjUC ?̟,@JYZsoԚx,@;m˲E7,@v4PO\_SOH*Y[?.',eE$pW/ʧV:E 4zQ>Y/UI\(UW74(ݙP\ -\WJ~S4+ %[O+$֓ZOߏ.˯rU?-)dQ-?LkD+\WJDwYJ~-QO3\\՟JGT%_Fwr+;oIWZrI]?tk )^﷥lQO9;e]?07[h.lZ4Gj만I)\ߜ)?wIVڵUdu SL2RՏ-B/z:⬤_S) -nש'GLU?Ō )7Kʱ$uU~^J~^봿(]vO)Ԝe]?.K2ojuIKSVsp)WN=>,\~:]]c/Y\IӖ /A]?dx^lU?99vi]?~_S6ۥ~U~bL[$/I<$8[yuC~U?\ I,,OeT맜+~\O*>V(^PO=uǟU-/Da\.'-E]BµUgŬ(J8a}G*CfZ-V[0*EQ[>ԙv(FdcW~":ۺB=%?f"`&NdDqe(;ue?Aޡh2ev!! C B ! g}[%ɶn -;YaeTAaǣ>|Hv_yC29D{pc|x&g?[ӣW ͇?frkr3'G_.;޽t<L_1$|\]|=$fg϶OnfZ_ib`s|ԋw{cG#x31t'TG!;WxG޽Ol-ܼ^xݧT?>xk!z(??6Ӝx/;/us ŸY0BĞ—SR(bgr:#{Q'&9>B_`Ĭ/99|M:#ڜN~^%{; /w'y:$»Z|l&h1 ,+4' /wua^~`3ɹXL~s:*Arzs4h -V^GQ~V }X3-rv2MVGo7N흭0837x:~~`Dx>#Mj'x{4JUrcO=on_b;ǟ\AaX)MةJ80xױd}?Tls)s>4ͪWێ# [LXiru{' =^;#qꤕګ~[zʃi`\7`0hlç&' &K߳"=]#e2/'D2OHV۶F;":&v&Ɯb@[<δ٣b)!S  "w2s?)ih7 -hsD?ph5rh| >R2y0^t~p/އ^{|ǟYA4mWuѐzץGJ+aIGqQ'`u\%(a⡣K.]*nlʨ^>$ ɪ/wz'w7|Y1JZ|P>'-g?mNwE\)o/jazpv^6qIgU٘cCª{mzjD]UNEͿM=.7V%xKO/hք|P\gg dA66vWuڇ66~w`"naVg,סW=ϧX;F'}6oUov!wFoeUaпه"O\O^,M&+ciNݥ[һ[D oI$7%<,q_KV}K˲DRS~I/zTHbyœ)wC~ꛧ3+Wut7 S[Ȕg'+|Oَ⋋b/[ .姲; }fcjjBWŃŽWk]u]n}~aw*~YL( -F'ߞu7pkq[o[-ԍ햻a |y轒x]n%oJǟy/'hxHG%x$ʫd}[a=۹z:祥Ml:.gNUÄ합tl}8d -f+T4ߓxөb-Ÿzvr[ tLfb3{8;Aߞ~jgC7l.?A~-o|mOw'}JGWƏ_ 6=ܟ#KzxI̷o_ٶ?ֶn~~|-wK1{yebaï-YK9ȡ;SH־ȏ:z円z[&|tK2+B7KoVGN^8r<=,He|SfkI?w瘅~q;a8T6>ܱw+Gf#{t3f-Nqӡ&w=AvWxg vE{~Glӌ2C戜djFc,^437?e-^5-">DZ8Y~6{I*GAfמL?f9ѱbk/ w+ ߙض׶9rvOֻT )-?Wݫ/gC8޽8\vtMkYxi3k|J׾?xh/~>/l_jzax[—Fxmtu8 3_Pߕq_p?ǞƗY~slO%Թ؜l/.vޮ,ړ[K#gǫ;+٧sko>B1| Uv&j~9^w>9a~|:~Ěs[Z_b7XDiÔg\pOb$ߊA?}/_NNLn_|PX -UL?eO7Pm/m'/wuL+4{3U>Ѩ]e hDWgF|'ł7;kɗۇg+;XҾ 歛{凴TMB:ٿ弋XNSH⦉?Mٷ-}O?OypgnRavMdcٗ 7];Gۨ;;+ xXY^~~~iy2_]]y6Ɏ}=hQ퇐Q.+dY[s=U3.)_y-xˉo| -x|{ |utܯ?6<3GHvʞ> kȳq2а#1*+#WrԿ3v۫\Uݙ}ǿ>}=lsUCnf˓,[-|mi+Z=ml6?Y+!][[6ɜ6iX)7ՀSMW2dEaBvR`Ⱥηbfo-N7&+WWO_; l|{"J~${OUqvˢ|&nKM?Z/Fԉy0-d$u`^^#1,+<. dn}U~~~99>@UȯJTcm}WЛs+hvPp' - ;,2H *AmբkHAZoڢU:sëڄ.z[9ڳtDs;eQW;~lԕu鄹p2cv2|Q4A_?) s}L|7Ky<]mŝm{[M6p>|g{{qg{y _kyW者w:ԮA?Wg׾+0);[}]qU]Oݎܭ#2X41=7y!@bpHbH$HHC&BUXI*[qG^ɘBA|1D !cAexRbL`D(!RQ -i 0z6ˁRZRO2-#8gnb4M8MHTKJ=?&#$QiHHax,&yKVF+ds O"HjI -~"zZ(瘀Y) yg\V -\# Ղ!%"$K) j^+#:/)A9|Hخդߐ!Ȗ#:pX0eh`wÅ`pip &&QXÀDCPD4WbD7 .Ʌvh$80 %-8TQp)$OpE;n'E)TUǠ^չ4\^lq4^zcI0kE -é -A ([t,%AWI.@o녴UvU*`d C=++_^,A0!+>lLpy0B32"s/0N" rb{7(s0=N{)T! h~i ~r? kXG.ĘBbA &j*hRIM2 -X}.&G`c!&xY.eBLFI\@Y͖b;P&? -"cXPE4}M7q@ $DցbB % 2,i $o\B1 z  pJMu8a #Pv\ -2FJU5'A Wيԗc1 XU$(Aӟḵ *ˁak3pqDs hD85z7s0(j4=_R).>HyOC”b. AbABCL|DPLń% 3}L-@UfK8U&6%J -]eq@ LRS&ADÂR' -]u4Aϭn3DN, NL -nTE;3 -B}J̳!.cj ʼnI2Ф -$2Sj&f"LNyOK!1LlA%lfVrA2{ }d@9hV0?TY3׭EpBpqM -PXf~ݧ;O'_#x,83qZG8VBf)̾p!€T2#NUj],6-5 e! \QBUXzBC5Rӹjda$$$koX- La@S=r<1LVD"COUs-0`^' -.$!XD4զ{9NBPWkLSH%B,aWzW9S+[!ϼ3bNdklU@J\,:[M)Ę3S#N GwSDr *,HS - | | | | | | |jn D}"AE|bB@!?@ L0Lp`&-G&2Lp`n ]!?Lp`Bu9v' &8B^0A L(e؜LpL &86܆`%?W="uHL 5p p.&`R b8 !/ `7 & (\/P& `&sY L(,qXLpLpWLpVLpֺLp}Lp=L a0HL a0=`&:`BaG&:`& Lpd|` `# -- UztA0 `#zgtA0϶`ےL=_P0 La0AdLa0AdLa0AdLPa0ATLPa0ATLPa0ATLPa0A(B`b `"80 NL >&: &` ̩ x0 RH0' Lp/P!0 * &0  ` - U%c`P &hc0'&`48Lp%`BI& =e{7B&Bh;A``Buttnp;* LPa0AT0A=D? -yט`+ Yz3? | | | | | | | |>h>h>h4A ":`#-B`+}g1Lpz!? EK~0 δW&`&`kN^0 ՙ6x۝`/yQL&8B^0?ڜL5UL5K^0 ՙ6sxep L &&C`ޚ - *&:` - * &` - 2 &:`\`#d0Ad0AT0Ad0Ad0u?YLA0AULPa0AULPA0_>0u^0u& j P0  `PxW&+h&8B^0ђLpUT0AyW&T  P=_P0 La0xLa0xLa0xLa0ADLa0ADLa0ADLa0AdLa0AdLa0AdLa0ATLPa0ATLPa0ATL:&I 0nLp -P &Tc? &:` " &:`&:`&0 `BUj *&0 2 & j Uѽ`B!4LPuUL(0|~0:{:7}G&0   j yYz3? | | | | | | | |>h>h>h4A JZEk?Y?@ UI1AbtqdhE<!? DDp "-AG"2Dp ": "8!?P{js} D`u@A #i"86x AxDp BuV: 2 " "": " " < ": \ #xAxAADAAxAxu?A^DAAAQDaAAQDaAAYDAAAoA!?P$~ -"8D(4DpTDAAG"TP=_PDahDahDahD`aXD`aXD`aXD`axDaxDaxDaDDaADDaADDaAdDp -xA71  , "0PU?" " ": <": " BU8sT?P DAr6Dp<DMmG~, ": ": ": ": cq~5K/P{fq@ԃ@'cx΋'ó 0L1 -|1nspΨwD .QAϯ4A$L((&)'xڂ -pD8;TJS^|hP)Ud(+2R/ER7؛{fnl 56nb:v)n=`ڞYV%Neai ~Fyn'([j)NK`FFv+kqMYe @J #Q 26)͖R˃yƍrKڡ4ږ^2P"* -|晷{R!ujy'Y`.aj;)d`J˪0׃S$7<.ѱP"^'P -!0bq[_:XIR=CtEp7ضTM@HTeTwjjjc\7Ol؆x1"47g@슘tmYn -Za!SMnj{@B٩v $ZJr'Hvv'MA;Dӈe,~rdf,ѱ &WAb -ܦlgiOdS)w mgDڠ zMȱ ԗ†q -Oa«0V12D}i("B=ʰ#~`-Dd)B},ZP)1'S2L^++40S -^aͦzZ -2,}Jq-a=i1`FG5fq@gGƳdn%FOȹV0Yz -^llll{0 ,` a bn~h:׮#(XDPFhogip#k3a U%Pg&scvs)֬CI,!HLK6!76  fF_* 0;e2wp ?#rX2#1!u&6ɝ`ƆPdw)Z}Y~Qpoza"G!DXlCTv3ʡ=S4! -])jj;d>iI$dT.$2Befl;⣝a{> T Y5 -HrhDOTv!$T9 &ep@Y.`u-MfED"r+ 08jyS\"%c( 9eWJҫ -As¦!Ӓ~^X߻uJ]pRF`&^LeܘPA3&DвsJͅeE`vm节.4K jĬbԃvq*kV5uo`5rLj -'98aƜvнh=ۦ7ٜ8%r= %Y @;_K4x`nngG6F -nUO &,Oe5,N7F(3n3JAqYD)rg!mhҞ>ԁn`nl7l9OTM \ MeDfiqNm\#6Tޛ{{{{{n4> -)SҕagLԺ2w%=Bl,H 5Hz7-cVYcX6jPpyUw*yZ JbEӴz9YJ A˜rQACP*x|6z0]5P#T晹{8^+G^MO;G_oλWC_:?֗Uu?|%oWWH endstream endobj 21 0 obj [/ICCBased 27 0 R] endobj 7 0 obj [6 0 R 5 0 R] endobj 40 0 obj <> endobj xref 0 41 0000000000 65535 f -0000000016 00000 n -0000000156 00000 n -0000038280 00000 n -0000000000 00000 f -0000053108 00000 n -0000053178 00000 n -0000378446 00000 n -0000038331 00000 n -0000038793 00000 n -0000041265 00000 n -0000053839 00000 n -0000050299 00000 n -0000050186 00000 n -0000053480 00000 n -0000053603 00000 n -0000053716 00000 n -0000042272 00000 n -0000044889 00000 n -0000047506 00000 n -0000041327 00000 n -0000378411 00000 n -0000041711 00000 n -0000041759 00000 n -0000053045 00000 n -0000052982 00000 n -0000050123 00000 n -0000050334 00000 n -0000053364 00000 n -0000053395 00000 n -0000053248 00000 n -0000053279 00000 n -0000053913 00000 n -0000054175 00000 n -0000055286 00000 n -0000067808 00000 n -0000133396 00000 n -0000198984 00000 n -0000264572 00000 n -0000330160 00000 n -0000378475 00000 n -trailer <<0C9D12E6EE994682A6EAD56912419B86>]>> startxref 378666 %%EOF \ No newline at end of file diff --git a/pages/resources/immutable-global.js b/pages/resources/immutable-global.js deleted file mode 100644 index 1b3cbe3ec0..0000000000 --- a/pages/resources/immutable-global.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = global.Immutable; diff --git a/pages/resources/jest-preprocessor.js b/pages/resources/jest-preprocessor.js deleted file mode 100644 index a17045350b..0000000000 --- a/pages/resources/jest-preprocessor.js +++ /dev/null @@ -1,10 +0,0 @@ -var reactTools = require('react-tools'); - -module.exports = { - process: function(src, path) { - if (path.match(/\.js$/)) { - return reactTools.transform(src, { harmony: true }); - } - return src; - } -}; diff --git a/pages/resources/react-global.js b/pages/resources/react-global.js deleted file mode 100644 index 45b0fd0871..0000000000 --- a/pages/resources/react-global.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = global.React; diff --git a/pages/src/docs/index.html b/pages/src/docs/index.html deleted file mode 100644 index a48835b4ef..0000000000 --- a/pages/src/docs/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Immutable.js - - - - - - - - - - - - - - - diff --git a/pages/src/docs/src/Defs.js b/pages/src/docs/src/Defs.js deleted file mode 100644 index 53ac6891f6..0000000000 --- a/pages/src/docs/src/Defs.js +++ /dev/null @@ -1,293 +0,0 @@ -var React = require('react'); -var CSSCore = require('react/lib/CSSCore'); -var Router = require('react-router'); -var { Seq } = require('../../../../'); -var TypeKind = require('../../../lib/TypeKind'); -var defs = require('../../../lib/getTypeDefs'); - - -var InterfaceDef = React.createClass({ - render() { - var name = this.props.name; - var def = this.props.def; - return ( - - {'class '} - {name} - {def.typeParams && - ['<', Seq(def.typeParams).map((t, k) => - {t} - ).interpose(', ').toArray(), '>'] - } - {def.extends && [ - {' extends '}, - Seq(def.extends).map((e, i) => - - ).interpose(', ').toArray() - ]} - {def.implements && [ - {' implements '}, - Seq(def.implements).map((e, i) => - - ).interpose(', ').toArray() - ]} - - ); - } -}); - -exports.InterfaceDef = InterfaceDef; - - -var CallSigDef = React.createClass({ - render() { - var info = this.props.info; - var module = this.props.module; - var name = this.props.name; - var callSig = this.props.callSig || {}; - - var shouldWrap = callSigLength(info, module, name, callSig) > 80; - - return ( - - {module && [{module}, '.']} - {name} - {callSig.typeParams && - ['<', Seq(callSig.typeParams).map(t => - {t} - ).interpose(', ').toArray(), '>'] - } - {'('} - {callSig && functionParams(info, callSig.params, shouldWrap)} - {')'} - {callSig.type && [': ', ]} - - ); - } -}); - -exports.CallSigDef = CallSigDef; - - -var TypeDef = React.createClass({ - render() { - var info = this.props.info; - var type = this.props.type; - var prefix = this.props.prefix; - switch (type.k) { - case TypeKind.Any: return this.wrap('primitive', 'any'); - case TypeKind.This: return this.wrap('primitive', 'this'); - case TypeKind.Undefined: return this.wrap('primitive', 'undefined'); - case TypeKind.Boolean: return this.wrap('primitive', 'boolean'); - case TypeKind.Number: return this.wrap('primitive', 'number'); - case TypeKind.String: return this.wrap('primitive', 'string'); - case TypeKind.Union: return this.wrap('union', [ - Seq(type.types).map(t => - - ).interpose(' | ').toArray(), - ]); - case TypeKind.Tuple: return this.wrap('tuple', [ - '[', - Seq(type.types).map(t => - - ).interpose(', ').toArray(), - ']' - ]); - case TypeKind.Object: return this.wrap('object', [ - '{', - Seq(type.members).map(t => - - ).interpose(', ').toArray(), - '}' - ]); - case TypeKind.Indexed: return this.wrap('indexed', [ - , - '[', - , - ']' - ]); - case TypeKind.Operator: return this.wrap('operator', [ - this.wrap('primitive', type.operator), - ' ', - - ]); - case TypeKind.Array: return this.wrap('array', [ - , '[]' - ]); - case TypeKind.Function: - var shouldWrap = (prefix || 0) + funcLength(info, type) > 78; - return this.wrap('function', [ - type.typeParams && - ['<', Seq(type.typeParams).map((t, k) => - {t} - ).interpose(', ').toArray(), '>'], - '(', functionParams(info, type.params, shouldWrap), ') => ', - - ]); - case TypeKind.Param: return ( - info && info.propMap[info.defining + '<' + type.param] ? - : - this.wrap('typeParam', type.param) - ); - case TypeKind.Type: - var qualifiedType = (type.qualifier || []).concat([type.name]); - var qualifiedTypeName = qualifiedType.join('.'); - var def = qualifiedTypeName.split('.').reduce( - (def, name) => def && def.module && def.module[name], - defs.Immutable - ); - var typeNameElement = [ - type.qualifier && [Seq(type.qualifier).map(q => - {q} - ).interpose('.').toArray(), '.'], - {type.name} - ]; - if (def) { - typeNameElement = - - {typeNameElement} - - } - return this.wrap('type', [ - typeNameElement, - type.args && ['<', Seq(type.args).map(a => - - ).interpose(', ').toArray(), '>'] - ]); - } - throw new Error('Unknown kind ' + type.k); - }, - - mouseOver(event) { - CSSCore.addClass(this.getDOMNode(), 'over'); - event.stopPropagation(); - }, - - mouseOut() { - CSSCore.removeClass(this.getDOMNode(), 'over'); - }, - - wrap(className, child) { - return ( - - {child} - - ); - } -}); - -exports.TypeDef = TypeDef; - - -var MemberDef = React.createClass({ - render() { - var module = this.props.module; - var member = this.props.member; - return ( - - {module && [{module}, '.']} - {member.index ? - ['[', functionParams(null, member.params), ']'] : - {member.name}} - {member.type && [': ', ]} - - ); - } -}); - -exports.MemberDef = MemberDef; - - -function functionParams(info, params, shouldWrap) { - var elements = Seq(params).map(t => [ - t.varArgs ? '...' : null, - {t.name}, - t.optional ? '?: ' : ': ', - - ]).interpose(shouldWrap ? [',',
] : ', ').toArray(); - return shouldWrap ? -
{elements}
: - elements; -} - -function callSigLength(info, module, name, sig) { - return ( - (module ? module.length + 1 : 0) + - name.length + - funcLength(info, sig) - ); -} - -function funcLength(info, sig) { - return ( - (sig.typeParams ? 2 + sig.typeParams.join(', ').length : 0) + - 2 + (sig.params ? paramLength(info, sig.params) : 0) + - (sig.type ? 2 + typeLength(info, sig.type) : 0) - ); -} - -function paramLength(info, params) { - return params.reduce((s, p) => - s + - (p.varArgs ? 3 : 0) + - p.name.length + - (p.optional ? 3 : 2) + - typeLength(info, p.type), - (params.length - 1) * 2 - ); -} - -function memberLength(info, members) { - return members.reduce((s, m) => - s + (m.index ? paramLength(info, m.params) + 4 : m.name + 2) + - typeLength(info, m.type), - (members.length - 1) * 2 - ); -} - -function typeLength(info, type) { - if (!type) { - throw new Error('Expected type'); - } - switch (type.k) { - case TypeKind.Any: return 3; - case TypeKind.This: return 4; - case TypeKind.Undefined: return 9; - case TypeKind.Boolean: return 7; - case TypeKind.Number: return 6; - case TypeKind.String: return 6; - case TypeKind.Union: return ( - type.types.reduce(t => typeLength(info, t)) + - (type.types.length - 1) * 3 - ); - case TypeKind.Tuple: return ( - 2 + - type.types.reduce(t => typeLength(info, t)) + - (type.types.length - 1) * 2 - ); - case TypeKind.Object: return 2 + memberLength(info, type.members); - case TypeKind.Indexed: return 2 + typeLength(info, type.type) + typeLength(info, type.index); - case TypeKind.Operator: return 1 + type.operator.length + typeLength(info, type.type); - case TypeKind.Array: return typeLength(info, type.type) + 2; - case TypeKind.Function: return 2 + funcLength(info, type); - case TypeKind.Param: return ( - info && info.propMap[info.defining + '<' + type.param] ? - typeLength(null, info.propMap[info.defining + '<' + type.param]) : - type.param.length - ); - case TypeKind.Type: return ( - (type.qualifier ? 1 + type.qualifier.join('.').length : 0) + - type.name.length + - (!type.args ? 0 : - type.args.reduce((s, a) => s + typeLength(info, a), type.args.length * 2)) - ); - } - throw new Error('Unknown kind ' + type.k); -} diff --git a/pages/src/docs/src/DocHeader.js b/pages/src/docs/src/DocHeader.js deleted file mode 100644 index b39feefc22..0000000000 --- a/pages/src/docs/src/DocHeader.js +++ /dev/null @@ -1,28 +0,0 @@ -var React = require('react'); -var SVGSet = require('../../src/SVGSet'); -var Logo = require('../../src/Logo'); - -var DocHeader = React.createClass({ - - render() { - return ( -
- ); - } -}); - -module.exports = DocHeader; diff --git a/pages/src/docs/src/DocOverview.js b/pages/src/docs/src/DocOverview.js deleted file mode 100644 index d72c05e3db..0000000000 --- a/pages/src/docs/src/DocOverview.js +++ /dev/null @@ -1,46 +0,0 @@ -var React = require('react'); -var Router = require('react-router'); -var { Seq } = require('../../../../'); -var Markdown = require('./MarkDown'); - -var DocOverview = React.createClass({ - - render() { - var def = this.props.def; - var doc = def.doc; - - return ( -
- - {doc &&
- - {doc.description && } -
} - -

API

- - {Seq(def.module).map((t, name) => { - var isFunction = !t.interface && !t.module; - if (isFunction) { - t = t.call; - } - return ( -
-

- - {name + (isFunction ? '()' : '')} - -

- {t.doc && - - } -
- ); - }).toArray()} - -
- ); - } -}); - -module.exports = DocOverview; diff --git a/pages/src/docs/src/MarkDown.js b/pages/src/docs/src/MarkDown.js deleted file mode 100644 index b7eb3680ee..0000000000 --- a/pages/src/docs/src/MarkDown.js +++ /dev/null @@ -1,19 +0,0 @@ -var React = require('react'); - -var MarkDown = React.createClass({ - shouldComponentUpdate() { - return false; - }, - - render() { - var html = this.props.contents; - return ( -
- ); - } -}); - -module.exports = MarkDown; diff --git a/pages/src/docs/src/MemberDoc.js b/pages/src/docs/src/MemberDoc.js deleted file mode 100644 index 0511cb32c0..0000000000 --- a/pages/src/docs/src/MemberDoc.js +++ /dev/null @@ -1,209 +0,0 @@ -var React = require('react'); -var { TransitionGroup } = React.addons; -var ReactTransitionEvents = require('react/lib/ReactTransitionEvents'); -var Router = require('react-router'); -var { CallSigDef, MemberDef } = require('./Defs'); -var PageDataMixin = require('./PageDataMixin'); -var isMobile = require('./isMobile'); -var MarkDown = require('./MarkDown'); - - -var MemberDoc = React.createClass({ - mixins: [ PageDataMixin, Router.Navigation ], - - getInitialState() { - var showDetail = this.props.showDetail; - return { detail: showDetail }; - }, - - componentDidMount() { - if (this.props.showDetail) { - var node = this.getDOMNode(); - var navType = this.getPageData().type; - if (navType === 'init' || navType === 'push') { - window.scrollTo( - window.scrollX, - offsetTop(node) - FIXED_HEADER_HEIGHT - ); - } - } - }, - - componentWillReceiveProps(nextProps) { - if (nextProps.showDetail && !this.props.showDetail) { - this.scrollTo = true; - this.setState({ detail: true }); - } - }, - - componentDidUpdate() { - if (this.scrollTo) { - this.scrollTo = false; - var node = this.getDOMNode(); - var navType = this.getPageData().type; - if (navType === 'init' || navType === 'push') { - window.scrollTo( - window.scrollX, - offsetTop(node) - FIXED_HEADER_HEIGHT - ); - } - } - }, - - toggleDetail() { - // Note: removed this because it drops the URL bar on mobile, and that's - // the only place it's currently being used. - // var member = this.props.member; - // var name = member.memberName; - // var typeName = this.props.parentName; - // var showDetail = this.props.showDetail; - // if (!this.state.detail) { - // this.replaceWith('/' + (typeName ? typeName + '/' : '') + name ); - // } else if (this.state.detail && showDetail) { - // this.replaceWith('/' + (typeName || '') ); - // } - this.setState({ detail: !this.state.detail }); - }, - - render() { - var typePropMap = this.props.typePropMap; - var member = this.props.member; - var module = member.isStatic ? this.props.parentName : null; - var name = member.memberName; - var def = member.memberDef; - var doc = def.doc || {}; - var isProp = !def.signatures; - - var typeInfo = member.inherited && { - propMap: typePropMap, - defining: member.inherited.name - }; - - var showDetail = isMobile ? this.state.detail : true; - - return ( -
-

- {(module ? module + '.' : '') + name + (isProp ? '' : '()')} -

- - {showDetail && -
- {doc.synopsis && } - {isProp ? - - - : - - {def.signatures.map((callSig, i) => - [, '\n'] - )} - } - {member.inherited && -
-

- Inherited from -

- - - {member.inherited.name + '#' + name} - - -
- } - {member.overrides && -
-

- Overrides -

- - - {member.overrides.name + '#' + name} - - -
- } - {doc.notes && doc.notes.map((note, i) => -
-

- {note.name} -

- { - note.name === 'alias' ? - : - - } -
- )} - {doc.description && -
-

- {doc.description.substr(0, 5) === ' - -

- } -
- } -
-
- ); - } -}); - - -function makeSlideDown(child) { - return {child} -} - -var SlideDown = React.createClass({ - componentWillEnter(done) { - this.slide(false, done); - }, - - componentWillLeave(done) { - this.slide(true, done); - }, - - slide(slidingUp, done) { - var node = this.getDOMNode(); - node.style.height = 'auto'; - var height = getComputedStyle(node).height; - var start = slidingUp ? height : 0; - var end = slidingUp ? 0 : height; - node.style.transition = ''; - node.style.height = start; - node.style.transition = 'height 0.35s ease-in-out'; - var endListener = event => { - ReactTransitionEvents.removeEndEventListener(node, endListener); - done(); - }; - ReactTransitionEvents.addEndEventListener(node, endListener); - this.timeout = setTimeout(() => { - node.style.height = end; - }, 17); - }, - - render() { - return this.props.children; - } -}); - -var FIXED_HEADER_HEIGHT = 75; - -function offsetTop(node) { - var top = 0; - do { - top += node.offsetTop; - } while ((node = node.offsetParent)); - return top; -} - -module.exports = MemberDoc; diff --git a/pages/src/docs/src/PageDataMixin.js b/pages/src/docs/src/PageDataMixin.js deleted file mode 100644 index 6f79be1121..0000000000 --- a/pages/src/docs/src/PageDataMixin.js +++ /dev/null @@ -1,14 +0,0 @@ -var React = require('react'); - -module.exports = { - contextTypes: { - getPageData: React.PropTypes.func.isRequired, - }, - - /** - * Returns the most recent change event. - */ - getPageData() { - return this.context.getPageData(); - } -}; diff --git a/pages/src/docs/src/SideBar.js b/pages/src/docs/src/SideBar.js deleted file mode 100644 index f8095d19df..0000000000 --- a/pages/src/docs/src/SideBar.js +++ /dev/null @@ -1,119 +0,0 @@ -var React = require('react'); -var Router = require('react-router'); -var { Seq } = require('../../../../'); -var defs = require('../../../lib/getTypeDefs'); - - -var SideBar = React.createClass({ - render() { - var type = defs.Immutable; - - return ( -
-
-
- Grouped - {' • '} - Alphabetized -
-
- Inherited - {' • '} - Defined -
-
-
-

API

- {Seq(type.module).map((t, name) => - this.renderSideBarType(name, t) - ).toArray()} -
-
- ); - }, - - renderSideBarType(typeName, type) { - var isFocus = this.props.focus === typeName; - var isFunction = !type.interface && !type.module; - var call = type.call; - var functions = Seq(type.module).filter(t => !t.interface && !t.module); - var types = Seq(type.module).filter(t => t.interface || t.module); - - var label = typeName + (isFunction ? '()' : ''); - - if (!isFocus) { - label = {label}; - } - - var memberGroups = this.props.memberGroups; - - var members = !isFocus || isFunction ? null : -
- - {call && -
-

Construction

-
- - {typeName + '()'} - -
-
- } - - {functions.count() > 0 && -
-

Static Methods

- {functions.map((t, name) => -
- - {typeName + '.' + name + '()'} - -
- ).toArray()} -
- } - - {types.count() > 0 && -
-

Types

- {types.map((t, name) => -
- - {typeName + '.' + name} - -
- ).toArray()} -
- } - -
- {Seq(memberGroups).map((members, title) => - members.length === 0 ? null : - Seq([ -

- {title || 'Members'} -

, - Seq(members).map(member => -
- - {member.memberName + (member.memberDef.signatures ? '()' : '')} - -
- ) - ]) - ).flatten().toArray()} -
-
; - - return ( -
-

{label}

- {members} -
- ); - } -}); - - -module.exports = SideBar; diff --git a/pages/src/docs/src/TypeDocumentation.js b/pages/src/docs/src/TypeDocumentation.js deleted file mode 100644 index e70cff8c49..0000000000 --- a/pages/src/docs/src/TypeDocumentation.js +++ /dev/null @@ -1,309 +0,0 @@ -var React = require('react'); -var Router = require('react-router'); -var { Seq } = require('../../../../'); -var { InterfaceDef, CallSigDef } = require('./Defs'); -var MemberDoc = require('./MemberDoc'); -var isMobile = require('./isMobile'); -var SideBar = require('./SideBar'); -var MarkDown = require('./MarkDown'); -var DocOverview = require('./DocOverview'); -var collectMemberGroups = require('../../../lib/collectMemberGroups'); -var TypeKind = require('../../../lib/TypeKind'); -var defs = require('../../../lib/getTypeDefs'); - -var typeDefURL = "https://github.com/facebook/immutable-js/blob/master/type-definitions/Immutable.d.ts"; -var issuesURL = "https://github.com/facebook/immutable-js/issues"; - -var Disclaimer = function() { - return ( -
- This documentation is generated from Immutable.d.ts. - Pull requests and Issues welcome. -
- ); -} - -var TypeDocumentation = React.createClass({ - getInitialState() { - return { - showInherited: true, - showInGroups: true, - }; - }, - - toggleShowInGroups() { - this.setState({ showInGroups: !this.state.showInGroups }); - }, - - toggleShowInherited() { - this.setState({ showInherited: !this.state.showInherited }); - }, - - render() { - var name = this.props.name; - var memberName = this.props.memberName; - var def = this.props.def; - - var memberGroups = collectMemberGroups(def && def.interface, { - showInGroups: this.state.showInGroups, - showInherited: this.state.showInherited, - }); - - return ( -
- {isMobile || } -
- - {!def ? - : - !name ? - : - !def.interface && !def.module ? - : - - } - -
-
- ); - } -}); - -var NotFound = React.createClass({ - render() { - return
{'Not found'}
; - } -}); - -var FunctionDoc = React.createClass({ - render() { - var name = this.props.name; - var def = this.props.def; - var doc = def.doc || {}; - - return ( -
-

- {name + '()'} -

- {doc.synopsis && } - - {def.signatures.map((callSig, i) => - [, '\n'] - )} - - {doc.notes && doc.notes.map((note, i) => -
-

- {note.name} -

- { - note.name === 'alias' ? - : - note.body - } -
- )} - {doc.description && -
-

- {doc.description.substr(0, 5) === ' - -

- } - -
- ); - } -}); - -var TypeDoc = React.createClass({ - render() { - var name = this.props.name; - var def = this.props.def; - var memberName = this.props.memberName; - var memberGroups = this.props.memberGroups; - - var doc = def.doc || {}; - var call = def.call; - var functions = Seq(def.module).filter(t => !t.interface && !t.module); - var types = Seq(def.module).filter(t => t.interface || t.module); - var interfaceDef = def.interface; - var typePropMap = getTypePropMap(interfaceDef); - - return ( -
-

- {name} -

- {doc.synopsis && } - {interfaceDef && - - } - - {doc.notes && doc.notes.map((note, i) => -
-

- {note.name} -

- { - note.name === 'alias' ? - : - note.body - } -
- )} - - {doc.description && -
-

- {doc.description.substr(0, 5) === ' - -

- } - - {call && -
-

Construction

- -
- } - - {functions.count() > 0 && -
-

Static methods

- {functions.map((t, fnName) => - - ).toArray()} -
- } - - {types.count() > 0 && -
-

Types

- {types.map((t, typeName) => -
- - {(name?name+'.'+typeName:typeName)} - -
- ).toArray()} -
- } - -
- {Seq(memberGroups).map((members, title) => - members.length === 0 ? null : - Seq([ -

- {title || 'Members'} -

, - Seq(members).map(member => - - ) - ]) - ).flatten().toArray()} -
- - -
- ); - } -}); - - -/** - * Get a map from super type parameter to concrete type definition. This is - * used when rendering inherited type definitions to ensure contextually - * relevant information. - * - * Example: - * - * type A implements B - * type B implements C - * type C - * - * parse C: - * {} - * - * parse B: - * { C { - var superModule = defs.Immutable; - e.name.split('.').forEach(part => { - superModule = - superModule && superModule.module && superModule.module[part]; - }); - var superInterface = superModule && superModule.interface; - if (superInterface) { - var interfaceMap = Seq(superInterface.typeParams) - .toKeyedSeq().flip().map(i => e.args[i]).toObject(); - Seq(interfaceMap).forEach((v, k) => { - map[e.name + '<' + k] = v; - }); - var superMap = getTypePropMap(superInterface); - Seq(superMap).forEach((v, k) => { - map[k] = v.k === TypeKind.Param ? interfaceMap[v.param] : v - }); - } - }); - return map; -} - - -module.exports = TypeDocumentation; diff --git a/pages/src/docs/src/index.js b/pages/src/docs/src/index.js deleted file mode 100644 index d2557ad1be..0000000000 --- a/pages/src/docs/src/index.js +++ /dev/null @@ -1,129 +0,0 @@ -var React = require('react'); -var assign = require('react/lib/Object.assign'); -var Router = require('react-router'); -var { Route, DefaultRoute, RouteHandler } = Router; -var DocHeader = require('./DocHeader'); -var TypeDocumentation = require('./TypeDocumentation'); -var defs = require('../../../lib/getTypeDefs'); - - -var Documentation = React.createClass({ - render() { - return ( -
- -
-
- -
-
-
- ); - } -}); - -var DocDeterminer = React.createClass({ - mixins: [ Router.State ], - - render() { - var { def, name, memberName } = determineDoc(this.getPath()); - return ( - - ); - } -}); - - -function determineDoc(path) { - var [, name, memberName] = path.split('/'); - - var namePath = name ? name.split('.') : []; - var def = namePath.reduce( - (def, subName) => def && def.module && def.module[subName], - defs.Immutable - ); - - return { def, name, memberName }; -} - - -module.exports = React.createClass({ - - childContextTypes: { - getPageData: React.PropTypes.func.isRequired, - }, - - getChildContext() { - return { - getPageData: this.getPageData, - }; - }, - - getPageData() { - return this.pageData; - }, - - componentWillMount() { - var location, scrollBehavior; - - if (window.document) { - location = Router.HashLocation; - location.addChangeListener(change => { - this.pageData = assign({}, change, determineDoc(change.path)); - }); - - this.pageData = !window.document ? {} : assign({ - path: location.getCurrentPath(), - type: 'init', - }, determineDoc(location.getCurrentPath())); - - scrollBehavior = { - updateScrollPosition: (position, actionType) => { - switch (actionType) { - case 'push': - return this.getPageData().memberName ? - null : - window.scrollTo(0, 0); - case 'pop': - return window.scrollTo( - position ? position.x : 0, - position ? position.y : 0 - ); - } - } - }; - } - - Router.create({ - routes: - - - - - , - location: location, - scrollBehavior: scrollBehavior - }).run(Handler => { - this.setState({handler: Handler}); - }); - }, - - // TODO: replace this. this is hacky and probably wrong - - componentDidMount() { - setTimeout(() => { this.pageData.type = ''; }, 0); - }, - - componentDidUpdate() { - setTimeout(() => { this.pageData.type = ''; }, 0); - }, - - render () { - var Handler = this.state.handler; - return ; - } -}); diff --git a/pages/src/docs/src/isMobile.js b/pages/src/docs/src/isMobile.js deleted file mode 100644 index 0af2bd376b..0000000000 --- a/pages/src/docs/src/isMobile.js +++ /dev/null @@ -1,3 +0,0 @@ -var isMobile = - window.matchMedia && window.matchMedia('(max-device-width: 680px)'); -module.exports = false && !!(isMobile && isMobile.matches); diff --git a/pages/src/docs/src/style.less b/pages/src/docs/src/style.less deleted file mode 100644 index 43ddb5ba71..0000000000 --- a/pages/src/docs/src/style.less +++ /dev/null @@ -1,271 +0,0 @@ -@import (less) '../../src/base.less'; - -.pageBody { - padding: 0 36px; - position: relative; -} - -.contents { - margin: 0 auto; - max-width: 880px; - padding: 64px 0; - position: relative; -} - -.disclaimer { - margin: 60px 0 0 0; - border: solid 1px #eecccc; - background: #fefafa; - padding: 1em; - text-align: center; - font-size: 0.8em; - position: relative; - z-index: 1; -} - -@media only screen and (max-width: 680px) { - .disclaimer { - margin: 60px 0 0; - } -} - -.miniHeader { - background: #6dbcdb; - position: fixed; - width: 100%; - z-index: 1; -} - -@media only screen and (max-width: 680px) { - .miniHeader { - position: relative; - } -} - -.miniHeaderContents { - margin: 0 auto; - max-width: 880px; - padding: 12px 36px; - position: relative; - text-align: right; -} - -@media only screen and (max-width: 680px) { - .miniHeaderContents { - text-align: left; - } -} - -.miniLogo { - float: left; - left: -140px; - top: 12px; -} - -@media only screen and (max-width: 680px) { - .miniLogo { - display: none; - } -} - -.miniLogo > .svg { - height: 24px; -} - -.miniHeaderContents a { - color: #fff; - font-weight: bold; - margin-right: 1em; - text-decoration: none; - text-shadow: 0 1px 1px rgba(0,0,0,0.25); -} - -.miniHeaderContents a:last-child { - margin-right: 0; -} - -.toolBar { - .select-none(); - position: absolute; - right: 0; - top: 66px; - width: 220px; - color: #888; - cursor: pointer; -} - -.toolBar .selected { - color: #141420; -} - -@media only screen and (max-width: 680px) { - .toolBar { - display: none; - } -} - -.sideBar { - .select-none(); - font-size: 0.825em; - height: 100%; - overflow: hidden; - float: right; - width: 220px; - z-index: 0; -} - -@media only screen and (max-width: 680px) { - .sideBar { - display: none; - } -} - -.sideBar .scrollContent { - box-sizing: border-box; - height: 100%; - overflow: auto; - padding: 28px 0 100px; - width: 240px; -} - -.sideBar h2 { - font-size: 1em; - margin: 1em 0; - - position: relative; -} - -.sideBar h2 a { - font-weight: normal; -} - -.sideBar .members { - margin: 0 0 2.5em 1em; -} - -.sideBar .groupTitle { - color: @body-color; - font-size: 1em; - margin: 1em 0 0; -} - -.docContents { - margin-right: 240px; -} - -@media only screen and (max-width: 680px) { - .docContents { - margin-right: 0; - } -} - -.t a { - .transition(background-color 0.15s); - background-color: rgba(0,0,0,0.01); - border-radius: 4px; - box-shadow: inset 0 0 1px rgba(0,0,0,0.08); - margin: -2px -4px; - padding: 2px 4px; -} - -.t a:hover { - background-color: rgba(112, 170, 220, 0.2); -} - -.typeHeader { - color: #555; - font-size: 1.5em; - font-weight: normal; - margin: 1rem 0; - font-weight: bold; -} - -.interfaceMember { - margin: 1.3rem 0; -} - -.infoHeader { - color: #555; - font-size: 10px; - letter-spacing: 0.25ch; - line-height: 16px; - margin: 1rem 0 0.125rem; - text-transform: uppercase; -} - -.synopsis { - margin: -0.5em 0 1em; -} - -.discussion p:first-child { - margin-top: 0.5em; -} - -.memberSignature { - border-left-color: #9CDAE9; - background: #F8F9FA; -} - -.t.over { - border-bottom: solid 2px rgba(0,0,0,0.05); - padding-bottom: 3px; -} - -.memberLabel { - font-size: 1em; - margin: 0; -} - -@media only screen and (max-width: 680px) { - .memberLabel { - .select-none(); - cursor: pointer; - } -} - -.detail { - box-sizing: border-box; - margin-bottom: 2.6rem; - overflow: hidden; -} - -.groupTitle { - color: #9A9C9E; - font-size: 1.5em; - font-weight: 300; - margin: 3rem 0 2rem; -} - -@media only screen and (max-width: 680px) { - .groupTitle { - margin: 2em 0 1em; - } -} - -.doc { - margin: 2em 0 3em; -} - -p:last-child { - margin-bottom: 0; -} - - -// macros - -.transition(@transition) { - -webkit-transition: @transition; - -moz-transition: @transition; - -ms-transition: @transition; - -o-transition: @transition; -} - -.select-none() { - cursor: default; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -webkit-touch-callout: none; - -webkit-user-select: none; - user-select: none; -} diff --git a/pages/src/index.html b/pages/src/index.html deleted file mode 100644 index ffd3298d44..0000000000 --- a/pages/src/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Immutable.js - - - - - - - - - - - - - - - diff --git a/pages/src/src/Header.js b/pages/src/src/Header.js deleted file mode 100644 index cd71e57d95..0000000000 --- a/pages/src/src/Header.js +++ /dev/null @@ -1,124 +0,0 @@ -var React = require('react'); -var SVGSet = require('./SVGSet'); -var Logo = require('./Logo'); -var StarBtn = require('./StarBtn'); - - -var isMobileMatch = window.matchMedia && window.matchMedia('(max-device-width: 680px)'); -var isMobile = isMobileMatch && isMobileMatch.matches; - -var Header = React.createClass({ - - getInitialState: function() { - return { scroll: 0 }; - }, - - componentDidMount: function () { - this.offsetHeight = this.getDOMNode().offsetHeight; - window.addEventListener('scroll', this.handleScroll); - window.addEventListener('resize', this.handleResize); - }, - - componentWillUnmount: function () { - window.removeEventListener('scroll', this.handleScroll); - window.removeEventListener('resize', this.handleResize); - }, - - handleResize: function (event) { - this.offsetHeight = this.getDOMNode().offsetHeight; - }, - - handleScroll: function (event) { - if (!this._pending) { - var headerHeight = Math.min(800, Math.max(260, document.documentElement.clientHeight * 0.7)); - if (window.scrollY < headerHeight) { - this._pending = true; - window.requestAnimationFrame(() => { - this._pending = false; - this.setState({ scroll: window.scrollY }); - }); - } - } - }, - - render: function() { - var neg = this.state.scroll < 0; - var s = neg ? 0 : this.state.scroll; - var sp = isMobile ? 35 : 70; - - return ( -
- -
-
-
-
- -
-
-
- {(isMobile ? [0,0,0,0,0,0,0] : [0,0,0,0,0,0,0,0,0,0,0,0]).map((_, i) => - - - - - )} - - - - -
-
-
- -
-
-
-
-
- ); - } -}); - - -function y(s, p) { - return ((p < s ? p : s) * -0.55); -} - -function o(s, p) { - return Math.max(0, s > p ? 1 - (s - p)/350 : 1); -} - -function z(s, p) { - return Math.max(0, s > p ? 1 - (s - p)/20000 : 1); -} - -function t(y, z) { - var transform = 'translate3d(0, '+y+'px, 0) scale('+z+')'; - return { - transform: transform, - WebkitTransform: transform, - MozTransform: transform, - msTransform: transform, - OTransform: transform, - }; -} - - -module.exports = Header; diff --git a/pages/src/src/Logo.js b/pages/src/src/Logo.js deleted file mode 100644 index a3f9ce2a49..0000000000 --- a/pages/src/src/Logo.js +++ /dev/null @@ -1,67 +0,0 @@ -var React = require('react'); - - -var Logo = React.createClass({ - - shouldComponentUpdate: function(nextProps) { - return nextProps.opacity !== this.props.opacity; - }, - - render: function() { - var opacity = this.props.opacity; - if (opacity === undefined) { - opacity = 1; - } - return !this.props.inline ? ( - - - - - - - - - - - - ) : ( - - - - - - - - - - - - ); - } -}); - - -module.exports = Logo; diff --git a/pages/src/src/SVGSet.js b/pages/src/src/SVGSet.js deleted file mode 100644 index a6fb1a7e4a..0000000000 --- a/pages/src/src/SVGSet.js +++ /dev/null @@ -1,15 +0,0 @@ -var React = require('react'); - - -var SVGSet = React.createClass({ - render: function() { - return ( - - {this.props.children} - - ); - } -}); - - -module.exports = SVGSet; diff --git a/pages/src/src/StarBtn.js b/pages/src/src/StarBtn.js deleted file mode 100644 index 3f30cc8a4a..0000000000 --- a/pages/src/src/StarBtn.js +++ /dev/null @@ -1,40 +0,0 @@ -var React = require('react'); -var loadJSON = require('./loadJSON'); - - -// API endpoints -// https://registry.npmjs.org/immutable/latest -// https://api.github.com/repos/facebook/immutable-js - -var StarBtn = React.createClass({ - - getInitialState: function() { - return { stars: null }; - }, - - componentDidMount: function () { - loadJSON('https://api.github.com/repos/facebook/immutable-js', value => { - value && value.stargazers_count && - this.setState({stars: value.stargazers_count}); - }); - }, - - render: function() { - return ( - - - - Star - - {this.state.stars && - - {this.state.stars} - - } - - ); - } - -}); - -module.exports = StarBtn; diff --git a/pages/src/src/StarBtn.less b/pages/src/src/StarBtn.less deleted file mode 100644 index 59b8988295..0000000000 --- a/pages/src/src/StarBtn.less +++ /dev/null @@ -1,135 +0,0 @@ -.github-btn { - margin-top: -10%; -} - -.gh-btn, -.gh-count, -.gh-ico { - float: left; -} - -.gh-btn, -.gh-count { - border: 1px solid #bababa; - border-bottom-color: #a6a6a6; - border-radius: 6px; - color: #212121; - cursor: pointer; - font-size: 24px; - font-weight: 300; - line-height: 32px; - padding: 6px 14px 6px 12px; - text-decoration: none; - text-shadow: 0 1px 0 #fff; - white-space: nowrap; -} - -.gh-btn { - .gradient(#fafafa, #eaeaea); -} - -.gh-btn:hover, -.gh-btn:focus, -.gh-btn:active { - background-color: #3072b3; - border-color: #518cc6 #518cc6 #2a65a0; - color: #fff; - text-shadow: 0 -1px 0 rgba(0,0,0,0.25); -} - -.gh-btn:hover, -.gh-btn:focus { - .gradient(#599bdc, #3072b3); -} - -.gh-btn:active { - -moz-box-shadow: inset 0 2px 5px rgba(0,0,0,0.1); - -webkit-box-shadow: inset 0 2px 5px rgba(0,0,0,0.1); - background-image: none; - box-shadow: inset 0 2px 5px rgba(0,0,0,0.1); -} - -.gh-ico { - background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iMTMycHgiIGhlaWdodD0iNjZweCIgdmlld0JveD0iMCAwIDEzMiA2NiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTMyIDY2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsPSIjMzMzMzMzIiBkPSJNMzMsMS44Yy0xNy43LDAtMzIsMTQuMy0zMiwzMmMwLDE0LjEsOS4yLDI2LjEsMjEuOSwzMC40DQoJYzEuNiwwLjMsMi4yLTAuNywyLjItMS41YzAtMC44LDAtMi44LDAtNS40Yy04LjksMS45LTEwLjgtNC4zLTEwLjgtNC4zYy0xLjUtMy43LTMuNi00LjctMy42LTQuN2MtMi45LTIsMC4yLTEuOSwwLjItMS45DQoJYzMuMiwwLjIsNC45LDMuMyw0LjksMy4zYzIuOSw0LjksNy41LDMuNSw5LjMsMi43YzAuMy0yLjEsMS4xLTMuNSwyLTQuM2MtNy4xLTAuOC0xNC42LTMuNi0xNC42LTE1LjhjMC0zLjUsMS4yLTYuMywzLjMtOC42DQoJYy0wLjMtMC44LTEuNC00LjEsMC4zLTguNWMwLDAsMi43LTAuOSw4LjgsMy4zYzIuNi0wLjcsNS4zLTEuMSw4LTEuMWMyLjcsMCw1LjUsMC40LDgsMS4xYzYuMS00LjEsOC44LTMuMyw4LjgtMy4zDQoJYzEuNyw0LjQsMC42LDcuNywwLjMsOC41YzIuMSwyLjIsMy4zLDUuMSwzLjMsOC42YzAsMTIuMy03LjUsMTUtMTQuNiwxNS44YzEuMSwxLDIuMiwyLjksMi4yLDUuOWMwLDQuMywwLDcuNywwLDguOA0KCWMwLDAuOSwwLjYsMS45LDIuMiwxLjVDNTUuOCw1OS45LDY1LDQ3LjksNjUsMzMuOEM2NSwxNi4xLDUwLjcsMS44LDMzLDEuOHoiLz4NCjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsPSIjRkZGRkZGIiBkPSJNOTksMS44Yy0xNy43LDAtMzIsMTQuMy0zMiwzMmMwLDE0LjEsOS4yLDI2LjEsMjEuOSwzMC40DQoJYzEuNiwwLjMsMi4yLTAuNywyLjItMS41YzAtMC44LDAtMi44LDAtNS40Yy04LjksMS45LTEwLjgtNC4zLTEwLjgtNC4zYy0xLjUtMy43LTMuNi00LjctMy42LTQuN2MtMi45LTIsMC4yLTEuOSwwLjItMS45DQoJYzMuMiwwLjIsNC45LDMuMyw0LjksMy4zYzIuOSw0LjksNy41LDMuNSw5LjMsMi43YzAuMy0yLjEsMS4xLTMuNSwyLTQuM2MtNy4xLTAuOC0xNC42LTMuNi0xNC42LTE1LjhjMC0zLjUsMS4yLTYuMywzLjMtOC42DQoJYy0wLjMtMC44LTEuNC00LjEsMC4zLTguNWMwLDAsMi43LTAuOSw4LjgsMy4zYzIuNi0wLjcsNS4zLTEuMSw4LTEuMWMyLjcsMCw1LjUsMC40LDgsMS4xYzYuMS00LjEsOC44LTMuMyw4LjgtMy4zDQoJYzEuNyw0LjQsMC42LDcuNywwLjMsOC41YzIuMSwyLjIsMy4zLDUuMSwzLjMsOC42YzAsMTIuMy03LjUsMTUtMTQuNiwxNS44YzEuMSwxLDIuMiwyLjksMi4yLDUuOWMwLDQuMywwLDcuNywwLDguOA0KCWMwLDAuOSwwLjYsMS45LDIuMiwxLjVjMTIuNy00LjIsMjEuOS0xNi4yLDIxLjktMzAuNEMxMzEsMTYuMSwxMTYuNywxLjgsOTksMS44eiIvPg0KPC9zdmc+DQo=); - background-position: 0 0; - background-repeat: no-repeat; - background-size: 56px 28px; - height: 28px; - margin: 2px 6px 0 0; - width: 28px; -} - -.gh-btn:hover .gh-ico, -.gh-btn:focus .gh-ico, -.gh-btn:active .gh-ico { - background-position: -28px 0; -} - -.gh-count { - background-color: #fafafa; - display: block !important; - display: none; - margin-left: 10px; - position: relative; -} - -.gh-count:hover, -.gh-count:focus { - color: #4183C4; -} - -.gh-count:before, -.gh-count:after { - border-color: transparent; - border-style: solid; - content: ''; - position: absolute; -} - -.gh-count:before{ - border-right-color: #fafafa; - border-width: 8px 8px 8px 0; - left: -7px; - margin-top: -8px; - top: 50%; -} - -.gh-count:after{ - border-right-color: #bababa; - border-width: 9px 9px 9px 0; - left: -8px; - margin-top: -9px; - top: 50%; - z-index: -1; -} - -@media only screen and (max-width: 680px) { - .gh-btn, - .gh-count { - font-size: 16px; - line-height: 21px; - padding: 4px 12px 4px 10px; - } - - .gh-ico { - background-size: 36px 18px; - height: 18px; - margin: 1px 4px 0 0; - width: 18px; - } - - .gh-btn:hover .gh-ico, - .gh-btn:focus .gh-ico, - .gh-btn:active .gh-ico { - background-position: -18px 0; - } -} - -.gradient (@startColor: #eee, @endColor: white) { - background-color: @startColor; - background: -webkit-gradient(linear, left top, left bottom, from(@startColor), to(@endColor)); - background: -webkit-linear-gradient(top, @startColor, @endColor); - background: -moz-linear-gradient(top, @startColor, @endColor); - background: -ms-linear-gradient(top, @startColor, @endColor); - background: -o-linear-gradient(top, @startColor, @endColor); -} diff --git a/pages/src/src/base.less b/pages/src/src/base.less deleted file mode 100644 index ea7abee058..0000000000 --- a/pages/src/src/base.less +++ /dev/null @@ -1,140 +0,0 @@ -@link-color: #4183C4; -@header-color: #212325; -@body-color: #626466; - -html, body { - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - margin: 0; - padding: 0; - -webkit-font-smoothing: antialiased; - color: @body-color; - font-family: 'Fira Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 1.625; -} - -@media only screen and (max-width: 680px) { - body { - font-size: 14px; - } -} - -h1, h2, h3, h4, h5, h6 { - color: @header-color; -} - -a { - color: @link-color; - text-decoration: none; -} - -pre, code { - font-family: 'Fira Mono', Menlo, monospace; - background: #F9F8F7; - color: #484A4C; - font-size: 0.9375em; - letter-spacing: -0.015em; -} - -code { - margin: -0.05rem -0.15em; - padding: 0.05rem 0.35em; -} - -blockquote { - margin: 1rem 0; - padding: 0 1rem; - color: #727476; - border-left: solid 3px #DCDAD9; -} - -blockquote > :first-child { - margin-top: 0; -} - -blockquote > :last-child { - margin-bottom: 0; -} - - -// Markdown - -.codeBlock { - -webkit-overflow-scrolling: touch; - background: #FCFBFA; - border-left: solid 3px #ECEAE9; - box-sizing: border-box; - display: block; - font-size: 0.875em; - margin: 0.5rem 0; - overflow-y: scroll; - padding: 0.5rem 8px 0.5rem 12px; - white-space: pre; -} - -.t.blockParams { - padding-left: 2ch; -} - -// TODO: not random colors - -.token.punctuation, -.token.ignore, -.t.interfaceDef, -.t.member, -.t.callSig { - color: #808890; -} - -.token.function, -.token.class-name, -.token.qualifier, -.t.fnQualifier, -.t.fnName { - color: #32308E; -} - -.token.primitive, -.t.primitive { - color: #922; -} - -.token.number, -.t.typeParam { - color: #905; -} - -.t.typeQualifier, -.t.typeName { - color: #013679; -} - -.t.param { - color: #945277; -} - -.t.memberName { - color: teal; -} - -.token.block-keyword, -.token.keyword, -.t.keyword { - color: #A51; -} - -.token.string, -.token.regex { - color: #df5050; -} - -.token.operator { - color: #a67f59; -} - -.token.comment { - color: #998; - font-style: italic; -} diff --git a/pages/src/src/index.js b/pages/src/src/index.js deleted file mode 100644 index 734abc3baf..0000000000 --- a/pages/src/src/index.js +++ /dev/null @@ -1,22 +0,0 @@ -var React = require('react'); -var Header = require('./Header'); -var readme = require('../../resources/readme.json'); - - -var Index = React.createClass({ - render: function () { - return ( -
-
-
-
-
-
-
-
- ); - } -}); - - -module.exports = Index; diff --git a/pages/src/src/loadJSON.js b/pages/src/src/loadJSON.js deleted file mode 100644 index f83528bb72..0000000000 --- a/pages/src/src/loadJSON.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = loadJSON; - -function loadJSON(url, then) { - var oReq = new XMLHttpRequest(); - oReq.onload = event => { - var json; - try { - json = JSON.parse(event.target.responseText); - } catch (e) {} - then(json); - } - oReq.open("get", url, true); - oReq.send(); -} diff --git a/pages/src/src/style.less b/pages/src/src/style.less deleted file mode 100644 index 8e1bdbea97..0000000000 --- a/pages/src/src/style.less +++ /dev/null @@ -1,195 +0,0 @@ -.header { - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - -webkit-touch-callout: none; - -webkit-user-select: none; - user-select: none; -} - -.pageBody { - padding: 0 36px; - position: relative; -} - -.contents { - margin: 0 auto; - max-width: 740px; - padding: 64px 0; -} - -.contents h2 { - margin: 4rem 0 1rem; -} - -.contents h3 { - margin: 2rem 0 1rem; -} - -.miniHeader { - background: #6dbcdb; - position: fixed; - width: 100%; - z-index: 1; -} - -.miniHeaderContents { - margin: 0 auto; - max-width: 880px; - padding: 12px 36px; - text-align: right; -} - -@media only screen and (max-width: 680px) { - .miniHeaderContents { - text-align: left; - } -} - -.miniLogo { - float: left; - left: -140px; - top: 12px; -} - -@media only screen and (max-width: 680px) { - .miniLogo { - display: none; - } -} - -.miniLogo > .svg { - height: 24px; -} - -.miniHeaderContents a { - color: #fff; - font-weight: bold; - margin-right: 1em; - text-decoration: none; - text-shadow: 0 1px 2px rgba(0,0,0,0.35); -} - -.miniHeaderContents a:last-child { - margin-right: 0; -} - -.coverContainer { - background-color: #c1c6c8; - height: 70vh; - max-height: 800px; - min-height: 260px; - outline: solid 1px rgba(0,0,0,0.28); - overflow: hidden; - position: relative; - width: 100%; - z-index: 1; -} - -.cover { - height: 70vh; - max-height: 800px; - min-height: 260px; - position: absolute; - width: 100%; - clip: rect(0, auto, auto, 0); -} - -.coverFixed { - -webkit-align-items: center; - -webkit-flex-direction: column; - -webkit-justify-content: center; - align-items: center; - display: -webkit-flex; - display: flex; - flex-direction: column; - height: 100%; - justify-content: center; - position: fixed; - width: 100%; - top: 0; - height: 70vh; -} - -.filler { - -webkit-flex: 10; - flex: 10; - width: 100%; -} - -.synopsis { - -webkit-flex: 10; - box-sizing: border-box; - flex: 10; - max-width: 700px; - padding: 0 30px; - pointer-events: none; - position: relative; - width: 100%; -} - -.logo { - bottom: 0; - left: 60px; - position: absolute; - right: 60px; - top: 0; -} - -.logo > .svg { - height: 100%; - position: absolute; - width: 100%; -} - -.buttons { - -webkit-align-items: center; - -webkit-flex: 10; - align-items: center; - display: -webkit-flex; - display: flex; - flex: 10; -} - - - -@media only screen and (max-width: 680px) { - - .cover { - max-height: 260px; - } - - .coverFixed { - max-height: 260px; - } - - .miniHeader { - display: none; - } - - .miniHeaderContents { - padding: 12px; - text-align: center; - } - - .synopsis { - max-width: 540px; - } - - .logo { - left: 30px; - right: 30px; - } - - .contents { - padding-top: 24px; - - img { - max-width: 100% - } - } - - .pageBody { - padding: 0 12px; - } -} diff --git a/perf/List.js b/perf/List.js index a132aa89f7..375155e46d 100644 --- a/perf/List.js +++ b/perf/List.js @@ -1,47 +1,44 @@ +/* global Immutable */ describe('List', function () { - describe('builds from array', function () { + var array2 = []; + for (var ii = 0; ii < 2; ii++) { + array2[ii] = ii; + } - var array2 = []; - for (var ii = 0; ii < 2; ii++) { - array2[ii] = ii; - } - - it('of 2', function () { - Immutable.List(array2); - }); - - var array8 = []; - for (var ii = 0; ii < 8; ii++) { - array8[ii] = ii; - } + it('of 2', function () { + Immutable.List(array2); + }); - it('of 8', function () { - Immutable.List(array8); - }); + var array8 = []; + for (var ii = 0; ii < 8; ii++) { + array8[ii] = ii; + } - var array32 = []; - for (var ii = 0; ii < 32; ii++) { - array32[ii] = ii; - } + it('of 8', function () { + Immutable.List(array8); + }); - it('of 32', function () { - Immutable.List(array32); - }); + var array32 = []; + for (var ii = 0; ii < 32; ii++) { + array32[ii] = ii; + } - var array1024 = []; - for (var ii = 0; ii < 1024; ii++) { - array1024[ii] = ii; - } + it('of 32', function () { + Immutable.List(array32); + }); - it('of 1024', function () { - Immutable.List(array1024); - }); + var array1024 = []; + for (var ii = 0; ii < 1024; ii++) { + array1024[ii] = ii; + } + it('of 1024', function () { + Immutable.List(array1024); + }); }); describe('pushes into', function () { - it('2 times', function () { var list = Immutable.List(); for (var ii = 0; ii < 2; ii++) { @@ -69,11 +66,9 @@ describe('List', function () { list = list.push(ii); } }); - }); describe('pushes into transient', function () { - it('2 times', function () { var list = Immutable.List().asMutable(); for (var ii = 0; ii < 2; ii++) { @@ -105,8 +100,15 @@ describe('List', function () { } list = list.asImmutable(); }); - }); - + describe('some', function () { + it('100 000 items', () => { + const list = Immutable.List(); + for (let i = 0; i < 100000; i++) { + list.push(i); + } + list.some((item) => item === 50000); + }); + }); }); diff --git a/perf/Map.js b/perf/Map.js index f32bf36e29..b5758c7074 100644 --- a/perf/Map.js +++ b/perf/Map.js @@ -1,13 +1,12 @@ +/* global Immutable */ describe('Map', function () { - describe('builds from an object', function () { - var obj2 = {}; for (var ii = 0; ii < 2; ii++) { obj2['x' + ii] = ii; } - it('of 2', function() { + it('of 2', function () { Immutable.Map(obj2); }); @@ -16,7 +15,7 @@ describe('Map', function () { obj8['x' + ii] = ii; } - it('of 8', function() { + it('of 8', function () { Immutable.Map(obj8); }); @@ -25,7 +24,7 @@ describe('Map', function () { obj32['x' + ii] = ii; } - it('of 32', function() { + it('of 32', function () { Immutable.Map(obj32); }); @@ -34,20 +33,18 @@ describe('Map', function () { obj1024['x' + ii] = ii; } - it('of 1024', function() { + it('of 1024', function () { Immutable.Map(obj1024); }); - }); describe('builds from an array', function () { - var array2 = []; for (var ii = 0; ii < 2; ii++) { array2[ii] = ['x' + ii, ii]; } - it('of 2', function() { + it('of 2', function () { Immutable.Map(array2); }); @@ -56,7 +53,7 @@ describe('Map', function () { array8[ii] = ['x' + ii, ii]; } - it('of 8', function() { + it('of 8', function () { Immutable.Map(array8); }); @@ -65,7 +62,7 @@ describe('Map', function () { array32[ii] = ['x' + ii, ii]; } - it('of 32', function() { + it('of 32', function () { Immutable.Map(array32); }); @@ -74,62 +71,68 @@ describe('Map', function () { array1024[ii] = ['x' + ii, ii]; } - it('of 1024', function() { + it('of 1024', function () { Immutable.Map(array1024); }); - }); describe('builds from a List', function () { - var list2 = Immutable.List().asMutable(); for (var ii = 0; ii < 2; ii++) { - list2 = list2.push( - Immutable.List(['x' + ii, ii]) - ); + list2 = list2.push(Immutable.List(['x' + ii, ii])); } list2 = list2.asImmutable(); - it('of 2', function() { + it('of 2', function () { Immutable.Map(list2); }); var list8 = Immutable.List().asMutable(); for (var ii = 0; ii < 8; ii++) { - list8 = list8.push( - Immutable.List(['x' + ii, ii]) - ); + list8 = list8.push(Immutable.List(['x' + ii, ii])); } list8 = list8.asImmutable(); - it('of 8', function() { + it('of 8', function () { Immutable.Map(list8); }); var list32 = Immutable.List().asMutable(); for (var ii = 0; ii < 32; ii++) { - list32 = list32.push( - Immutable.List(['x' + ii, ii]) - ); + list32 = list32.push(Immutable.List(['x' + ii, ii])); } list32 = list32.asImmutable(); - it('of 32', function() { + it('of 32', function () { Immutable.Map(list32); }); var list1024 = Immutable.List().asMutable(); for (var ii = 0; ii < 1024; ii++) { - list1024 = list1024.push( - Immutable.List(['x' + ii, ii]) - ); + list1024 = list1024.push(Immutable.List(['x' + ii, ii])); } list1024 = list1024.asImmutable(); - it('of 1024', function() { + it('of 1024', function () { Immutable.Map(list1024); }); - }); + describe('merge a map', () => { + [2, 8, 32, 1024].forEach((size) => { + const obj1 = {}; + const obj2 = {}; + for (let ii = 0; ii < size; ii++) { + obj1['k' + ii] = '1_' + ii; + obj2['k' + ii] = '2_' + ii; + } + + const map1 = Immutable.Map(obj1); + const map2 = Immutable.Map(obj2); + + it('of ' + size, () => { + map1.merge(map2); + }); + }); + }); }); diff --git a/perf/Record.js b/perf/Record.js new file mode 100644 index 0000000000..712c077a58 --- /dev/null +++ b/perf/Record.js @@ -0,0 +1,80 @@ +/* global Immutable */ +describe('Record', () => { + describe('builds from an object', () => { + [2, 5, 10, 100, 1000].forEach((size) => { + var defaults = {}; + var values = {}; + for (var ii = 0; ii < size; ii++) { + defaults['x' + ii] = null; + values['x' + ii] = ii; + } + + var Rec = Immutable.Record(defaults); + + it('of ' + size, () => { + Rec(values); + }); + }); + }); + + describe('update random using set()', () => { + [2, 5, 10, 100, 1000].forEach((size) => { + var defaults = {}; + var values = {}; + for (var ii = 0; ii < size; ii++) { + defaults['x' + ii] = null; + values['x' + ii] = ii; + } + + var Rec = Immutable.Record(defaults); + var rec = Rec(values); + + var key = 'x' + Math.floor(size / 2); + + it('of ' + size, () => { + rec.set(key, 999); + }); + }); + }); + + describe('access random using get()', () => { + [2, 5, 10, 100, 1000].forEach((size) => { + var defaults = {}; + var values = {}; + for (var ii = 0; ii < size; ii++) { + defaults['x' + ii] = null; + values['x' + ii] = ii; + } + + var Rec = Immutable.Record(defaults); + var rec = Rec(values); + + var key = 'x' + Math.floor(size / 2); + + it('of ' + size, () => { + rec.get(key); + }); + }); + }); + + describe('access random using property', () => { + [2, 5, 10, 100, 1000].forEach((size) => { + var defaults = {}; + var values = {}; + for (var ii = 0; ii < size; ii++) { + defaults['x' + ii] = null; + values['x' + ii] = ii; + } + + var Rec = Immutable.Record(defaults); + var rec = Rec(values); + + var key = 'x' + Math.floor(size / 2); + + it('of ' + size, () => { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions + rec[key]; + }); + }); + }); +}); diff --git a/perf/toJS.js b/perf/toJS.js new file mode 100644 index 0000000000..d924d332d8 --- /dev/null +++ b/perf/toJS.js @@ -0,0 +1,22 @@ +/* global Immutable */ +describe('toJS', () => { + const array32 = []; + for (let ii = 0; ii < 32; ii++) { + array32[ii] = ii; + } + const list = Immutable.List(array32); + + it('List of 32', () => { + Immutable.toJS(list); + }); + + const obj32 = {}; + for (let ii = 0; ii < 32; ii++) { + obj32[ii] = ii; + } + const map = Immutable.Map(obj32); + + it('Map of 32', () => { + Immutable.toJS(map); + }); +}); diff --git a/resources/COPYRIGHT b/resources/COPYRIGHT deleted file mode 100644 index 54f9e0ac13..0000000000 --- a/resources/COPYRIGHT +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ diff --git a/resources/bench.js b/resources/bench.js deleted file mode 100644 index 93ddfdc021..0000000000 --- a/resources/bench.js +++ /dev/null @@ -1,242 +0,0 @@ -var Benchmark = require('benchmark'); -var child_process = require('child_process'); -var colors = require('colors'); -var fs = require('fs'); -var path = require('path'); -var vm = require('vm'); - -function promisify(fn) { - return function () { - return new Promise((resolve, reject) => - fn.apply( - this, - Array.prototype.slice.call(arguments) - .concat((err, out) => err ? reject(err) : resolve(out)) - ) - ); - } -} - -var exec = promisify(child_process.exec); -var readdir = promisify(fs.readdir); -var readFile = promisify(fs.readFile); - -var perfDir = path.resolve(__dirname, '../perf/'); - -Promise.all([ - readFile(path.resolve(__dirname, '../dist/immutable.js'), { encoding: 'utf8' }), - exec('git show master:dist/immutable.js') -]).then(function (args) { - var newSrc = args[0]; - var oldSrc = args[1].toString({ encoding: 'utf8' }).slice(0, -1); // wtf, comma? - return newSrc === oldSrc ? [newSrc] : [newSrc, oldSrc]; -}).then(function (sources) { - return sources.map(function (source) { - var sourceExports = {}; - var sourceModule = { exports: sourceExports }; - vm.runInNewContext(source, { - require: require, - module: sourceModule, - exports: sourceExports - }, 'immutable.js'); - return sourceModule.exports; - }); -}).then(function (modules) { - return readdir(perfDir).then(function (filepaths) { - return Promise.all(filepaths.map(function (filepath) { - return readFile(path.resolve(perfDir, filepath)).then(function (source) { - return { - path: filepath, - source: source - }; - }); - })) - }).then(function (sources) { - var tests = {}; - - modules.forEach(function (Immutable, version) { - sources.forEach(function (source) { - var description = []; - var beforeStack = []; - var beforeFn; - var prevBeforeFn; - - function describe(name, fn) { - description.push(name); - beforeStack.push(prevBeforeFn); - prevBeforeFn = beforeFn; - fn(); - beforeFn = prevBeforeFn; - prevBeforeFn = beforeStack.pop(); - description.pop(); - } - - function beforeEach(fn) { - beforeFn = !prevBeforeFn ? fn : function (prevBeforeFn) { - return function () { prevBeforeFn(); fn(); }; - }(prevBeforeFn); - } - - function it(name, test) { - var fullName = description.join(' > ') + ' ' + name; - (tests[fullName] || (tests[fullName] = { - description: fullName, - tests: [] - })).tests[version] = { - before: beforeFn, - test: test - }; - } - - vm.runInNewContext(source.source, { - describe: describe, - it: it, - beforeEach: beforeEach, - console: console, - Immutable: Immutable - }, source.path); - }); - }); - - // Array<{ - // description: String, - // tests: Array<{ - // before: Function, - // test: Function - // }> // one per module, [new,old] or just [new] - // }> - return Object.keys(tests).map(function (key) { return tests[key]; }); - }); -}).then(function (tests) { - var suites = []; - - tests.forEach(function (test) { - var suite = new Benchmark.Suite(test.description, { - onStart: function (event) { - console.log(event.currentTarget.name.bold); - process.stdout.write(' ...running... '.gray); - }, - onComplete: function (event) { - process.stdout.write('\r\x1B[K'); - var stats = Array.prototype.map.call(event.currentTarget, function (target) { - return target.stats; - }); - - - function pad(n, s) { - return Array(Math.max(0, 1 + n - s.length)).join(' ') + s; - } - - function fmt(b) { - return Math.floor(b).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); - } - - function pct(p) { - return (Math.floor(p * 10000) / 100) + '%'; - } - - var dualRuns = stats.length === 2; - - if (dualRuns) { - - var prevMean = 1 / stats[1].mean; - var prevLow = 1 / (stats[1].mean + stats[1].deviation * 2); - var prevHigh = 1 / (stats[1].mean - stats[1].deviation * 2); - - // console.log( - // (dualRuns ? ' Old: '.bold.gray : ' ') + - // ( - // pad(9, fmt(prevLow)) + ' ' + - // pad(9, fmt(prevMean)) + ' ' + - // pad(9, fmt(prevHigh)) + ' ops/sec' - // ) - // ); - - var prevLowmoe = 1 / (stats[1].mean + stats[1].moe); - var prevHighmoe = 1 / (stats[1].mean - stats[1].moe); - - console.log( - (dualRuns ? ' Old: '.bold.gray : ' ') + - ( - pad(9, fmt(prevLowmoe)) + ' ' + - pad(9, fmt(prevMean)) + ' ' + - pad(9, fmt(prevHighmoe)) + ' ops/sec' - ) - ); - } - - var mean = 1 / stats[0].mean; - var low = 1 / (stats[0].mean + stats[0].deviation * 2); - var high = 1 / (stats[0].mean - stats[0].deviation * 2); - - // console.log( - // (dualRuns ? ' New: '.bold.gray : ' ') + - // ( - // pad(9, fmt(low)) + ' ' + - // pad(9, fmt(mean)) + ' ' + - // pad(9, fmt(high)) + ' ops/sec' - // ) - // ); - - var lowmoe = 1 / (stats[0].mean + stats[0].moe); - var highmoe = 1 / (stats[0].mean - stats[0].moe); - - console.log( - (dualRuns ? ' New: '.bold.gray : ' ') + - ( - pad(9, fmt(lowmoe)) + ' ' + - pad(9, fmt(mean)) + ' ' + - pad(9, fmt(highmoe)) + ' ops/sec' - ) - ); - - if (dualRuns) { - - var diffMean = (mean - prevMean) / prevMean; - - var comparison = event.currentTarget[1].compare(event.currentTarget[0]); - var comparison2 = event.currentTarget[0].compare(event.currentTarget[1]); - console.log(' compare: ' + comparison + ' ' + comparison2); - - console.log(' diff: ' + pct(diffMean)); - - function sq(p) { - return p * p; - } - - var rme = Math.sqrt( - (sq(stats[0].rme / 100) + sq(stats[1].rme / 100)) / 2 - ); - // console.log('rmeN: ' + stats[0].rme); - // console.log('rmeO: ' + stats[1].rme); - console.log(' rme: ' + pct(rme)); - } - - // console.log(stats); - } - }); - - test.tests.forEach(function (run) { - suite.add({ - fn: run.test, - onStart: run.before, - onCycle: run.before - }); - }); - - suites.push(suite); - }); - - var onBenchComplete; - var promise = new Promise(function (_resolve) { - onBenchComplete = _resolve; - }); - - Benchmark.invoke(suites, 'run', { onComplete: onBenchComplete }); - - return onBenchComplete; -}).then(function () { - console.log('all done'); -}).catch(function (error) { - console.log('ugh', error.stack); -}); diff --git a/resources/benchmark.js b/resources/benchmark.js new file mode 100644 index 0000000000..a2e77aa399 --- /dev/null +++ b/resources/benchmark.js @@ -0,0 +1,283 @@ +var Benchmark = require('benchmark'); +var child_process = require('child_process'); +var fs = require('fs'); +var path = require('path'); +var vm = require('vm'); + +function promisify(fn) { + return function () { + return new Promise((resolve, reject) => + fn.apply( + this, + Array.prototype.slice + .call(arguments) + .concat((err, out) => (err ? reject(err) : resolve(out))) + ) + ); + }; +} + +var exec = promisify(child_process.exec); +var readdir = promisify(fs.readdir); +var readFile = promisify(fs.readFile); + +var perfDir = path.resolve(__dirname, '../perf/'); + +Promise.all([ + readFile(path.resolve(__dirname, '../dist/immutable.js'), { + encoding: 'utf8', + }), + exec('git show main:dist/immutable.js'), +]) + .then(function (args) { + var newSrc = args[0]; + var oldSrc = args[1].toString({ encoding: 'utf8' }).slice(0, -1); // wtf, comma? + return newSrc === oldSrc ? [newSrc] : [newSrc, oldSrc]; + }) + .then(function (sources) { + return sources.map(function (source) { + var sourceExports = {}; + var sourceModule = { exports: sourceExports }; + vm.runInNewContext( + source, + { + require: require, + module: sourceModule, + exports: sourceExports, + }, + 'immutable.js' + ); + return sourceModule.exports; + }); + }) + .then(function (modules) { + return readdir(perfDir) + .then(function (filepaths) { + return Promise.all( + filepaths.map(function (filepath) { + return readFile(path.resolve(perfDir, filepath)).then( + function (source) { + return { + path: filepath, + source: source, + }; + } + ); + }) + ); + }) + .then(function (sources) { + var tests = {}; + + modules.forEach(function (Immutable, version) { + sources.forEach(function (source) { + var description = []; + var beforeStack = []; + var beforeFn; + var prevBeforeFn; + + function describe(name, fn) { + description.push(name); + beforeStack.push(prevBeforeFn); + prevBeforeFn = beforeFn; + fn(); + beforeFn = prevBeforeFn; + prevBeforeFn = beforeStack.pop(); + description.pop(); + } + + function beforeEach(fn) { + beforeFn = !prevBeforeFn + ? fn + : (function (prevBeforeFn) { + return function () { + prevBeforeFn(); + fn(); + }; + })(prevBeforeFn); + } + + function it(name, test) { + var fullName = description.join(' > ') + ' ' + name; + ( + tests[fullName] || + (tests[fullName] = { + description: fullName, + tests: [], + }) + ).tests[version] = { + before: beforeFn, + test: test, + }; + } + + vm.runInNewContext( + source.source, + { + describe: describe, + it: it, + beforeEach: beforeEach, + console: console, + Immutable: Immutable, + }, + source.path + ); + }); + }); + + // Array<{ + // description: String, + // tests: Array<{ + // before: Function, + // test: Function + // }> // one per module, [new,old] or just [new] + // }> + return Object.keys(tests).map(function (key) { + return tests[key]; + }); + }); + }) + .then(function (tests) { + var suites = []; + + tests.forEach(function (test) { + var suite = new Benchmark.Suite(test.description, { + onStart: function (event) { + console.log(event.currentTarget.name.bold); + process.stdout.write(' ...running... '.gray); + }, + onComplete: function (event) { + process.stdout.write('\r\x1B[K'); + var stats = Array.prototype.map.call( + event.currentTarget, + function (target) { + return target.stats; + } + ); + + function pad(n, s) { + return Array(Math.max(0, 1 + n - s.length)).join(' ') + s; + } + + function fmt(b) { + return Math.floor(b) + .toString() + .replace(/\B(?=(\d{3})+(?!\d))/g, ','); + } + + function pct(p) { + return Math.floor(p * 10000) / 100 + '%'; + } + + var dualRuns = stats.length === 2; + + if (dualRuns) { + var prevMean = 1 / stats[1].mean; + // var prevLow = 1 / (stats[1].mean + stats[1].deviation * 2); + // var prevHigh = 1 / (stats[1].mean - stats[1].deviation * 2); + + // console.log( + // (dualRuns ? ' Old: '.bold.gray : ' ') + + // ( + // pad(9, fmt(prevLow)) + ' ' + + // pad(9, fmt(prevMean)) + ' ' + + // pad(9, fmt(prevHigh)) + ' ops/sec' + // ) + // ); + + var prevLowmoe = 1 / (stats[1].mean + stats[1].moe); + var prevHighmoe = 1 / (stats[1].mean - stats[1].moe); + + console.log( + (dualRuns ? ' Old: '.bold.gray : ' ') + + (pad(9, fmt(prevLowmoe)) + + ' ' + + pad(9, fmt(prevMean)) + + ' ' + + pad(9, fmt(prevHighmoe)) + + ' ops/sec') + ); + } + + var mean = 1 / stats[0].mean; + // var low = 1 / (stats[0].mean + stats[0].deviation * 2); + // var high = 1 / (stats[0].mean - stats[0].deviation * 2); + + // console.log( + // (dualRuns ? ' New: '.bold.gray : ' ') + + // ( + // pad(9, fmt(low)) + ' ' + + // pad(9, fmt(mean)) + ' ' + + // pad(9, fmt(high)) + ' ops/sec' + // ) + // ); + + var lowmoe = 1 / (stats[0].mean + stats[0].moe); + var highmoe = 1 / (stats[0].mean - stats[0].moe); + + console.log( + (dualRuns ? ' New: '.bold.gray : ' ') + + (pad(9, fmt(lowmoe)) + + ' ' + + pad(9, fmt(mean)) + + ' ' + + pad(9, fmt(highmoe)) + + ' ops/sec') + ); + + if (dualRuns) { + var diffMean = (mean - prevMean) / prevMean; + + var comparison = event.currentTarget[1].compare( + event.currentTarget[0] + ); + var comparison2 = event.currentTarget[0].compare( + event.currentTarget[1] + ); + console.log(' compare: ' + comparison + ' ' + comparison2); + + console.log(' diff: ' + pct(diffMean)); + + function sq(p) { + return p * p; + } + + var rme = Math.sqrt( + (sq(stats[0].rme / 100) + sq(stats[1].rme / 100)) / 2 + ); + // console.log('rmeN: ' + stats[0].rme); + // console.log('rmeO: ' + stats[1].rme); + console.log(' rme: ' + pct(rme)); + } + + // console.log(stats); + }, + }); + + test.tests.forEach(function (run) { + suite.add({ + fn: run.test, + onStart: run.before, + onCycle: run.before, + }); + }); + + suites.push(suite); + }); + + var onBenchComplete; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + var promise = new Promise(function (_resolve) { + onBenchComplete = _resolve; + }); + + Benchmark.invoke(suites, 'run', { onComplete: onBenchComplete }); + + return onBenchComplete; + }) + .then(function () { + console.log('all done'); + }) + .catch(function (error) { + console.log('ugh', error.stack); + }); diff --git a/resources/check-build-output.mjs b/resources/check-build-output.mjs new file mode 100644 index 0000000000..1cfffc5b84 --- /dev/null +++ b/resources/check-build-output.mjs @@ -0,0 +1,45 @@ +import fs from 'node:fs'; +import path from 'node:path'; + +const packageJsonContent = JSON.parse(fs.readFileSync('package.json', 'utf8')); + +// remove "dist/" prefix from the file names +const distPrefix = 'dist'; +const removeDistPrefix = (file) => path.basename(file); + +const expectedFiles = [ + removeDistPrefix(packageJsonContent.main), + removeDistPrefix(packageJsonContent.module), + removeDistPrefix(packageJsonContent.types), + + // extra files that are not in package.json + 'immutable.min.js', + 'immutable.js.flow', +]; + +console.log('expected files: ', expectedFiles); + +const filesInDistDir = fs + .readdirSync(distPrefix) + .filter((file) => !file.startsWith('.')); + +// There should be no extra files in the dist directory and all expected files should be present +const extraFiles = filesInDistDir.filter( + (file) => !expectedFiles.includes(file) +); +if (extraFiles.length > 0) { + console.error('Extra files found in dist directory:', extraFiles); +} + +const missingFiles = expectedFiles.filter( + (file) => !filesInDistDir.includes(file) +); +if (missingFiles.length > 0) { + console.error('Missing files in dist directory:', missingFiles); +} + +if (extraFiles.length > 0 || missingFiles.length > 0) { + process.exit(1); +} + +console.log('All expected files are present in the dist directory.'); diff --git a/resources/check-git-clean.sh b/resources/check-git-clean.sh new file mode 100755 index 0000000000..3ea73552f8 --- /dev/null +++ b/resources/check-git-clean.sh @@ -0,0 +1,13 @@ +#!/bin/bash -e + +if ! git diff --quiet; then echo " + +$(tput setf 4)The CI build resulted in additional changed files. +Typically this is due to not running $(tput smul)npm test$(tput rmul) locally before +submitting a pull request. + +The following changes were found:$(tput sgr0) +"; + + git diff --exit-code; +fi; diff --git a/resources/copyright.mjs b/resources/copyright.mjs new file mode 100644 index 0000000000..7323639f46 --- /dev/null +++ b/resources/copyright.mjs @@ -0,0 +1,8 @@ +import fs from 'fs'; + +const copyright = fs.readFileSync('./LICENSE', 'utf-8'); +const lines = copyright.trim().split('\n'); + +export default `/**\n * @license\n${lines + .map((line) => ` * ${line}`) + .join('\n')}\n */`; diff --git a/resources/declassify.js b/resources/declassify.js deleted file mode 100644 index e216b694a9..0000000000 --- a/resources/declassify.js +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -var acorn = require('acorn'); -var estraverse = require('estraverse'); -var MagicString = require('magic-string'); - -/** - * ES6 Class transpiler woefully lacking in features. Overwhelming priority to - * produce the smallest reasonable source code. - * - * Clowntown: - * - * * Members are assigned directly to prototype instead of defined as - * properties. - * - * * Class Expressions only work when prefixed by an export declaration - * - */ -function declassify(source) { - if (!/\bclass\b/.test(source)) { - return source; - } - - var body = new MagicString(source); - - var ast = acorn.parse(source, { - ecmaVersion: 6, - locations: true - }); - - var needsCreateClass; - var classInfo; - - estraverse.traverse(ast, { - enter: function (node) { - switch (node.type) { - case 'ExportDeclaration': - var declaration = node.declaration; - if (declaration.type === 'ClassExpression' || - declaration.type === 'ClassDeclaration') { - body.insert( - declaration.start, - node.default ? - declaration.id.name + ';' : - '{' + declaration.id.name + '};' - ); - } - break; - - case 'ClassExpression': - case 'ClassDeclaration': - var className = node.id.name; - - classInfo = { - name: className, - prev: classInfo, - }; - - var classExpr = ''; - - var hasSuper = !!node.superClass; - if (hasSuper) { - needsCreateClass = true; - var superExpr = body.slice(node.superClass.start, node.superClass.end); - classExpr += 'createClass(' + className + ', ' + superExpr + ');'; - } - - var hasConstructor = node.body.body.some(function (method) { - return method.type === 'MethodDefinition' && - method.key.name === 'constructor'; - }); - if (!hasConstructor) { - classExpr += 'function ' + className + '() {}'; - } - - body.overwrite(node.start, node.body.start, classExpr); - - // remove { } around class body - body.remove(node.body.start, node.body.start + 1); - body.remove(node.body.end - 1, node.body.end); - break; - - case 'MethodDefinition': - if (node.key.name === 'constructor') { - body.overwrite( - node.key.start, - node.key.end, - 'function ' + classInfo.name - ); - } else { - var methodName = node.key.name; - body.overwrite( - node.start, - node.key.end, - classInfo.name + (node.static ? '.' : '.prototype.') + - methodName + ' = function' - ); - body.insert(node.end, ';'); - } - break; - - case 'CallExpression': - if ( - (node.callee.type === 'Identifier' && node.callee.name === 'super') || - (node.callee.type === 'MemberExpression' && node.callee.object.name === 'super') - ) { - throw new Error('super not supported'); - } - break; - } - }, - leave: function(node) { - switch (node.type) { - case 'ClassExpression': - case 'ClassDeclaration': - classInfo = classInfo.prev; - break; - } - } - }); - - if (needsCreateClass) { - body.prepend('import createClass from "./utils/createClass"'); - } - - return body.toString(); -} - -module.exports = declassify; diff --git a/resources/dist-stats.mjs b/resources/dist-stats.mjs new file mode 100644 index 0000000000..7c6079db38 --- /dev/null +++ b/resources/dist-stats.mjs @@ -0,0 +1,92 @@ +import fs from 'node:fs/promises'; +import { deflate } from 'zlib'; +import 'colors'; + +const VERIFY_AGAINST_VERSION = '4'; + +const deflateContent = (content) => + new Promise((resolve, reject) => + deflate(content, (error, out) => (error ? reject(error) : resolve(out))) + ); + +const space = (n, s) => + new Array(Math.max(0, 10 + n - (s || '').length)).join(' ') + (s || ''); + +const bytes = (b) => + `${b.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')} bytes`; + +const diff = (n, o) => { + const d = n - o; + return d === 0 ? '' : d < 0 ? ` ${bytes(d)}`.green : ` +${bytes(d)}`.red; +}; + +const percentage = (s, b) => ` ${Math.floor(10000 * (1 - s / b)) / 100}%`.grey; + +let bundlephobaInfoCache; + +async function bundlephobaInfo(key) { + if (!bundlephobaInfoCache) { + try { + const res = await fetch( + `https://bundlephobia.com/api/size?package=immutable@${VERIFY_AGAINST_VERSION}` + ); + + if (res.status !== 200) { + throw new Error( + `Unable to fetch bundlephobia in dist-stats.mjs. Status code is "${res.status}"` + ); + } + + bundlephobaInfoCache = await res.json(); + } catch (err) { + console.error(err.message); + + throw err; + } + } + + return bundlephobaInfoCache[key]; +} + +/** + * + * @param {PromiseFulfilledResult} promise + */ +function promiseNumberValue(promise) { + if (!promise || !promise.value) { + return null; + } + + const value = promise.value; + + return value === null || typeof value === 'number' + ? value + : Number(Buffer.byteLength(value, 'utf8')); +} + +Promise.allSettled([ + fs.readFile('dist/immutable.js'), + fs.readFile('dist/immutable.min.js'), + bundlephobaInfo('size'), + fs.readFile('dist/immutable.min.js').then(deflateContent), + bundlephobaInfo('gzip'), +]).then(([rawNew, minNew, minOld, zipNew, zipOld]) => { + console.log(` Raw: ${space(14, bytes(promiseNumberValue(rawNew)).cyan)}`); + if (minOld.status === 'fulfilled') { + console.log( + ` Min: ${space(14, bytes(promiseNumberValue(minNew)).cyan)}${percentage( + minNew.value, + rawNew.value + )}${space(15, diff(promiseNumberValue(minNew), promiseNumberValue(minOld)))}` + ); + } + + if (zipOld.status === 'fulfilled') { + console.log( + ` Zip: ${space(14, bytes(promiseNumberValue(zipNew)).cyan)}${percentage( + promiseNumberValue(zipNew), + promiseNumberValue(rawNew) + )}${space(15, diff(promiseNumberValue(zipNew), promiseNumberValue(zipOld)))}` + ); + } +}); diff --git a/resources/identity.svg b/resources/identity.svg new file mode 100644 index 0000000000..b363971cef --- /dev/null +++ b/resources/identity.svg @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/immutable-global.js b/resources/immutable-global.js deleted file mode 100644 index 1b3cbe3ec0..0000000000 --- a/resources/immutable-global.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = global.Immutable; diff --git a/resources/jest b/resources/jest deleted file mode 100755 index 711ecb52df..0000000000 --- a/resources/jest +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -if [[ $TRAVIS ]]; then jest --no-cache -i; else jest --no-cache; fi; diff --git a/resources/jest.d.ts b/resources/jest.d.ts deleted file mode 100644 index 80e8bada2c..0000000000 --- a/resources/jest.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -declare var jasmine: any; - -declare function afterEach(fn: any): any; -declare function beforeEach(fn: any): any; -declare function describe(name: string, fn: any): void; -declare var it: { - (name: string, fn: any): void; - only: (name: string, fn: any) => void; -} -declare function expect(val: any): Expect; -declare var jest: Jest; -declare function pit(name: string, fn: any): void; -declare function xdescribe(name: string, fn: any): void; -declare function xit(name: string, fn: any): void; - -interface Expect { - not: Expect - toThrow(message?: string): void - toBe(value: any): void - toEqual(value: any): void - toValueEqual(value: any): void - toBeFalsy(): void - toBeTruthy(): void - toBeNull(): void - toBeUndefined(): void - toBeDefined(): void - toMatch(regexp: RegExp): void - toContain(string: string): void - toBeCloseTo(number: number, delta: number): void - toBeGreaterThan(number: number): void - toBeLessThan(number: number): void - toBeCalled(): void - toBeCalledWith(...arguments): void - lastCalledWith(...arguments): void -} - -interface Jest { - autoMockOff(): void - autoMockOn(): void - clearAllTimers(): void - dontMock(moduleName: string): void - genMockFromModule(moduleObj: Object): Object - genMockFunction(): MockFunction - genMockFn(): MockFunction - mock(moduleName: string): void - runAllTicks(): void - runAllTimers(): void - runOnlyPendingTimers(): void - setMock(moduleName: string, moduleExports: Object): void -} - -interface MockFunction { - (...arguments): any - mock: { - calls: Array> - instances: Array - } - mockClear(): void - mockImplementation(fn: Function): MockFunction - mockImpl(fn: Function): MockFunction - mockReturnThis(): MockFunction - mockReturnValue(value: any): MockFunction - mockReturnValueOnce(value: any): MockFunction -} - -// Allow importing jasmine-check -declare module 'jasmine-check' { - export function install(global?: any): void; -} -declare var check: any; -declare var gen: any; diff --git a/resources/jestPreprocessor.js b/resources/jestPreprocessor.js index 5739a9882b..5ea6aa5036 100644 --- a/resources/jestPreprocessor.js +++ b/resources/jestPreprocessor.js @@ -1,40 +1,71 @@ var typescript = require('typescript'); -var react = require('react-tools'); +const makeSynchronous = require('make-synchronous'); -function compileTypeScript(filePath) { - var compiled; +const TYPESCRIPT_OPTIONS = { + noEmitOnError: true, + target: typescript.ScriptTarget.ES2015, + module: typescript.ModuleKind.CommonJS, + strictNullChecks: true, + sourceMap: true, + inlineSourceMap: true, +}; + +function transpileTypeScript(src, path) { + return typescript.transpile(src, TYPESCRIPT_OPTIONS, path, []); +} + +function transpileJavaScript(src, path) { + // Need to make this sync by calling `makeSynchronous` + // while https://github.com/facebook/jest/issues/9504 is not resolved + const fn = makeSynchronous(async (path) => { + const rollup = require('rollup'); + const buble = require('@rollup/plugin-buble'); + const commonjs = require('@rollup/plugin-commonjs'); + const json = require('@rollup/plugin-json'); + const typescript = require('@rollup/plugin-typescript'); + + // same input options as in rollup-config.js + const inputOptions = { + input: path, + onwarn: () => {}, + plugins: [commonjs(), json(), typescript(), buble()], + }; - var options = { - noEmitOnError: true, - target: typescript.ScriptTarget.ES2015, - module: typescript.ModuleKind.CommonJS - }; + const bundle = await rollup.rollup(inputOptions); - var host = typescript.createCompilerHost(options); - var program = typescript.createProgram([filePath], options, host); + const { output } = await bundle.generate({ + file: path, + format: 'cjs', + sourcemap: true, + }); - host.writeFile = (name, text) => compiled = text; - var emitResult = program.emit(); - var diagnostics = typescript.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); + await bundle.close(); - if (diagnostics.length === 0) { - return compiled; - } + const { code, map } = output[0]; - var report = typescript.formatDiagnostics(diagnostics, host); - throw new Error('Compiling ' + filePath + ' failed' + '\n' + report); + if (!code) { + throw new Error( + 'Unable to get code from rollup output in jestPreprocessor. Did rollup version changed ?' + ); + } + + return { code, map }; + }); + + return fn(path); } module.exports = { - process: function(src, filePath) { - if (filePath.match(/\.ts$/) && !filePath.match(/\.d\.ts$/)) { - return compileTypeScript(filePath); + process(src, path) { + if (path.endsWith('.ts') || path.endsWith('.tsx')) { + return { code: transpileTypeScript(src, path) }; } - if (filePath.match(/\.js$/) && ~filePath.indexOf('/__tests__/')) { - return react.transform(src, {harmony: true}); - } + return transpileJavaScript(src, path); + }, - return src; - } + getCacheKey() { + // ignore cache, as there is a conflict between rollup compile and jest preprocessor. + return Date.now().toString(); + }, }; diff --git a/resources/jestResolver.js b/resources/jestResolver.js new file mode 100644 index 0000000000..a379bc4421 --- /dev/null +++ b/resources/jestResolver.js @@ -0,0 +1,17 @@ +const path = require('path'); +const pkg = require('../package.json'); + +module.exports = (request, options) => { + if (request === 'immutable') { + if (process.env.CI) { + // In CI environment, test the real built file to be sure that the build is not broken + return path.resolve(options.rootDir, pkg.main); + } + + // In development mode, we want sourcemaps, live reload, etc., so point to the src/ directory + return `${options.rootDir}/src/Immutable.js`; + } + + // Call the defaultResolver, if we want to load non-immutable + return options.defaultResolver(request, options); +}; diff --git a/resources/prepare-dist.sh b/resources/prepare-dist.sh new file mode 100755 index 0000000000..d8d86a0573 --- /dev/null +++ b/resources/prepare-dist.sh @@ -0,0 +1,25 @@ +#!/bin/sh -e + +# This script prepares an npm directory with files safe to publish to npm or the +# npm git branch: +# +# "immutable": "git://github.com/immutable-js/immutable-js.git#npm" +# + +# Create empty npm directory +rm -rf npm +mkdir -p npm + +# Copy over necessary files +cp -r dist npm/ +cp README.md npm/ +cp LICENSE npm/ + +# Ensure a vanilla package.json before deploying so other tools do not interpret +# The built output as requiring any further transformation. +node -e "var package = require('./package.json'); \ + package = Object.fromEntries(Object.entries(package).filter(([key]) => package.publishKeys.includes(key))); \ + require('fs').writeFileSync('./npm/package.json', JSON.stringify(package, null, 2));" + +# Retain marginal support for bower on the npm branch +cp npm/package.json npm/bower.json diff --git a/resources/rollup-config.mjs b/resources/rollup-config.mjs new file mode 100644 index 0000000000..6963235c5d --- /dev/null +++ b/resources/rollup-config.mjs @@ -0,0 +1,47 @@ +import path from 'path'; +import buble from '@rollup/plugin-buble'; +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import terser from '@rollup/plugin-terser'; +// TODO replace @rollup/plugin-typescript with babel after babel migration +import typescript from '@rollup/plugin-typescript'; +import copyright from './copyright.mjs'; + +const SRC_DIR = path.resolve('src'); +const DIST_DIR = path.resolve('dist'); + +export default [ + { + input: path.join(SRC_DIR, 'Immutable.js'), + plugins: [commonjs(), json(), typescript(), buble()], + output: [ + // umd build + { + banner: copyright, + name: 'Immutable', + exports: 'named', + file: path.join(DIST_DIR, 'immutable.js'), + format: 'umd', + sourcemap: false, + }, + // minified build for browsers + { + banner: copyright, + name: 'Immutable', + exports: 'named', + file: path.join(DIST_DIR, 'immutable.min.js'), + format: 'umd', + sourcemap: false, + plugins: [terser()], + }, + // es build for bundlers and node + { + banner: copyright, + name: 'Immutable', + file: path.join(DIST_DIR, 'immutable.es.js'), + format: 'es', + sourcemap: false, + }, + ], + }, +]; diff --git a/resources/stripCopyright.js b/resources/stripCopyright.js deleted file mode 100644 index 39ba85defc..0000000000 --- a/resources/stripCopyright.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -var fs = require('fs'); - -function stripCopyright(source) { - var copyright = getCopyright(); - var position = source.indexOf(copyright); - if (position === -1) { - return source; - } - return source.slice(0, position) + source.slice(position + copyright.length); -} - -var _copyright; -function getCopyright() { - return _copyright || (_copyright = fs.readFileSync('resources/COPYRIGHT')); -} - -module.exports = stripCopyright; diff --git a/src/Collection.js b/src/Collection.js index a24ee4229c..650ff654ff 100644 --- a/src/Collection.js +++ b/src/Collection.js @@ -1,27 +1,36 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { Iterable } from './Iterable' - - -export class Collection extends Iterable { - constructor() { - throw TypeError('Abstract'); +import { Seq, KeyedSeq, IndexedSeq, SetSeq } from './Seq'; +import { isCollection } from './predicates/isCollection'; +import { isKeyed } from './predicates/isKeyed'; +import { isIndexed } from './predicates/isIndexed'; +import { isAssociative } from './predicates/isAssociative'; + +export class Collection { + constructor(value) { + // eslint-disable-next-line no-constructor-return + return isCollection(value) ? value : Seq(value); } } -export class KeyedCollection extends Collection {} - -export class IndexedCollection extends Collection {} +export class KeyedCollection extends Collection { + constructor(value) { + // eslint-disable-next-line no-constructor-return + return isKeyed(value) ? value : KeyedSeq(value); + } +} -export class SetCollection extends Collection {} +export class IndexedCollection extends Collection { + constructor(value) { + // eslint-disable-next-line no-constructor-return + return isIndexed(value) ? value : IndexedSeq(value); + } +} +export class SetCollection extends Collection { + constructor(value) { + // eslint-disable-next-line no-constructor-return + return isCollection(value) && !isAssociative(value) ? value : SetSeq(value); + } +} Collection.Keyed = KeyedCollection; Collection.Indexed = IndexedCollection; diff --git a/src/CollectionImpl.js b/src/CollectionImpl.js new file mode 100644 index 0000000000..befb3dadc2 --- /dev/null +++ b/src/CollectionImpl.js @@ -0,0 +1,789 @@ +import { + Collection, + KeyedCollection, + IndexedCollection, + SetCollection, +} from './Collection'; +import { IS_COLLECTION_SYMBOL } from './predicates/isCollection'; +import { isKeyed, IS_KEYED_SYMBOL } from './predicates/isKeyed'; +import { isIndexed, IS_INDEXED_SYMBOL } from './predicates/isIndexed'; +import { isOrdered, IS_ORDERED_SYMBOL } from './predicates/isOrdered'; +import { is } from './is'; +import { + NOT_SET, + ensureSize, + wrapIndex, + returnTrue, + resolveBegin, +} from './TrieUtils'; +import { hash } from './Hash'; +import { imul, smi } from './Math'; +import { + Iterator, + ITERATOR_SYMBOL, + ITERATE_KEYS, + ITERATE_VALUES, + ITERATE_ENTRIES, +} from './Iterator'; + +import arrCopy from './utils/arrCopy'; +import assertNotInfinite from './utils/assertNotInfinite'; +import deepEqual from './utils/deepEqual'; +import mixin from './utils/mixin'; +import quoteString from './utils/quoteString'; + +import { toJS } from './toJS'; +import { Map } from './Map'; +import { OrderedMap } from './OrderedMap'; +import { List } from './List'; +import { Set } from './Set'; +import { OrderedSet } from './OrderedSet'; +import { Stack } from './Stack'; +import { Range } from './Range'; +import { KeyedSeq, IndexedSeq, SetSeq, ArraySeq } from './Seq'; +import { + reify, + ToKeyedSequence, + ToIndexedSequence, + ToSetSequence, + FromEntriesSequence, + flipFactory, + mapFactory, + reverseFactory, + filterFactory, + countByFactory, + groupByFactory, + sliceFactory, + takeWhileFactory, + skipWhileFactory, + concatFactory, + flattenFactory, + flatMapFactory, + interposeFactory, + sortFactory, + maxFactory, + zipWithFactory, + partitionFactory, +} from './Operations'; +import { getIn } from './methods/getIn'; +import { hasIn } from './methods/hasIn'; +import { toObject } from './methods/toObject'; + +export { Collection, CollectionPrototype, IndexedCollectionPrototype }; + +Collection.Iterator = Iterator; + +mixin(Collection, { + // ### Conversion to other types + + toArray() { + assertNotInfinite(this.size); + const array = new Array(this.size || 0); + const useTuples = isKeyed(this); + let i = 0; + this.__iterate((v, k) => { + // Keyed collections produce an array of tuples. + array[i++] = useTuples ? [k, v] : v; + }); + return array; + }, + + toIndexedSeq() { + return new ToIndexedSequence(this); + }, + + toJS() { + return toJS(this); + }, + + toKeyedSeq() { + return new ToKeyedSequence(this, true); + }, + + toMap() { + // Use Late Binding here to solve the circular dependency. + return Map(this.toKeyedSeq()); + }, + + toObject: toObject, + + toOrderedMap() { + // Use Late Binding here to solve the circular dependency. + return OrderedMap(this.toKeyedSeq()); + }, + + toOrderedSet() { + // Use Late Binding here to solve the circular dependency. + return OrderedSet(isKeyed(this) ? this.valueSeq() : this); + }, + + toSet() { + // Use Late Binding here to solve the circular dependency. + return Set(isKeyed(this) ? this.valueSeq() : this); + }, + + toSetSeq() { + return new ToSetSequence(this); + }, + + toSeq() { + return isIndexed(this) + ? this.toIndexedSeq() + : isKeyed(this) + ? this.toKeyedSeq() + : this.toSetSeq(); + }, + + toStack() { + // Use Late Binding here to solve the circular dependency. + return Stack(isKeyed(this) ? this.valueSeq() : this); + }, + + toList() { + // Use Late Binding here to solve the circular dependency. + return List(isKeyed(this) ? this.valueSeq() : this); + }, + + // ### Common JavaScript methods and properties + + toString() { + return '[Collection]'; + }, + + __toString(head, tail) { + if (this.size === 0) { + return head + tail; + } + return ( + head + + ' ' + + this.toSeq().map(this.__toStringMapper).join(', ') + + ' ' + + tail + ); + }, + + // ### ES6 Collection methods (ES6 Array and Map) + + concat(...values) { + return reify(this, concatFactory(this, values)); + }, + + includes(searchValue) { + return this.some((value) => is(value, searchValue)); + }, + + entries() { + return this.__iterator(ITERATE_ENTRIES); + }, + + every(predicate, context) { + assertNotInfinite(this.size); + let returnValue = true; + this.__iterate((v, k, c) => { + if (!predicate.call(context, v, k, c)) { + returnValue = false; + return false; + } + }); + return returnValue; + }, + + filter(predicate, context) { + return reify(this, filterFactory(this, predicate, context, true)); + }, + + partition(predicate, context) { + return partitionFactory(this, predicate, context); + }, + + find(predicate, context, notSetValue) { + const entry = this.findEntry(predicate, context); + return entry ? entry[1] : notSetValue; + }, + + forEach(sideEffect, context) { + assertNotInfinite(this.size); + return this.__iterate(context ? sideEffect.bind(context) : sideEffect); + }, + + join(separator) { + assertNotInfinite(this.size); + separator = separator !== undefined ? '' + separator : ','; + let joined = ''; + let isFirst = true; + this.__iterate((v) => { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + isFirst ? (isFirst = false) : (joined += separator); + joined += v !== null && v !== undefined ? v.toString() : ''; + }); + return joined; + }, + + keys() { + return this.__iterator(ITERATE_KEYS); + }, + + map(mapper, context) { + return reify(this, mapFactory(this, mapper, context)); + }, + + reduce(reducer, initialReduction, context) { + return reduce( + this, + reducer, + initialReduction, + context, + arguments.length < 2, + false + ); + }, + + reduceRight(reducer, initialReduction, context) { + return reduce( + this, + reducer, + initialReduction, + context, + arguments.length < 2, + true + ); + }, + + reverse() { + return reify(this, reverseFactory(this, true)); + }, + + slice(begin, end) { + return reify(this, sliceFactory(this, begin, end, true)); + }, + + some(predicate, context) { + assertNotInfinite(this.size); + let returnValue = false; + this.__iterate((v, k, c) => { + if (predicate.call(context, v, k, c)) { + returnValue = true; + return false; + } + }); + return returnValue; + }, + + sort(comparator) { + return reify(this, sortFactory(this, comparator)); + }, + + values() { + return this.__iterator(ITERATE_VALUES); + }, + + // ### More sequential methods + + butLast() { + return this.slice(0, -1); + }, + + isEmpty() { + return this.size !== undefined ? this.size === 0 : !this.some(() => true); + }, + + count(predicate, context) { + return ensureSize( + predicate ? this.toSeq().filter(predicate, context) : this + ); + }, + + countBy(grouper, context) { + return countByFactory(this, grouper, context); + }, + + equals(other) { + return deepEqual(this, other); + }, + + entrySeq() { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const collection = this; + if (collection._cache) { + // We cache as an entries array, so we can just return the cache! + return new ArraySeq(collection._cache); + } + const entriesSequence = collection.toSeq().map(entryMapper).toIndexedSeq(); + entriesSequence.fromEntrySeq = () => collection.toSeq(); + return entriesSequence; + }, + + filterNot(predicate, context) { + return this.filter(not(predicate), context); + }, + + findEntry(predicate, context, notSetValue) { + let found = notSetValue; + this.__iterate((v, k, c) => { + if (predicate.call(context, v, k, c)) { + found = [k, v]; + return false; + } + }); + return found; + }, + + findKey(predicate, context) { + const entry = this.findEntry(predicate, context); + return entry && entry[0]; + }, + + findLast(predicate, context, notSetValue) { + return this.toKeyedSeq().reverse().find(predicate, context, notSetValue); + }, + + findLastEntry(predicate, context, notSetValue) { + return this.toKeyedSeq() + .reverse() + .findEntry(predicate, context, notSetValue); + }, + + findLastKey(predicate, context) { + return this.toKeyedSeq().reverse().findKey(predicate, context); + }, + + first(notSetValue) { + return this.find(returnTrue, null, notSetValue); + }, + + flatMap(mapper, context) { + return reify(this, flatMapFactory(this, mapper, context)); + }, + + flatten(depth) { + return reify(this, flattenFactory(this, depth, true)); + }, + + fromEntrySeq() { + return new FromEntriesSequence(this); + }, + + get(searchKey, notSetValue) { + return this.find((_, key) => is(key, searchKey), undefined, notSetValue); + }, + + getIn: getIn, + + groupBy(grouper, context) { + return groupByFactory(this, grouper, context); + }, + + has(searchKey) { + return this.get(searchKey, NOT_SET) !== NOT_SET; + }, + + hasIn: hasIn, + + isSubset(iter) { + iter = typeof iter.includes === 'function' ? iter : Collection(iter); + return this.every((value) => iter.includes(value)); + }, + + isSuperset(iter) { + iter = typeof iter.isSubset === 'function' ? iter : Collection(iter); + return iter.isSubset(this); + }, + + keyOf(searchValue) { + return this.findKey((value) => is(value, searchValue)); + }, + + keySeq() { + return this.toSeq().map(keyMapper).toIndexedSeq(); + }, + + last(notSetValue) { + return this.toSeq().reverse().first(notSetValue); + }, + + lastKeyOf(searchValue) { + return this.toKeyedSeq().reverse().keyOf(searchValue); + }, + + max(comparator) { + return maxFactory(this, comparator); + }, + + maxBy(mapper, comparator) { + return maxFactory(this, comparator, mapper); + }, + + min(comparator) { + return maxFactory( + this, + comparator ? neg(comparator) : defaultNegComparator + ); + }, + + minBy(mapper, comparator) { + return maxFactory( + this, + comparator ? neg(comparator) : defaultNegComparator, + mapper + ); + }, + + rest() { + return this.slice(1); + }, + + skip(amount) { + return amount === 0 ? this : this.slice(Math.max(0, amount)); + }, + + skipLast(amount) { + return amount === 0 ? this : this.slice(0, -Math.max(0, amount)); + }, + + skipWhile(predicate, context) { + return reify(this, skipWhileFactory(this, predicate, context, true)); + }, + + skipUntil(predicate, context) { + return this.skipWhile(not(predicate), context); + }, + + sortBy(mapper, comparator) { + return reify(this, sortFactory(this, comparator, mapper)); + }, + + take(amount) { + return this.slice(0, Math.max(0, amount)); + }, + + takeLast(amount) { + return this.slice(-Math.max(0, amount)); + }, + + takeWhile(predicate, context) { + return reify(this, takeWhileFactory(this, predicate, context)); + }, + + takeUntil(predicate, context) { + return this.takeWhile(not(predicate), context); + }, + + update(fn) { + return fn(this); + }, + + valueSeq() { + return this.toIndexedSeq(); + }, + + // ### Hashable Object + + hashCode() { + return this.__hash || (this.__hash = hashCollection(this)); + }, + + // ### Internal + + // abstract __iterate(fn, reverse) + + // abstract __iterator(type, reverse) +}); + +const CollectionPrototype = Collection.prototype; +CollectionPrototype[IS_COLLECTION_SYMBOL] = true; +CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values; +CollectionPrototype.toJSON = CollectionPrototype.toArray; +CollectionPrototype.__toStringMapper = quoteString; +CollectionPrototype.inspect = CollectionPrototype.toSource = function () { + return this.toString(); +}; +CollectionPrototype.chain = CollectionPrototype.flatMap; +CollectionPrototype.contains = CollectionPrototype.includes; + +mixin(KeyedCollection, { + // ### More sequential methods + + flip() { + return reify(this, flipFactory(this)); + }, + + mapEntries(mapper, context) { + let iterations = 0; + return reify( + this, + this.toSeq() + .map((v, k) => mapper.call(context, [k, v], iterations++, this)) + .fromEntrySeq() + ); + }, + + mapKeys(mapper, context) { + return reify( + this, + this.toSeq() + .flip() + .map((k, v) => mapper.call(context, k, v, this)) + .flip() + ); + }, +}); + +const KeyedCollectionPrototype = KeyedCollection.prototype; +KeyedCollectionPrototype[IS_KEYED_SYMBOL] = true; +KeyedCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.entries; +KeyedCollectionPrototype.toJSON = toObject; +KeyedCollectionPrototype.__toStringMapper = (v, k) => + quoteString(k) + ': ' + quoteString(v); + +mixin(IndexedCollection, { + // ### Conversion to other types + + toKeyedSeq() { + return new ToKeyedSequence(this, false); + }, + + // ### ES6 Collection methods (ES6 Array and Map) + + filter(predicate, context) { + return reify(this, filterFactory(this, predicate, context, false)); + }, + + findIndex(predicate, context) { + const entry = this.findEntry(predicate, context); + return entry ? entry[0] : -1; + }, + + indexOf(searchValue) { + const key = this.keyOf(searchValue); + return key === undefined ? -1 : key; + }, + + lastIndexOf(searchValue) { + const key = this.lastKeyOf(searchValue); + return key === undefined ? -1 : key; + }, + + reverse() { + return reify(this, reverseFactory(this, false)); + }, + + slice(begin, end) { + return reify(this, sliceFactory(this, begin, end, false)); + }, + + splice(index, removeNum /*, ...values*/) { + const numArgs = arguments.length; + removeNum = Math.max(removeNum || 0, 0); + if (numArgs === 0 || (numArgs === 2 && !removeNum)) { + return this; + } + // If index is negative, it should resolve relative to the size of the + // collection. However size may be expensive to compute if not cached, so + // only call count() if the number is in fact negative. + index = resolveBegin(index, index < 0 ? this.count() : this.size); + const spliced = this.slice(0, index); + return reify( + this, + numArgs === 1 + ? spliced + : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)) + ); + }, + + // ### More collection methods + + findLastIndex(predicate, context) { + const entry = this.findLastEntry(predicate, context); + return entry ? entry[0] : -1; + }, + + first(notSetValue) { + return this.get(0, notSetValue); + }, + + flatten(depth) { + return reify(this, flattenFactory(this, depth, false)); + }, + + get(index, notSetValue) { + index = wrapIndex(this, index); + return index < 0 || + this.size === Infinity || + (this.size !== undefined && index > this.size) + ? notSetValue + : this.find((_, key) => key === index, undefined, notSetValue); + }, + + has(index) { + index = wrapIndex(this, index); + return ( + index >= 0 && + (this.size !== undefined + ? this.size === Infinity || index < this.size + : this.indexOf(index) !== -1) + ); + }, + + interpose(separator) { + return reify(this, interposeFactory(this, separator)); + }, + + interleave(/*...collections*/) { + const collections = [this].concat(arrCopy(arguments)); + const zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, collections); + const interleaved = zipped.flatten(true); + if (zipped.size) { + interleaved.size = zipped.size * collections.length; + } + return reify(this, interleaved); + }, + + keySeq() { + return Range(0, this.size); + }, + + last(notSetValue) { + return this.get(-1, notSetValue); + }, + + skipWhile(predicate, context) { + return reify(this, skipWhileFactory(this, predicate, context, false)); + }, + + zip(/*, ...collections */) { + const collections = [this].concat(arrCopy(arguments)); + return reify(this, zipWithFactory(this, defaultZipper, collections)); + }, + + zipAll(/*, ...collections */) { + const collections = [this].concat(arrCopy(arguments)); + return reify(this, zipWithFactory(this, defaultZipper, collections, true)); + }, + + zipWith(zipper /*, ...collections */) { + const collections = arrCopy(arguments); + collections[0] = this; + return reify(this, zipWithFactory(this, zipper, collections)); + }, +}); + +const IndexedCollectionPrototype = IndexedCollection.prototype; +IndexedCollectionPrototype[IS_INDEXED_SYMBOL] = true; +IndexedCollectionPrototype[IS_ORDERED_SYMBOL] = true; + +mixin(SetCollection, { + // ### ES6 Collection methods (ES6 Array and Map) + + get(value, notSetValue) { + return this.has(value) ? value : notSetValue; + }, + + includes(value) { + return this.has(value); + }, + + // ### More sequential methods + + keySeq() { + return this.valueSeq(); + }, +}); + +const SetCollectionPrototype = SetCollection.prototype; +SetCollectionPrototype.has = CollectionPrototype.includes; +SetCollectionPrototype.contains = SetCollectionPrototype.includes; +SetCollectionPrototype.keys = SetCollectionPrototype.values; + +// Mixin subclasses + +mixin(KeyedSeq, KeyedCollectionPrototype); +mixin(IndexedSeq, IndexedCollectionPrototype); +mixin(SetSeq, SetCollectionPrototype); + +// #pragma Helper functions + +function reduce(collection, reducer, reduction, context, useFirst, reverse) { + assertNotInfinite(collection.size); + collection.__iterate((v, k, c) => { + if (useFirst) { + useFirst = false; + reduction = v; + } else { + reduction = reducer.call(context, reduction, v, k, c); + } + }, reverse); + return reduction; +} + +function keyMapper(v, k) { + return k; +} + +function entryMapper(v, k) { + return [k, v]; +} + +function not(predicate) { + return function () { + return !predicate.apply(this, arguments); + }; +} + +function neg(predicate) { + return function () { + return -predicate.apply(this, arguments); + }; +} + +function defaultZipper() { + return arrCopy(arguments); +} + +function defaultNegComparator(a, b) { + return a < b ? 1 : a > b ? -1 : 0; +} + +function hashCollection(collection) { + if (collection.size === Infinity) { + return 0; + } + const ordered = isOrdered(collection); + const keyed = isKeyed(collection); + let h = ordered ? 1 : 0; + + collection.__iterate( + keyed + ? ordered + ? (v, k) => { + h = (31 * h + hashMerge(hash(v), hash(k))) | 0; + } + : (v, k) => { + h = (h + hashMerge(hash(v), hash(k))) | 0; + } + : ordered + ? (v) => { + h = (31 * h + hash(v)) | 0; + } + : (v) => { + h = (h + hash(v)) | 0; + } + ); + + return murmurHashOfSize(collection.size, h); +} + +function murmurHashOfSize(size, h) { + h = imul(h, 0xcc9e2d51); + h = imul((h << 15) | (h >>> -15), 0x1b873593); + h = imul((h << 13) | (h >>> -13), 5); + h = ((h + 0xe6546b64) | 0) ^ size; + h = imul(h ^ (h >>> 16), 0x85ebca6b); + h = imul(h ^ (h >>> 13), 0xc2b2ae35); + h = smi(h ^ (h >>> 16)); + return h; +} + +function hashMerge(a, b) { + return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int +} diff --git a/src/Hash.js b/src/Hash.js index 14f3803d50..d1c65f7978 100644 --- a/src/Hash.js +++ b/src/Hash.js @@ -1,69 +1,82 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ +import { smi } from './Math'; -import { smi } from './Math' +const defaultValueOf = Object.prototype.valueOf; export function hash(o) { - if (o === false || o === null || o === undefined) { - return 0; - } - if (typeof o.valueOf === 'function') { - o = o.valueOf(); - if (o === false || o === null || o === undefined) { - return 0; - } - } - if (o === true) { - return 1; - } - var type = typeof o; - if (type === 'number') { - if (o !== o || o === Infinity) { - return 0; - } - var h = o | 0; - if (h !== o) { - h ^= o * 0xFFFFFFFF; - } - while (o > 0xFFFFFFFF) { - o /= 0xFFFFFFFF; - h ^= o; - } - return smi(h); - } - if (type === 'string') { - return o.length > STRING_HASH_CACHE_MIN_STRLEN ? cachedHashString(o) : hashString(o); + // eslint-disable-next-line eqeqeq + if (o == null) { + return hashNullish(o); } + if (typeof o.hashCode === 'function') { - return o.hashCode(); + // Drop any high bits from accidentally long hash codes. + return smi(o.hashCode(o)); + } + + const v = valueOf(o); + + // eslint-disable-next-line eqeqeq + if (v == null) { + return hashNullish(v); + } + + switch (typeof v) { + case 'boolean': + // The hash values for built-in constants are a 1 value for each 5-byte + // shift region expect for the first, which encodes the value. This + // reduces the odds of a hash collision for these common values. + return v ? 0x42108421 : 0x42108420; + case 'number': + return hashNumber(v); + case 'string': + return v.length > STRING_HASH_CACHE_MIN_STRLEN + ? cachedHashString(v) + : hashString(v); + case 'object': + case 'function': + return hashJSObj(v); + case 'symbol': + return hashSymbol(v); + default: + if (typeof v.toString === 'function') { + return hashString(v.toString()); + } + throw new Error('Value type ' + typeof v + ' cannot be hashed.'); + } +} + +function hashNullish(nullish) { + return nullish === null ? 0x42108422 : /* undefined */ 0x42108423; +} + +// Compress arbitrarily large numbers into smi hashes. +function hashNumber(n) { + if (n !== n || n === Infinity) { + return 0; } - if (type === 'object') { - return hashJSObj(o); + let hash = n | 0; + if (hash !== n) { + hash ^= n * 0xffffffff; } - if (typeof o.toString === 'function') { - return hashString(o.toString()); + while (n > 0xffffffff) { + n /= 0xffffffff; + hash ^= n; } - throw new Error('Value type ' + type + ' cannot be hashed.'); + return smi(hash); } function cachedHashString(string) { - var hash = stringHashCache[string]; - if (hash === undefined) { - hash = hashString(string); + let hashed = stringHashCache[string]; + if (hashed === undefined) { + hashed = hashString(string); if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) { STRING_HASH_CACHE_SIZE = 0; stringHashCache = {}; } STRING_HASH_CACHE_SIZE++; - stringHashCache[string] = hash; + stringHashCache[string] = hashed; } - return hash; + return hashed; } // http://jsperf.com/hashing-strings @@ -74,90 +87,106 @@ function hashString(string) { // where s[i] is the ith character of the string and n is the length of // the string. We "mod" the result to make it between 0 (inclusive) and 2^31 // (exclusive) by dropping high bits. - var hash = 0; - for (var ii = 0; ii < string.length; ii++) { - hash = 31 * hash + string.charCodeAt(ii) | 0; + let hashed = 0; + for (let ii = 0; ii < string.length; ii++) { + hashed = (31 * hashed + string.charCodeAt(ii)) | 0; } - return smi(hash); + return smi(hashed); +} + +function hashSymbol(sym) { + let hashed = symbolMap[sym]; + if (hashed !== undefined) { + return hashed; + } + + hashed = nextHash(); + + symbolMap[sym] = hashed; + + return hashed; } function hashJSObj(obj) { - var hash; + let hashed; if (usingWeakMap) { - hash = weakMap.get(obj); - if (hash !== undefined) { - return hash; + hashed = weakMap.get(obj); + if (hashed !== undefined) { + return hashed; } } - hash = obj[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; + hashed = obj[UID_HASH_KEY]; + if (hashed !== undefined) { + return hashed; } if (!canDefineProperty) { - hash = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; - if (hash !== undefined) { - return hash; + hashed = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY]; + if (hashed !== undefined) { + return hashed; } - hash = getIENodeHash(obj); - if (hash !== undefined) { - return hash; + hashed = getIENodeHash(obj); + if (hashed !== undefined) { + return hashed; } } - hash = ++objHashUID; - if (objHashUID & 0x40000000) { - objHashUID = 0; - } + hashed = nextHash(); if (usingWeakMap) { - weakMap.set(obj, hash); + weakMap.set(obj, hashed); } else if (isExtensible !== undefined && isExtensible(obj) === false) { throw new Error('Non-extensible objects are not allowed as keys.'); } else if (canDefineProperty) { Object.defineProperty(obj, UID_HASH_KEY, { - 'enumerable': false, - 'configurable': false, - 'writable': false, - 'value': hash + enumerable: false, + configurable: false, + writable: false, + value: hashed, }); - } else if (obj.propertyIsEnumerable !== undefined && - obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable) { + } else if ( + obj.propertyIsEnumerable !== undefined && + obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable + ) { // Since we can't define a non-enumerable property on the object // we'll hijack one of the less-used non-enumerable properties to // save our hash on it. Since this is a function it will not show up in // `JSON.stringify` which is what we want. - obj.propertyIsEnumerable = function() { - return this.constructor.prototype.propertyIsEnumerable.apply(this, arguments); + obj.propertyIsEnumerable = function () { + return this.constructor.prototype.propertyIsEnumerable.apply( + this, + arguments + ); }; - obj.propertyIsEnumerable[UID_HASH_KEY] = hash; + obj.propertyIsEnumerable[UID_HASH_KEY] = hashed; } else if (obj.nodeType !== undefined) { // At this point we couldn't get the IE `uniqueID` to use as a hash // and we couldn't use a non-enumerable property to exploit the // dontEnum bug so we simply add the `UID_HASH_KEY` on the node // itself. - obj[UID_HASH_KEY] = hash; + obj[UID_HASH_KEY] = hashed; } else { throw new Error('Unable to set a non-enumerable property on object.'); } - return hash; + return hashed; } // Get references to ES5 object methods. -var isExtensible = Object.isExtensible; +const isExtensible = Object.isExtensible; // True if Object.defineProperty works as expected. IE8 fails this test. -var canDefineProperty = (function() { +const canDefineProperty = (function () { try { Object.defineProperty({}, '@', {}); return true; + // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (e) { return false; } -}()); +})(); // IE has a `uniqueID` property on DOM nodes. We can construct the hash from it // and avoid memory leaks from the IE cloneNode bug. @@ -172,21 +201,37 @@ function getIENodeHash(node) { } } +function valueOf(obj) { + return obj.valueOf !== defaultValueOf && typeof obj.valueOf === 'function' + ? obj.valueOf(obj) + : obj; +} + +function nextHash() { + const nextHash = ++_objHashUID; + if (_objHashUID & 0x40000000) { + _objHashUID = 0; + } + return nextHash; +} + // If possible, use a WeakMap. -var usingWeakMap = typeof WeakMap === 'function'; -var weakMap; +const usingWeakMap = typeof WeakMap === 'function'; +let weakMap; if (usingWeakMap) { weakMap = new WeakMap(); } -var objHashUID = 0; +const symbolMap = Object.create(null); + +let _objHashUID = 0; -var UID_HASH_KEY = '__immutablehash__'; +let UID_HASH_KEY = '__immutablehash__'; if (typeof Symbol === 'function') { UID_HASH_KEY = Symbol(UID_HASH_KEY); } -var STRING_HASH_CACHE_MIN_STRLEN = 16; -var STRING_HASH_CACHE_MAX_SIZE = 255; -var STRING_HASH_CACHE_SIZE = 0; -var stringHashCache = {}; +const STRING_HASH_CACHE_MIN_STRLEN = 16; +const STRING_HASH_CACHE_MAX_SIZE = 255; +let STRING_HASH_CACHE_SIZE = 0; +let stringHashCache = {}; diff --git a/src/Immutable.js b/src/Immutable.js index 3d2c110417..98945f762e 100644 --- a/src/Immutable.js +++ b/src/Immutable.js @@ -1,69 +1,103 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ +import { Seq } from './Seq'; +import { OrderedMap } from './OrderedMap'; +import { List } from './List'; +import { Map } from './Map'; +import { Stack } from './Stack'; +import { OrderedSet } from './OrderedSet'; +import { PairSorting } from './PairSorting'; +import { Set } from './Set'; +import { Record } from './Record'; +import { Range } from './Range'; +import { Repeat } from './Repeat'; +import { is } from './is'; +import { fromJS } from './fromJS'; -import { Seq } from './Seq' -import { Collection } from './Collection' -import { OrderedMap } from './OrderedMap' -import { List } from './List' -import { Map } from './Map' -import { Stack } from './Stack' -import { OrderedSet } from './OrderedSet' -import { Set } from './Set' -import { Record } from './Record' -import { Range } from './Range' -import { Repeat } from './Repeat' -import { is } from './is' -import { fromJS } from './fromJS' -import { Iterable } from './IterableImpl' -import { hash } from './Hash' +import isPlainObject from './utils/isPlainObj'; +// Functional predicates +import { isImmutable } from './predicates/isImmutable'; +import { isCollection } from './predicates/isCollection'; +import { isKeyed } from './predicates/isKeyed'; +import { isIndexed } from './predicates/isIndexed'; +import { isAssociative } from './predicates/isAssociative'; +import { isOrdered } from './predicates/isOrdered'; +import { isValueObject } from './predicates/isValueObject'; +import { isSeq } from './predicates/isSeq'; +import { isList } from './predicates/isList'; +import { isMap } from './predicates/isMap'; +import { isOrderedMap } from './predicates/isOrderedMap'; +import { isStack } from './predicates/isStack'; +import { isSet } from './predicates/isSet'; +import { isOrderedSet } from './predicates/isOrderedSet'; +import { isRecord } from './predicates/isRecord'; -export default { +import { Collection } from './CollectionImpl'; +import { hash } from './Hash'; - Iterable: Iterable, +// Functional read/write API +import { get } from './functional/get'; +import { getIn } from './functional/getIn'; +import { has } from './functional/has'; +import { hasIn } from './functional/hasIn'; +import { merge, mergeDeep, mergeWith, mergeDeepWith } from './functional/merge'; +import { remove } from './functional/remove'; +import { removeIn } from './functional/removeIn'; +import { set } from './functional/set'; +import { setIn } from './functional/setIn'; +import { update } from './functional/update'; +import { updateIn } from './functional/updateIn'; - Seq: Seq, - Collection: Collection, - Map: Map, - OrderedMap: OrderedMap, - List: List, - Stack: Stack, - Set: Set, - OrderedSet: OrderedSet, +import { version } from '../package.json'; - Record: Record, - Range: Range, - Repeat: Repeat, - - is: is, - fromJS: fromJS, - hash: hash - -}; +// Note: Iterable is deprecated +const Iterable = Collection; export { + version, + Collection, Iterable, - Seq, - Collection, Map, OrderedMap, List, Stack, Set, OrderedSet, - + PairSorting, Record, Range, Repeat, - is, fromJS, - hash -} + hash, + isImmutable, + isCollection, + isKeyed, + isIndexed, + isAssociative, + isOrdered, + isPlainObject, + isValueObject, + isSeq, + isList, + isMap, + isOrderedMap, + isStack, + isSet, + isOrderedSet, + isRecord, + get, + getIn, + has, + hasIn, + merge, + mergeDeep, + mergeWith, + mergeDeepWith, + remove, + removeIn, + set, + setIn, + update, + updateIn, +}; diff --git a/src/Iterable.js b/src/Iterable.js deleted file mode 100644 index f856a03e41..0000000000 --- a/src/Iterable.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { Seq, KeyedSeq, IndexedSeq, SetSeq } from './Seq' - - -export class Iterable { - constructor(value) { - return isIterable(value) ? value : Seq(value); - } -} - -export class KeyedIterable extends Iterable { - constructor(value) { - return isKeyed(value) ? value : KeyedSeq(value); - } -} - -export class IndexedIterable extends Iterable { - constructor(value) { - return isIndexed(value) ? value : IndexedSeq(value); - } -} - -export class SetIterable extends Iterable { - constructor(value) { - return isIterable(value) && !isAssociative(value) ? value : SetSeq(value); - } -} - - -export function isIterable(maybeIterable) { - return !!(maybeIterable && maybeIterable[IS_ITERABLE_SENTINEL]); -} - -export function isKeyed(maybeKeyed) { - return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL]); -} - -export function isIndexed(maybeIndexed) { - return !!(maybeIndexed && maybeIndexed[IS_INDEXED_SENTINEL]); -} - -export function isAssociative(maybeAssociative) { - return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); -} - -export function isOrdered(maybeOrdered) { - return !!(maybeOrdered && maybeOrdered[IS_ORDERED_SENTINEL]); -} - -Iterable.isIterable = isIterable; -Iterable.isKeyed = isKeyed; -Iterable.isIndexed = isIndexed; -Iterable.isAssociative = isAssociative; -Iterable.isOrdered = isOrdered; - -Iterable.Keyed = KeyedIterable; -Iterable.Indexed = IndexedIterable; -Iterable.Set = SetIterable; - - -export var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; -export var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; -export var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; -export var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; diff --git a/src/IterableImpl.js b/src/IterableImpl.js deleted file mode 100644 index 087b9dd855..0000000000 --- a/src/IterableImpl.js +++ /dev/null @@ -1,765 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { Iterable, KeyedIterable, IndexedIterable, SetIterable, - isIterable, isKeyed, isIndexed, isAssociative, isOrdered, - IS_ITERABLE_SENTINEL, IS_KEYED_SENTINEL, IS_INDEXED_SENTINEL, IS_ORDERED_SENTINEL } from './Iterable' - -import { is } from './is' -import { arrCopy, NOT_SET, ensureSize, wrapIndex, - returnTrue, resolveBegin } from './TrieUtils' -import { hash } from './Hash' -import { imul, smi } from './Math' -import { Iterator, - ITERATOR_SYMBOL, ITERATE_KEYS, ITERATE_VALUES, ITERATE_ENTRIES } from './Iterator' - -import assertNotInfinite from './utils/assertNotInfinite' -import forceIterator from './utils/forceIterator' -import deepEqual from './utils/deepEqual' -import mixin from './utils/mixin' - -import { Map } from './Map' -import { OrderedMap } from './OrderedMap' -import { List } from './List' -import { Set } from './Set' -import { OrderedSet } from './OrderedSet' -import { Stack } from './Stack' -import { Range } from './Range' -import { KeyedSeq, IndexedSeq, SetSeq, ArraySeq } from './Seq' -import { KeyedCollection, IndexedCollection, SetCollection } from './Collection' -import { reify, ToKeyedSequence, ToIndexedSequence, ToSetSequence, - FromEntriesSequence, flipFactory, mapFactory, reverseFactory, - filterFactory, countByFactory, groupByFactory, sliceFactory, - takeWhileFactory, skipWhileFactory, concatFactory, - flattenFactory, flatMapFactory, interposeFactory, sortFactory, - maxFactory, zipWithFactory } from './Operations' - -export { Iterable, KeyedIterable, IndexedIterable, SetIterable, - IndexedIterablePrototype, - isIterable, isKeyed, isIndexed, isAssociative, isOrdered, IS_ORDERED_SENTINEL } - - -Iterable.Iterator = Iterator; - -mixin(Iterable, { - - // ### Conversion to other types - - toArray() { - assertNotInfinite(this.size); - var array = new Array(this.size || 0); - this.valueSeq().__iterate((v, i) => { array[i] = v; }); - return array; - }, - - toIndexedSeq() { - return new ToIndexedSequence(this); - }, - - toJS() { - return this.toSeq().map(toJS).__toJS(); - }, - - toJSON() { - return this.toSeq().map(toJSON).__toJS(); - }, - - toKeyedSeq() { - return new ToKeyedSequence(this, true); - }, - - toMap() { - // Use Late Binding here to solve the circular dependency. - return Map(this.toKeyedSeq()); - }, - - toObject() { - assertNotInfinite(this.size); - var object = {}; - this.__iterate((v, k) => { object[k] = v; }); - return object; - }, - - toOrderedMap() { - // Use Late Binding here to solve the circular dependency. - return OrderedMap(this.toKeyedSeq()); - }, - - toOrderedSet() { - // Use Late Binding here to solve the circular dependency. - return OrderedSet(isKeyed(this) ? this.valueSeq() : this); - }, - - toSet() { - // Use Late Binding here to solve the circular dependency. - return Set(isKeyed(this) ? this.valueSeq() : this); - }, - - toSetSeq() { - return new ToSetSequence(this); - }, - - toSeq() { - return isIndexed(this) ? this.toIndexedSeq() : - isKeyed(this) ? this.toKeyedSeq() : - this.toSetSeq(); - }, - - toStack() { - // Use Late Binding here to solve the circular dependency. - return Stack(isKeyed(this) ? this.valueSeq() : this); - }, - - toList() { - // Use Late Binding here to solve the circular dependency. - return List(isKeyed(this) ? this.valueSeq() : this); - }, - - - // ### Common JavaScript methods and properties - - toString() { - return '[Iterable]'; - }, - - __toString(head, tail) { - if (this.size === 0) { - return head + tail; - } - return head + ' ' + this.toSeq().map(this.__toStringMapper).join(', ') + ' ' + tail; - }, - - - // ### ES6 Collection methods (ES6 Array and Map) - - concat(...values) { - return reify(this, concatFactory(this, values)); - }, - - includes(searchValue) { - return this.some(value => is(value, searchValue)); - }, - - entries() { - return this.__iterator(ITERATE_ENTRIES); - }, - - every(predicate, context) { - assertNotInfinite(this.size); - var returnValue = true; - this.__iterate((v, k, c) => { - if (!predicate.call(context, v, k, c)) { - returnValue = false; - return false; - } - }); - return returnValue; - }, - - filter(predicate, context) { - return reify(this, filterFactory(this, predicate, context, true)); - }, - - find(predicate, context, notSetValue) { - var entry = this.findEntry(predicate, context); - return entry ? entry[1] : notSetValue; - }, - - forEach(sideEffect, context) { - assertNotInfinite(this.size); - return this.__iterate(context ? sideEffect.bind(context) : sideEffect); - }, - - join(separator) { - assertNotInfinite(this.size); - separator = separator !== undefined ? '' + separator : ','; - var joined = ''; - var isFirst = true; - this.__iterate(v => { - isFirst ? (isFirst = false) : (joined += separator); - joined += v !== null && v !== undefined ? v.toString() : ''; - }); - return joined; - }, - - keys() { - return this.__iterator(ITERATE_KEYS); - }, - - map(mapper, context) { - return reify(this, mapFactory(this, mapper, context)); - }, - - reduce(reducer, initialReduction, context) { - assertNotInfinite(this.size); - var reduction; - var useFirst; - if (arguments.length < 2) { - useFirst = true; - } else { - reduction = initialReduction; - } - this.__iterate((v, k, c) => { - if (useFirst) { - useFirst = false; - reduction = v; - } else { - reduction = reducer.call(context, reduction, v, k, c); - } - }); - return reduction; - }, - - reduceRight(reducer, initialReduction, context) { - var reversed = this.toKeyedSeq().reverse(); - return reversed.reduce.apply(reversed, arguments); - }, - - reverse() { - return reify(this, reverseFactory(this, true)); - }, - - slice(begin, end) { - return reify(this, sliceFactory(this, begin, end, true)); - }, - - some(predicate, context) { - return !this.every(not(predicate), context); - }, - - sort(comparator) { - return reify(this, sortFactory(this, comparator)); - }, - - values() { - return this.__iterator(ITERATE_VALUES); - }, - - - // ### More sequential methods - - butLast() { - return this.slice(0, -1); - }, - - isEmpty() { - return this.size !== undefined ? this.size === 0 : !this.some(() => true); - }, - - count(predicate, context) { - return ensureSize( - predicate ? this.toSeq().filter(predicate, context) : this - ); - }, - - countBy(grouper, context) { - return countByFactory(this, grouper, context); - }, - - equals(other) { - return deepEqual(this, other); - }, - - entrySeq() { - var iterable = this; - if (iterable._cache) { - // We cache as an entries array, so we can just return the cache! - return new ArraySeq(iterable._cache); - } - var entriesSequence = iterable.toSeq().map(entryMapper).toIndexedSeq(); - entriesSequence.fromEntrySeq = () => iterable.toSeq(); - - // Entries are plain Array, which do not define toJS/toJSON, so it must - // manually converts keys and values before conversion. - entriesSequence.toJS = function () { - return this.map(entry => [toJS(entry[0]), toJS(entry[1])]).__toJS(); - }; - entriesSequence.toJSON = function () { - return this.map(entry => [toJSON(entry[0]), toJSON(entry[1])]).__toJS(); - }; - - return entriesSequence; - }, - - filterNot(predicate, context) { - return this.filter(not(predicate), context); - }, - - findEntry(predicate, context, notSetValue) { - var found = notSetValue; - this.__iterate((v, k, c) => { - if (predicate.call(context, v, k, c)) { - found = [k, v]; - return false; - } - }); - return found; - }, - - findKey(predicate, context) { - var entry = this.findEntry(predicate, context); - return entry && entry[0]; - }, - - findLast(predicate, context, notSetValue) { - return this.toKeyedSeq().reverse().find(predicate, context, notSetValue); - }, - - findLastEntry(predicate, context, notSetValue) { - return this.toKeyedSeq().reverse().findEntry(predicate, context, notSetValue); - }, - - findLastKey(predicate, context) { - return this.toKeyedSeq().reverse().findKey(predicate, context); - }, - - first() { - return this.find(returnTrue); - }, - - flatMap(mapper, context) { - return reify(this, flatMapFactory(this, mapper, context)); - }, - - flatten(depth) { - return reify(this, flattenFactory(this, depth, true)); - }, - - fromEntrySeq() { - return new FromEntriesSequence(this); - }, - - get(searchKey, notSetValue) { - return this.find((_, key) => is(key, searchKey), undefined, notSetValue); - }, - - getIn(searchKeyPath, notSetValue) { - var nested = this; - // Note: in an ES6 environment, we would prefer: - // for (var key of searchKeyPath) { - var iter = forceIterator(searchKeyPath); - var step; - while (!(step = iter.next()).done) { - var key = step.value; - nested = nested && nested.get ? nested.get(key, NOT_SET) : NOT_SET; - if (nested === NOT_SET) { - return notSetValue; - } - } - return nested; - }, - - groupBy(grouper, context) { - return groupByFactory(this, grouper, context); - }, - - has(searchKey) { - return this.get(searchKey, NOT_SET) !== NOT_SET; - }, - - hasIn(searchKeyPath) { - return this.getIn(searchKeyPath, NOT_SET) !== NOT_SET; - }, - - isSubset(iter) { - iter = typeof iter.includes === 'function' ? iter : Iterable(iter); - return this.every(value => iter.includes(value)); - }, - - isSuperset(iter) { - iter = typeof iter.isSubset === 'function' ? iter : Iterable(iter); - return iter.isSubset(this); - }, - - keyOf(searchValue) { - return this.findKey(value => is(value, searchValue)); - }, - - keySeq() { - return this.toSeq().map(keyMapper).toIndexedSeq(); - }, - - last() { - return this.toSeq().reverse().first(); - }, - - lastKeyOf(searchValue) { - return this.toKeyedSeq().reverse().keyOf(searchValue); - }, - - max(comparator) { - return maxFactory(this, comparator); - }, - - maxBy(mapper, comparator) { - return maxFactory(this, comparator, mapper); - }, - - min(comparator) { - return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator); - }, - - minBy(mapper, comparator) { - return maxFactory(this, comparator ? neg(comparator) : defaultNegComparator, mapper); - }, - - rest() { - return this.slice(1); - }, - - skip(amount) { - return amount === 0 ? this : this.slice(Math.max(0, amount)); - }, - - skipLast(amount) { - return amount === 0 ? this : this.slice(0, -Math.max(0, amount)); - }, - - skipWhile(predicate, context) { - return reify(this, skipWhileFactory(this, predicate, context, true)); - }, - - skipUntil(predicate, context) { - return this.skipWhile(not(predicate), context); - }, - - sortBy(mapper, comparator) { - return reify(this, sortFactory(this, comparator, mapper)); - }, - - take(amount) { - return this.slice(0, Math.max(0, amount)); - }, - - takeLast(amount) { - return this.slice(-Math.max(0, amount)); - }, - - takeWhile(predicate, context) { - return reify(this, takeWhileFactory(this, predicate, context)); - }, - - takeUntil(predicate, context) { - return this.takeWhile(not(predicate), context); - }, - - valueSeq() { - return this.toIndexedSeq(); - }, - - - // ### Hashable Object - - hashCode() { - return this.__hash || (this.__hash = hashIterable(this)); - } - - - // ### Internal - - // abstract __iterate(fn, reverse) - - // abstract __iterator(type, reverse) -}); - -// var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@'; -// var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@'; -// var IS_INDEXED_SENTINEL = '@@__IMMUTABLE_INDEXED__@@'; -// var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@'; - -var IterablePrototype = Iterable.prototype; -IterablePrototype[IS_ITERABLE_SENTINEL] = true; -IterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.values; -IterablePrototype.__toJS = IterablePrototype.toArray; -IterablePrototype.__toStringMapper = quoteString; -IterablePrototype.inspect = -IterablePrototype.toSource = function() { return this.toString(); }; -IterablePrototype.chain = IterablePrototype.flatMap; -IterablePrototype.contains = IterablePrototype.includes; - -mixin(KeyedIterable, { - - // ### More sequential methods - - flip() { - return reify(this, flipFactory(this)); - }, - - mapEntries(mapper, context) { - var iterations = 0; - return reify(this, - this.toSeq().map( - (v, k) => mapper.call(context, [k, v], iterations++, this) - ).fromEntrySeq() - ); - }, - - mapKeys(mapper, context) { - return reify(this, - this.toSeq().flip().map( - (k, v) => mapper.call(context, k, v, this) - ).flip() - ); - } - -}); - -var KeyedIterablePrototype = KeyedIterable.prototype; -KeyedIterablePrototype[IS_KEYED_SENTINEL] = true; -KeyedIterablePrototype[ITERATOR_SYMBOL] = IterablePrototype.entries; -KeyedIterablePrototype.__toJS = IterablePrototype.toObject; -KeyedIterablePrototype.__toStringMapper = (v, k) => quoteString(k) + ': ' + quoteString(v); - - - -mixin(IndexedIterable, { - - // ### Conversion to other types - - toKeyedSeq() { - return new ToKeyedSequence(this, false); - }, - - - // ### ES6 Collection methods (ES6 Array and Map) - - filter(predicate, context) { - return reify(this, filterFactory(this, predicate, context, false)); - }, - - findIndex(predicate, context) { - var entry = this.findEntry(predicate, context); - return entry ? entry[0] : -1; - }, - - indexOf(searchValue) { - var key = this.keyOf(searchValue); - return key === undefined ? -1 : key; - }, - - lastIndexOf(searchValue) { - var key = this.lastKeyOf(searchValue); - return key === undefined ? -1 : key; - }, - - reverse() { - return reify(this, reverseFactory(this, false)); - }, - - slice(begin, end) { - return reify(this, sliceFactory(this, begin, end, false)); - }, - - splice(index, removeNum /*, ...values*/) { - var numArgs = arguments.length; - removeNum = Math.max(removeNum | 0, 0); - if (numArgs === 0 || (numArgs === 2 && !removeNum)) { - return this; - } - // If index is negative, it should resolve relative to the size of the - // collection. However size may be expensive to compute if not cached, so - // only call count() if the number is in fact negative. - index = resolveBegin(index, index < 0 ? this.count() : this.size); - var spliced = this.slice(0, index); - return reify( - this, - numArgs === 1 ? - spliced : - spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum)) - ); - }, - - - // ### More collection methods - - findLastIndex(predicate, context) { - var entry = this.findLastEntry(predicate, context); - return entry ? entry[0] : -1; - }, - - first() { - return this.get(0); - }, - - flatten(depth) { - return reify(this, flattenFactory(this, depth, false)); - }, - - get(index, notSetValue) { - index = wrapIndex(this, index); - return (index < 0 || (this.size === Infinity || - (this.size !== undefined && index > this.size))) ? - notSetValue : - this.find((_, key) => key === index, undefined, notSetValue); - }, - - has(index) { - index = wrapIndex(this, index); - return index >= 0 && (this.size !== undefined ? - this.size === Infinity || index < this.size : - this.indexOf(index) !== -1 - ); - }, - - interpose(separator) { - return reify(this, interposeFactory(this, separator)); - }, - - interleave(/*...iterables*/) { - var iterables = [this].concat(arrCopy(arguments)); - var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, iterables); - var interleaved = zipped.flatten(true); - if (zipped.size) { - interleaved.size = zipped.size * iterables.length; - } - return reify(this, interleaved); - }, - - keySeq() { - return Range(0, this.size); - }, - - last() { - return this.get(-1); - }, - - skipWhile(predicate, context) { - return reify(this, skipWhileFactory(this, predicate, context, false)); - }, - - zip(/*, ...iterables */) { - var iterables = [this].concat(arrCopy(arguments)); - return reify(this, zipWithFactory(this, defaultZipper, iterables)); - }, - - zipWith(zipper/*, ...iterables */) { - var iterables = arrCopy(arguments); - iterables[0] = this; - return reify(this, zipWithFactory(this, zipper, iterables)); - } - -}); - -var IndexedIterablePrototype = IndexedIterable.prototype; -IndexedIterablePrototype[IS_INDEXED_SENTINEL] = true; -IndexedIterablePrototype[IS_ORDERED_SENTINEL] = true; - - - -mixin(SetIterable, { - - // ### ES6 Collection methods (ES6 Array and Map) - - get(value, notSetValue) { - return this.has(value) ? value : notSetValue; - }, - - includes(value) { - return this.has(value); - }, - - - // ### More sequential methods - - keySeq() { - return this.valueSeq(); - } - -}); - -SetIterable.prototype.has = IterablePrototype.includes; -SetIterable.prototype.contains = SetIterable.prototype.includes; - - -// Mixin subclasses - -mixin(KeyedSeq, KeyedIterable.prototype); -mixin(IndexedSeq, IndexedIterable.prototype); -mixin(SetSeq, SetIterable.prototype); - -mixin(KeyedCollection, KeyedIterable.prototype); -mixin(IndexedCollection, IndexedIterable.prototype); -mixin(SetCollection, SetIterable.prototype); - - -// #pragma Helper functions - -function keyMapper(v, k) { - return k; -} - -function entryMapper(v, k) { - return [k, v]; -} - -function toJS(value) { - return value && typeof value.toJS === 'function' ? value.toJS() : value; -} - -function toJSON(value) { - return value && typeof value.toJSON === 'function' ? value.toJSON() : value; -} - -function not(predicate) { - return function() { - return !predicate.apply(this, arguments); - } -} - -function neg(predicate) { - return function() { - return -predicate.apply(this, arguments); - } -} - -function quoteString(value) { - return typeof value === 'string' ? JSON.stringify(value) : String(value); -} - -function defaultZipper() { - return arrCopy(arguments); -} - -function defaultNegComparator(a, b) { - return a < b ? 1 : a > b ? -1 : 0; -} - -function hashIterable(iterable) { - if (iterable.size === Infinity) { - return 0; - } - var ordered = isOrdered(iterable); - var keyed = isKeyed(iterable); - var h = ordered ? 1 : 0; - var size = iterable.__iterate( - keyed ? - ordered ? - (v, k) => { h = 31 * h + hashMerge(hash(v), hash(k)) | 0; } : - (v, k) => { h = h + hashMerge(hash(v), hash(k)) | 0; } : - ordered ? - v => { h = 31 * h + hash(v) | 0; } : - v => { h = h + hash(v) | 0; } - ); - return murmurHashOfSize(size, h); -} - -function murmurHashOfSize(size, h) { - h = imul(h, 0xCC9E2D51); - h = imul(h << 15 | h >>> -15, 0x1B873593); - h = imul(h << 13 | h >>> -13, 5); - h = (h + 0xE6546B64 | 0) ^ size; - h = imul(h ^ h >>> 16, 0x85EBCA6B); - h = imul(h ^ h >>> 13, 0xC2B2AE35); - h = smi(h ^ h >>> 16); - return h; -} - -function hashMerge(a, b) { - return a ^ b + 0x9E3779B9 + (a << 6) + (a >> 2) | 0; // int -} diff --git a/src/Iterator.js b/src/Iterator.js index 6699422904..1954a3661c 100644 --- a/src/Iterator.js +++ b/src/Iterator.js @@ -1,21 +1,11 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ +export const ITERATE_KEYS = 0; +export const ITERATE_VALUES = 1; +export const ITERATE_ENTRIES = 2; -export var ITERATE_KEYS = 0; -export var ITERATE_VALUES = 1; -export var ITERATE_ENTRIES = 2; - -var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; -var FAUX_ITERATOR_SYMBOL = '@@iterator'; - -export var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL; +const REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; +const FAUX_ITERATOR_SYMBOL = '@@iterator'; +export const ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL; export class Iterator { constructor(next) { @@ -31,18 +21,23 @@ Iterator.KEYS = ITERATE_KEYS; Iterator.VALUES = ITERATE_VALUES; Iterator.ENTRIES = ITERATE_ENTRIES; -Iterator.prototype.inspect = -Iterator.prototype.toSource = function () { return this.toString(); } +Iterator.prototype.inspect = Iterator.prototype.toSource = function () { + return this.toString(); +}; Iterator.prototype[ITERATOR_SYMBOL] = function () { return this; }; - export function iteratorValue(type, k, v, iteratorResult) { - var value = type === 0 ? k : type === 1 ? v : [k, v]; - iteratorResult ? (iteratorResult.value = value) : (iteratorResult = { - value: value, done: false - }); + const value = + type === ITERATE_KEYS ? k : type === ITERATE_VALUES ? v : [k, v]; + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + iteratorResult + ? (iteratorResult.value = value) + : (iteratorResult = { + value: value, + done: false, + }); return iteratorResult; } @@ -51,6 +46,11 @@ export function iteratorDone() { } export function hasIterator(maybeIterable) { + if (Array.isArray(maybeIterable)) { + // IE11 trick as it does not support `Symbol.iterator` + return true; + } + return !!getIteratorFn(maybeIterable); } @@ -59,16 +59,26 @@ export function isIterator(maybeIterator) { } export function getIterator(iterable) { - var iteratorFn = getIteratorFn(iterable); + const iteratorFn = getIteratorFn(iterable); return iteratorFn && iteratorFn.call(iterable); } function getIteratorFn(iterable) { - var iteratorFn = iterable && ( - (REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || - iterable[FAUX_ITERATOR_SYMBOL] - ); + const iteratorFn = + iterable && + ((REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) || + iterable[FAUX_ITERATOR_SYMBOL]); if (typeof iteratorFn === 'function') { return iteratorFn; } } + +export function isEntriesIterable(maybeIterable) { + const iteratorFn = getIteratorFn(maybeIterable); + return iteratorFn && iteratorFn === maybeIterable.entries; +} + +export function isKeysIterable(maybeIterable) { + const iteratorFn = getIteratorFn(maybeIterable); + return iteratorFn && iteratorFn === maybeIterable.keys; +} diff --git a/src/List.js b/src/List.js index 8d04c48f0c..966b9e1b2c 100644 --- a/src/List.js +++ b/src/List.js @@ -1,45 +1,57 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { fromJS } from './fromJS' -import { DELETE, SHIFT, SIZE, MASK, DID_ALTER, OwnerID, MakeRef, - SetRef, wrapIndex, wholeSlice, resolveBegin, resolveEnd } from './TrieUtils' -import { isIterable, IndexedIterable } from './Iterable' -import { IndexedCollection } from './Collection' -import { MapPrototype, mergeIntoCollectionWith, deepMerger, deepMergerWith } from './Map' -import { Iterator, iteratorValue, iteratorDone } from './Iterator' - -import assertNotInfinite from './utils/assertNotInfinite' - +import { + DELETE, + SHIFT, + SIZE, + MASK, + OwnerID, + MakeRef, + SetRef, + wrapIndex, + wholeSlice, + resolveBegin, + resolveEnd, +} from './TrieUtils'; +import { IS_LIST_SYMBOL, isList } from './predicates/isList'; +import { IndexedCollection } from './Collection'; +import { hasIterator, Iterator, iteratorValue, iteratorDone } from './Iterator'; +import { setIn } from './methods/setIn'; +import { deleteIn } from './methods/deleteIn'; +import { update } from './methods/update'; +import { updateIn } from './methods/updateIn'; +import { mergeIn } from './methods/mergeIn'; +import { mergeDeepIn } from './methods/mergeDeepIn'; +import { withMutations } from './methods/withMutations'; +import { asMutable } from './methods/asMutable'; +import { asImmutable } from './methods/asImmutable'; +import { wasAltered } from './methods/wasAltered'; +import assertNotInfinite from './utils/assertNotInfinite'; export class List extends IndexedCollection { - // @pragma Construction constructor(value) { - var empty = emptyList(); - if (value === null || value === undefined) { + const empty = emptyList(); + if (value === undefined || value === null) { + // eslint-disable-next-line no-constructor-return return empty; } if (isList(value)) { + // eslint-disable-next-line no-constructor-return return value; } - var iter = IndexedIterable(value); - var size = iter.size; + const iter = IndexedCollection(value); + const size = iter.size; if (size === 0) { + // eslint-disable-next-line no-constructor-return return empty; } assertNotInfinite(size); if (size > 0 && size < SIZE) { + // eslint-disable-next-line no-constructor-return return makeList(0, size, SHIFT, null, new VNode(iter.toArray())); } - return empty.withMutations(list => { + // eslint-disable-next-line no-constructor-return + return empty.withMutations((list) => { list.setSize(size); iter.forEach((v, i) => list.set(i, v)); }); @@ -59,7 +71,7 @@ export class List extends IndexedCollection { index = wrapIndex(this, index); if (index >= 0 && index < this.size) { index += this._origin; - var node = listNodeFor(this, index); + const node = listNodeFor(this, index); return node && node.array[index & MASK]; } return notSetValue; @@ -72,10 +84,13 @@ export class List extends IndexedCollection { } remove(index) { - return !this.has(index) ? this : - index === 0 ? this.shift() : - index === this.size - 1 ? this.pop() : - this.splice(index, 1); + return !this.has(index) + ? this + : index === 0 + ? this.shift() + : index === this.size - 1 + ? this.pop() + : this.splice(index, 1); } insert(index, value) { @@ -89,8 +104,7 @@ export class List extends IndexedCollection { if (this.__ownerID) { this.size = this._origin = this._capacity = 0; this._level = SHIFT; - this._root = this._tail = null; - this.__hash = undefined; + this._root = this._tail = this.__hash = undefined; this.__altered = true; return this; } @@ -98,11 +112,11 @@ export class List extends IndexedCollection { } push(/*...values*/) { - var values = arguments; - var oldSize = this.size; - return this.withMutations(list => { + const values = arguments; + const oldSize = this.size; + return this.withMutations((list) => { setListBounds(list, 0, oldSize + values.length); - for (var ii = 0; ii < values.length; ii++) { + for (let ii = 0; ii < values.length; ii++) { list.set(oldSize + ii, values[ii]); } }); @@ -113,10 +127,10 @@ export class List extends IndexedCollection { } unshift(/*...values*/) { - var values = arguments; - return this.withMutations(list => { + const values = arguments; + return this.withMutations((list) => { setListBounds(list, -values.length); - for (var ii = 0; ii < values.length; ii++) { + for (let ii = 0; ii < values.length; ii++) { list.set(ii, values[ii]); } }); @@ -126,32 +140,65 @@ export class List extends IndexedCollection { return setListBounds(this, 1); } - // @pragma Composition + shuffle(random = Math.random) { + return this.withMutations((mutable) => { + // implementation of the Fisher-Yates shuffle: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle + let current = mutable.size; + let destination; + let tmp; - merge(/*...iters*/) { - return mergeIntoListWith(this, undefined, arguments); - } + while (current) { + destination = Math.floor(random() * current--); - mergeWith(merger, ...iters) { - return mergeIntoListWith(this, merger, iters); + tmp = mutable.get(destination); + mutable.set(destination, mutable.get(current)); + mutable.set(current, tmp); + } + }); } - mergeDeep(/*...iters*/) { - return mergeIntoListWith(this, deepMerger, arguments); - } + // @pragma Composition - mergeDeepWith(merger, ...iters) { - return mergeIntoListWith(this, deepMergerWith(merger), iters); + concat(/*...collections*/) { + const seqs = []; + for (let i = 0; i < arguments.length; i++) { + const argument = arguments[i]; + const seq = IndexedCollection( + typeof argument !== 'string' && hasIterator(argument) + ? argument + : [argument] + ); + if (seq.size !== 0) { + seqs.push(seq); + } + } + if (seqs.length === 0) { + return this; + } + if (this.size === 0 && !this.__ownerID && seqs.length === 1) { + return this.constructor(seqs[0]); + } + return this.withMutations((list) => { + seqs.forEach((seq) => seq.forEach((value) => list.push(value))); + }); } setSize(size) { return setListBounds(this, 0, size); } + map(mapper, context) { + return this.withMutations((list) => { + for (let i = 0; i < this.size; i++) { + list.set(i, mapper.call(context, list.get(i), i, this)); + } + }); + } + // @pragma Iteration slice(begin, end) { - var size = this.size; + const size = this.size; if (wholeSlice(begin, end, size)) { return this; } @@ -163,20 +210,20 @@ export class List extends IndexedCollection { } __iterator(type, reverse) { - var index = reverse ? this.size : 0; - var values = iterateList(this, reverse); + let index = reverse ? this.size : 0; + const values = iterateList(this, reverse); return new Iterator(() => { - var value = values(); - return value === DONE ? - iteratorDone() : - iteratorValue(type, reverse ? --index : index++, value); + const value = values(); + return value === DONE + ? iteratorDone() + : iteratorValue(type, reverse ? --index : index++, value); }); } __iterate(fn, reverse) { - var index = reverse ? this.size : 0; - var values = iterateList(this, reverse); - var value; + let index = reverse ? this.size : 0; + const values = iterateList(this, reverse); + let value; while ((value = values()) !== DONE) { if (fn(value, reverse ? --index : index++, this) === false) { break; @@ -190,36 +237,47 @@ export class List extends IndexedCollection { return this; } if (!ownerID) { + if (this.size === 0) { + return emptyList(); + } this.__ownerID = ownerID; + this.__altered = false; return this; } - return makeList(this._origin, this._capacity, this._level, this._root, this._tail, ownerID, this.__hash); + return makeList( + this._origin, + this._capacity, + this._level, + this._root, + this._tail, + ownerID, + this.__hash + ); } } -export function isList(maybeList) { - return !!(maybeList && maybeList[IS_LIST_SENTINEL]); -} - List.isList = isList; -var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@'; - -export var ListPrototype = List.prototype; -ListPrototype[IS_LIST_SENTINEL] = true; +const ListPrototype = List.prototype; +ListPrototype[IS_LIST_SYMBOL] = true; ListPrototype[DELETE] = ListPrototype.remove; -ListPrototype.setIn = MapPrototype.setIn; -ListPrototype.deleteIn = -ListPrototype.removeIn = MapPrototype.removeIn; -ListPrototype.update = MapPrototype.update; -ListPrototype.updateIn = MapPrototype.updateIn; -ListPrototype.mergeIn = MapPrototype.mergeIn; -ListPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; -ListPrototype.withMutations = MapPrototype.withMutations; -ListPrototype.asMutable = MapPrototype.asMutable; -ListPrototype.asImmutable = MapPrototype.asImmutable; -ListPrototype.wasAltered = MapPrototype.wasAltered; - +ListPrototype.merge = ListPrototype.concat; +ListPrototype.setIn = setIn; +ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn; +ListPrototype.update = update; +ListPrototype.updateIn = updateIn; +ListPrototype.mergeIn = mergeIn; +ListPrototype.mergeDeepIn = mergeDeepIn; +ListPrototype.withMutations = withMutations; +ListPrototype.wasAltered = wasAltered; +ListPrototype.asImmutable = asImmutable; +ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable; +ListPrototype['@@transducer/step'] = function (result, arr) { + return result.push(arr); +}; +ListPrototype['@@transducer/result'] = function (obj) { + return obj.asImmutable(); +}; class VNode { constructor(array, ownerID) { @@ -230,18 +288,22 @@ class VNode { // TODO: seems like these methods are very similar removeBefore(ownerID, level, index) { - if (index === level ? 1 << level : 0 || this.array.length === 0) { + if ( + (index & ((1 << (level + SHIFT)) - 1)) === 0 || + this.array.length === 0 + ) { return this; } - var originIndex = (index >>> level) & MASK; + const originIndex = (index >>> level) & MASK; if (originIndex >= this.array.length) { return new VNode([], ownerID); } - var removingFirst = originIndex === 0; - var newChild; + const removingFirst = originIndex === 0; + let newChild; if (level > 0) { - var oldChild = this.array[originIndex]; - newChild = oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index); + const oldChild = this.array[originIndex]; + newChild = + oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index); if (newChild === oldChild && removingFirst) { return this; } @@ -249,9 +311,9 @@ class VNode { if (removingFirst && !newChild) { return this; } - var editable = editableVNode(this, ownerID); + const editable = editableVNode(this, ownerID); if (!removingFirst) { - for (var ii = 0; ii < originIndex; ii++) { + for (let ii = 0; ii < originIndex; ii++) { editable.array[ii] = undefined; } } @@ -262,24 +324,28 @@ class VNode { } removeAfter(ownerID, level, index) { - if (index === (level ? 1 << level : 0) || this.array.length === 0) { + if ( + index === (level ? 1 << (level + SHIFT) : SIZE) || + this.array.length === 0 + ) { return this; } - var sizeIndex = ((index - 1) >>> level) & MASK; + const sizeIndex = ((index - 1) >>> level) & MASK; if (sizeIndex >= this.array.length) { return this; } - var newChild; + let newChild; if (level > 0) { - var oldChild = this.array[sizeIndex]; - newChild = oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index); + const oldChild = this.array[sizeIndex]; + newChild = + oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index); if (newChild === oldChild && sizeIndex === this.array.length - 1) { return this; } } - var editable = editableVNode(this, ownerID); + const editable = editableVNode(this, ownerID); editable.array.splice(sizeIndex + 1); if (newChild) { editable.array[sizeIndex] = newChild; @@ -288,27 +354,26 @@ class VNode { } } - -var DONE = {}; +const DONE = {}; function iterateList(list, reverse) { - var left = list._origin; - var right = list._capacity; - var tailPos = getTailOffset(right); - var tail = list._tail; + const left = list._origin; + const right = list._capacity; + const tailPos = getTailOffset(right); + const tail = list._tail; return iterateNodeOrLeaf(list._root, list._level, 0); function iterateNodeOrLeaf(node, level, offset) { - return level === 0 ? - iterateLeaf(node, offset) : - iterateNode(node, level, offset); + return level === 0 + ? iterateLeaf(node, offset) + : iterateNode(node, level, offset); } function iterateLeaf(node, offset) { - var array = offset === tailPos ? tail && tail.array : node && node.array; - var from = offset > left ? 0 : left - offset; - var to = right - offset; + const array = offset === tailPos ? tail && tail.array : node && node.array; + let from = offset > left ? 0 : left - offset; + let to = right - offset; if (to > SIZE) { to = SIZE; } @@ -316,23 +381,23 @@ function iterateList(list, reverse) { if (from === to) { return DONE; } - var idx = reverse ? --to : from++; + const idx = reverse ? --to : from++; return array && array[idx]; }; } function iterateNode(node, level, offset) { - var values; - var array = node && node.array; - var from = offset > left ? 0 : (left - offset) >> level; - var to = ((right - offset) >> level) + 1; + let values; + const array = node && node.array; + let from = offset > left ? 0 : (left - offset) >> level; + let to = ((right - offset) >> level) + 1; if (to > SIZE) { to = SIZE; } return () => { - do { + while (true) { if (values) { - var value = values(); + const value = values(); if (value !== DONE) { return value; } @@ -341,17 +406,19 @@ function iterateList(list, reverse) { if (from === to) { return DONE; } - var idx = reverse ? --to : from++; + const idx = reverse ? --to : from++; values = iterateNodeOrLeaf( - array && array[idx], level - SHIFT, offset + (idx << level) + array && array[idx], + level - SHIFT, + offset + (idx << level) ); - } while (true); + } }; } } function makeList(origin, capacity, level, root, tail, ownerID, hash) { - var list = Object.create(ListPrototype); + const list = Object.create(ListPrototype); list.size = capacity - origin; list._origin = origin; list._capacity = capacity; @@ -364,9 +431,8 @@ function makeList(origin, capacity, level, root, tail, ownerID, hash) { return list; } -var EMPTY_LIST; export function emptyList() { - return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT)); + return makeList(0, 0, SHIFT); } function updateList(list, index, value) { @@ -377,22 +443,30 @@ function updateList(list, index, value) { } if (index >= list.size || index < 0) { - return list.withMutations(list => { - index < 0 ? - setListBounds(list, index).set(0, value) : - setListBounds(list, 0, index + 1).set(index, value) + return list.withMutations((list) => { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + index < 0 + ? setListBounds(list, index).set(0, value) + : setListBounds(list, 0, index + 1).set(index, value); }); } index += list._origin; - var newTail = list._tail; - var newRoot = list._root; - var didAlter = MakeRef(DID_ALTER); + let newTail = list._tail; + let newRoot = list._root; + const didAlter = MakeRef(); if (index >= getTailOffset(list._capacity)) { newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter); } else { - newRoot = updateVNode(newRoot, list.__ownerID, list._level, index, value, didAlter); + newRoot = updateVNode( + newRoot, + list.__ownerID, + list._level, + index, + value, + didAlter + ); } if (!didAlter.value) { @@ -410,17 +484,24 @@ function updateList(list, index, value) { } function updateVNode(node, ownerID, level, index, value, didAlter) { - var idx = (index >>> level) & MASK; - var nodeHas = node && idx < node.array.length; + const idx = (index >>> level) & MASK; + const nodeHas = node && idx < node.array.length; if (!nodeHas && value === undefined) { return node; } - var newNode; + let newNode; if (level > 0) { - var lowerNode = node && node.array[idx]; - var newLowerNode = updateVNode(lowerNode, ownerID, level - SHIFT, index, value, didAlter); + const lowerNode = node && node.array[idx]; + const newLowerNode = updateVNode( + lowerNode, + ownerID, + level - SHIFT, + index, + value, + didAlter + ); if (newLowerNode === lowerNode) { return node; } @@ -433,7 +514,9 @@ function updateVNode(node, ownerID, level, index, value, didAlter) { return node; } - SetRef(didAlter); + if (didAlter) { + SetRef(didAlter); + } newNode = editableVNode(node, ownerID); if (value === undefined && idx === newNode.array.length - 1) { @@ -456,8 +539,8 @@ function listNodeFor(list, rawIndex) { return list._tail; } if (rawIndex < 1 << (list._level + SHIFT)) { - var node = list._root; - var level = list._level; + let node = list._root; + let level = list._level; while (node && level > 0) { node = node.array[(rawIndex >>> level) & MASK]; level -= SHIFT; @@ -470,16 +553,21 @@ function setListBounds(list, begin, end) { // Sanitize begin & end using this shorthand for ToInt32(argument) // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 if (begin !== undefined) { - begin = begin | 0; + begin |= 0; } if (end !== undefined) { - end = end | 0; - } - var owner = list.__ownerID || new OwnerID(); - var oldOrigin = list._origin; - var oldCapacity = list._capacity; - var newOrigin = oldOrigin + begin; - var newCapacity = end === undefined ? oldCapacity : end < 0 ? oldCapacity + end : oldOrigin + end; + end |= 0; + } + const owner = list.__ownerID || new OwnerID(); + let oldOrigin = list._origin; + let oldCapacity = list._capacity; + let newOrigin = oldOrigin + begin; + let newCapacity = + end === undefined + ? oldCapacity + : end < 0 + ? oldCapacity + end + : oldOrigin + end; if (newOrigin === oldOrigin && newCapacity === oldCapacity) { return list; } @@ -489,13 +577,16 @@ function setListBounds(list, begin, end) { return list.clear(); } - var newLevel = list._level; - var newRoot = list._root; + let newLevel = list._level; + let newRoot = list._root; // New origin might need creating a higher root. - var offsetShift = 0; + let offsetShift = 0; while (newOrigin + offsetShift < 0) { - newRoot = new VNode(newRoot && newRoot.array.length ? [undefined, newRoot] : [], owner); + newRoot = new VNode( + newRoot && newRoot.array.length ? [undefined, newRoot] : [], + owner + ); newLevel += SHIFT; offsetShift += 1 << newLevel; } @@ -506,27 +597,38 @@ function setListBounds(list, begin, end) { oldCapacity += offsetShift; } - var oldTailOffset = getTailOffset(oldCapacity); - var newTailOffset = getTailOffset(newCapacity); + const oldTailOffset = getTailOffset(oldCapacity); + const newTailOffset = getTailOffset(newCapacity); // New size might need creating a higher root. while (newTailOffset >= 1 << (newLevel + SHIFT)) { - newRoot = new VNode(newRoot && newRoot.array.length ? [newRoot] : [], owner); + newRoot = new VNode( + newRoot && newRoot.array.length ? [newRoot] : [], + owner + ); newLevel += SHIFT; } // Locate or create the new tail. - var oldTail = list._tail; - var newTail = newTailOffset < oldTailOffset ? - listNodeFor(list, newCapacity - 1) : - newTailOffset > oldTailOffset ? new VNode([], owner) : oldTail; + const oldTail = list._tail; + let newTail = + newTailOffset < oldTailOffset + ? listNodeFor(list, newCapacity - 1) + : newTailOffset > oldTailOffset + ? new VNode([], owner) + : oldTail; // Merge Tail into tree. - if (oldTail && newTailOffset > oldTailOffset && newOrigin < oldCapacity && oldTail.array.length) { + if ( + oldTail && + newTailOffset > oldTailOffset && + newOrigin < oldCapacity && + oldTail.array.length + ) { newRoot = editableVNode(newRoot, owner); - var node = newRoot; - for (var level = newLevel; level > SHIFT; level -= SHIFT) { - var idx = (oldTailOffset >>> level) & MASK; + let node = newRoot; + for (let level = newLevel; level > SHIFT; level -= SHIFT) { + const idx = (oldTailOffset >>> level) & MASK; node = node.array[idx] = editableVNode(node.array[idx], owner); } node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail; @@ -545,14 +647,14 @@ function setListBounds(list, begin, end) { newRoot = null; newTail = newTail && newTail.removeBefore(owner, 0, newOrigin); - // Otherwise, if the root has been trimmed, garbage collect. + // Otherwise, if the root has been trimmed, garbage collect. } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) { offsetShift = 0; // Identify the new top root node of the subtree of the old root. while (newRoot) { - var beginIndex = (newOrigin >>> newLevel) & MASK; - if (beginIndex !== (newTailOffset >>> newLevel) & MASK) { + const beginIndex = (newOrigin >>> newLevel) & MASK; + if ((beginIndex !== newTailOffset >>> newLevel) & MASK) { break; } if (beginIndex) { @@ -567,7 +669,11 @@ function setListBounds(list, begin, end) { newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift); } if (newRoot && newTailOffset < oldTailOffset) { - newRoot = newRoot.removeAfter(owner, newLevel, newTailOffset - offsetShift); + newRoot = newRoot.removeAfter( + owner, + newLevel, + newTailOffset - offsetShift + ); } if (offsetShift) { newOrigin -= offsetShift; @@ -589,26 +695,6 @@ function setListBounds(list, begin, end) { return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail); } -function mergeIntoListWith(list, merger, iterables) { - var iters = []; - var maxSize = 0; - for (var ii = 0; ii < iterables.length; ii++) { - var value = iterables[ii]; - var iter = IndexedIterable(value); - if (iter.size > maxSize) { - maxSize = iter.size; - } - if (!isIterable(value)) { - iter = iter.map(v => fromJS(v)); - } - iters.push(iter); - } - if (maxSize > list.size) { - list = list.setSize(maxSize); - } - return mergeIntoCollectionWith(list, merger, iters); -} - function getTailOffset(size) { - return size < SIZE ? 0 : (((size - 1) >>> SHIFT) << SHIFT); + return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT; } diff --git a/src/Map.js b/src/Map.js index b5ebec7454..672e70cac4 100644 --- a/src/Map.js +++ b/src/Map.js @@ -1,51 +1,51 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { is } from './is' -import { fromJS } from './fromJS' -import { isIterable, KeyedIterable, isOrdered, Iterable } from './Iterable' -import { KeyedCollection } from './Collection' -import { DELETE, SHIFT, SIZE, MASK, NOT_SET, CHANGE_LENGTH, DID_ALTER, OwnerID, - MakeRef, SetRef, arrCopy } from './TrieUtils' -import { hash } from './Hash' -import { Iterator, iteratorValue, iteratorDone } from './Iterator' -import { sortFactory } from './Operations' -import forceIterator from './utils/forceIterator' -import invariant from './utils/invariant' -import assertNotInfinite from './utils/assertNotInfinite' - -import { OrderedMap } from './OrderedMap' - +import { is } from './is'; +import { Collection, KeyedCollection } from './Collection'; +import { IS_MAP_SYMBOL, isMap } from './predicates/isMap'; +import { isOrdered } from './predicates/isOrdered'; +import { + DELETE, + SHIFT, + SIZE, + MASK, + NOT_SET, + OwnerID, + MakeRef, + SetRef, +} from './TrieUtils'; +import { hash } from './Hash'; +import { Iterator, iteratorValue, iteratorDone } from './Iterator'; +import { sortFactory } from './Operations'; +import arrCopy from './utils/arrCopy'; +import assertNotInfinite from './utils/assertNotInfinite'; +import { setIn } from './methods/setIn'; +import { deleteIn } from './methods/deleteIn'; +import { update } from './methods/update'; +import { updateIn } from './methods/updateIn'; +import { merge, mergeWith } from './methods/merge'; +import { mergeDeep, mergeDeepWith } from './methods/mergeDeep'; +import { mergeIn } from './methods/mergeIn'; +import { mergeDeepIn } from './methods/mergeDeepIn'; +import { withMutations } from './methods/withMutations'; +import { asMutable } from './methods/asMutable'; +import { asImmutable } from './methods/asImmutable'; +import { wasAltered } from './methods/wasAltered'; + +import { OrderedMap } from './OrderedMap'; export class Map extends KeyedCollection { - // @pragma Construction constructor(value) { - return value === null || value === undefined ? emptyMap() : - isMap(value) && !isOrdered(value) ? value : - emptyMap().withMutations(map => { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach((v, k) => map.set(k, v)); - }); - } - - static of(...keyValues) { - return emptyMap().withMutations(map => { - for (var i = 0; i < keyValues.length; i += 2) { - if (i + 1 >= keyValues.length) { - throw new Error('Missing value for key: ' + keyValues[i]); - } - map.set(keyValues[i], keyValues[i + 1]); - } - }); + // eslint-disable-next-line no-constructor-return + return value === undefined || value === null + ? emptyMap() + : isMap(value) && !isOrdered(value) + ? value + : emptyMap().withMutations((map) => { + const iter = KeyedCollection(value); + assertNotInfinite(iter.size); + iter.forEach((v, k) => map.set(k, v)); + }); } toString() { @@ -55,9 +55,9 @@ export class Map extends KeyedCollection { // @pragma Access get(k, notSetValue) { - return this._root ? - this._root.get(0, undefined, k, notSetValue) : - notSetValue; + return this._root + ? this._root.get(0, undefined, k, notSetValue) + : notSetValue; } // @pragma Modification @@ -66,50 +66,22 @@ export class Map extends KeyedCollection { return updateMap(this, k, v); } - setIn(keyPath, v) { - return this.updateIn(keyPath, NOT_SET, () => v); - } - remove(k) { return updateMap(this, k, NOT_SET); } - deleteIn(keyPath) { - return this.updateIn(keyPath, () => NOT_SET); - } - deleteAll(keys) { - var iterable = Iterable(keys); + const collection = Collection(keys); - if (iterable.size === 0) { + if (collection.size === 0) { return this; } - return this.withMutations(map => { - iterable.forEach(key => map.remove(key)); + return this.withMutations((map) => { + collection.forEach((key) => map.remove(key)); }); } - update(k, notSetValue, updater) { - return arguments.length === 1 ? - k(this) : - this.updateIn([k], notSetValue, updater); - } - - updateIn(keyPath, notSetValue, updater) { - if (!updater) { - updater = notSetValue; - notSetValue = undefined; - } - var updatedValue = updateInDeepMap( - this, - forceIterator(keyPath), - notSetValue, - updater - ); - return updatedValue === NOT_SET ? notSetValue : updatedValue; - } - clear() { if (this.size === 0) { return this; @@ -126,42 +98,6 @@ export class Map extends KeyedCollection { // @pragma Composition - merge(/*...iters*/) { - return mergeIntoMapWith(this, undefined, arguments); - } - - mergeWith(merger, ...iters) { - return mergeIntoMapWith(this, merger, iters); - } - - mergeIn(keyPath, ...iters) { - return this.updateIn( - keyPath, - emptyMap(), - m => typeof m.merge === 'function' ? - m.merge.apply(m, iters) : - iters[iters.length - 1] - ); - } - - mergeDeep(/*...iters*/) { - return mergeIntoMapWith(this, deepMerger, arguments); - } - - mergeDeepWith(merger, ...iters) { - return mergeIntoMapWith(this, deepMergerWith(merger), iters); - } - - mergeDeepIn(keyPath, ...iters) { - return this.updateIn( - keyPath, - emptyMap(), - m => typeof m.mergeDeep === 'function' ? - m.mergeDeep.apply(m, iters) : - iters[iters.length - 1] - ); - } - sort(comparator) { // Late binding return OrderedMap(sortFactory(this, comparator)); @@ -172,36 +108,28 @@ export class Map extends KeyedCollection { return OrderedMap(sortFactory(this, comparator, mapper)); } - // @pragma Mutability - - withMutations(fn) { - var mutable = this.asMutable(); - fn(mutable); - return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this; - } - - asMutable() { - return this.__ownerID ? this : this.__ensureOwner(new OwnerID()); - } - - asImmutable() { - return this.__ensureOwner(); + map(mapper, context) { + return this.withMutations((map) => { + map.forEach((value, key) => { + map.set(key, mapper.call(context, value, key, this)); + }); + }); } - wasAltered() { - return this.__altered; - } + // @pragma Mutability __iterator(type, reverse) { return new MapIterator(this, type, reverse); } __iterate(fn, reverse) { - var iterations = 0; - this._root && this._root.iterate(entry => { - iterations++; - return fn(entry[1], entry[0], this); - }, reverse); + let iterations = 0; + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + this._root && + this._root.iterate((entry) => { + iterations++; + return fn(entry[1], entry[0], this); + }, reverse); return iterations; } @@ -210,6 +138,9 @@ export class Map extends KeyedCollection { return this; } if (!ownerID) { + if (this.size === 0) { + return emptyMap(); + } this.__ownerID = ownerID; this.__altered = false; return this; @@ -218,33 +149,44 @@ export class Map extends KeyedCollection { } } -export function isMap(maybeMap) { - return !!(maybeMap && maybeMap[IS_MAP_SENTINEL]); -} - Map.isMap = isMap; -var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@'; - -export var MapPrototype = Map.prototype; -MapPrototype[IS_MAP_SENTINEL] = true; +const MapPrototype = Map.prototype; +MapPrototype[IS_MAP_SYMBOL] = true; MapPrototype[DELETE] = MapPrototype.remove; -MapPrototype.removeIn = MapPrototype.deleteIn; MapPrototype.removeAll = MapPrototype.deleteAll; - +MapPrototype.setIn = setIn; +MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn; +MapPrototype.update = update; +MapPrototype.updateIn = updateIn; +MapPrototype.merge = MapPrototype.concat = merge; +MapPrototype.mergeWith = mergeWith; +MapPrototype.mergeDeep = mergeDeep; +MapPrototype.mergeDeepWith = mergeDeepWith; +MapPrototype.mergeIn = mergeIn; +MapPrototype.mergeDeepIn = mergeDeepIn; +MapPrototype.withMutations = withMutations; +MapPrototype.wasAltered = wasAltered; +MapPrototype.asImmutable = asImmutable; +MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable; +MapPrototype['@@transducer/step'] = function (result, arr) { + return result.set(arr[0], arr[1]); +}; +MapPrototype['@@transducer/result'] = function (obj) { + return obj.asImmutable(); +}; // #pragma Trie Nodes class ArrayMapNode { - constructor(ownerID, entries) { this.ownerID = ownerID; this.entries = entries; } get(shift, keyHash, key, notSetValue) { - var entries = this.entries; - for (var ii = 0, len = entries.length; ii < len; ii++) { + const entries = this.entries; + for (let ii = 0, len = entries.length; ii < len; ii++) { if (is(key, entries[ii][0])) { return entries[ii][1]; } @@ -253,22 +195,24 @@ class ArrayMapNode { } update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - var removed = value === NOT_SET; + const removed = value === NOT_SET; - var entries = this.entries; - var idx = 0; - for (var len = entries.length; idx < len; idx++) { + const entries = this.entries; + let idx = 0; + const len = entries.length; + for (; idx < len; idx++) { if (is(key, entries[idx][0])) { break; } } - var exists = idx < len; + const exists = idx < len; if (exists ? entries[idx][1] === value : removed) { return this; } SetRef(didAlter); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here (removed || !exists) && SetRef(didChangeSize); if (removed && entries.length === 1) { @@ -279,12 +223,15 @@ class ArrayMapNode { return createNodes(ownerID, entries, key, value); } - var isEditable = ownerID && ownerID === this.ownerID; - var newEntries = isEditable ? entries : arrCopy(entries); + const isEditable = ownerID && ownerID === this.ownerID; + const newEntries = isEditable ? entries : arrCopy(entries); if (exists) { if (removed) { - idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + idx === len - 1 + ? newEntries.pop() + : (newEntries[idx] = newEntries.pop()); } else { newEntries[idx] = [key, value]; } @@ -302,7 +249,6 @@ class ArrayMapNode { } class BitmapIndexedNode { - constructor(ownerID, bitmap, nodes) { this.ownerID = ownerID; this.bitmap = bitmap; @@ -313,29 +259,44 @@ class BitmapIndexedNode { if (keyHash === undefined) { keyHash = hash(key); } - var bit = (1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK)); - var bitmap = this.bitmap; - return (bitmap & bit) === 0 ? notSetValue : - this.nodes[popCount(bitmap & (bit - 1))].get(shift + SHIFT, keyHash, key, notSetValue); + const bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK); + const bitmap = this.bitmap; + return (bitmap & bit) === 0 + ? notSetValue + : this.nodes[popCount(bitmap & (bit - 1))].get( + shift + SHIFT, + keyHash, + key, + notSetValue + ); } update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { if (keyHash === undefined) { keyHash = hash(key); } - var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var bit = 1 << keyHashFrag; - var bitmap = this.bitmap; - var exists = (bitmap & bit) !== 0; + const keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; + const bit = 1 << keyHashFrag; + const bitmap = this.bitmap; + const exists = (bitmap & bit) !== 0; if (!exists && value === NOT_SET) { return this; } - var idx = popCount(bitmap & (bit - 1)); - var nodes = this.nodes; - var node = exists ? nodes[idx] : undefined; - var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); + const idx = popCount(bitmap & (bit - 1)); + const nodes = this.nodes; + const node = exists ? nodes[idx] : undefined; + const newNode = updateNode( + node, + ownerID, + shift + SHIFT, + keyHash, + key, + value, + didChangeSize, + didAlter + ); if (newNode === node) { return this; @@ -345,7 +306,12 @@ class BitmapIndexedNode { return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode); } - if (exists && !newNode && nodes.length === 2 && isLeafNode(nodes[idx ^ 1])) { + if ( + exists && + !newNode && + nodes.length === 2 && + isLeafNode(nodes[idx ^ 1]) + ) { return nodes[idx ^ 1]; } @@ -353,12 +319,13 @@ class BitmapIndexedNode { return newNode; } - var isEditable = ownerID && ownerID === this.ownerID; - var newBitmap = exists ? newNode ? bitmap : bitmap ^ bit : bitmap | bit; - var newNodes = exists ? newNode ? - setIn(nodes, idx, newNode, isEditable) : - spliceOut(nodes, idx, isEditable) : - spliceIn(nodes, idx, newNode, isEditable); + const isEditable = ownerID && ownerID === this.ownerID; + const newBitmap = exists ? (newNode ? bitmap : bitmap ^ bit) : bitmap | bit; + const newNodes = exists + ? newNode + ? setAt(nodes, idx, newNode, isEditable) + : spliceOut(nodes, idx, isEditable) + : spliceIn(nodes, idx, newNode, isEditable); if (isEditable) { this.bitmap = newBitmap; @@ -371,7 +338,6 @@ class BitmapIndexedNode { } class HashArrayMapNode { - constructor(ownerID, count, nodes) { this.ownerID = ownerID; this.count = count; @@ -382,30 +348,41 @@ class HashArrayMapNode { if (keyHash === undefined) { keyHash = hash(key); } - var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var node = this.nodes[idx]; - return node ? node.get(shift + SHIFT, keyHash, key, notSetValue) : notSetValue; + const idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; + const node = this.nodes[idx]; + return node + ? node.get(shift + SHIFT, keyHash, key, notSetValue) + : notSetValue; } update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { if (keyHash === undefined) { keyHash = hash(key); } - var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var removed = value === NOT_SET; - var nodes = this.nodes; - var node = nodes[idx]; + const idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; + const removed = value === NOT_SET; + const nodes = this.nodes; + const node = nodes[idx]; if (removed && !node) { return this; } - var newNode = updateNode(node, ownerID, shift + SHIFT, keyHash, key, value, didChangeSize, didAlter); + const newNode = updateNode( + node, + ownerID, + shift + SHIFT, + keyHash, + key, + value, + didChangeSize, + didAlter + ); if (newNode === node) { return this; } - var newCount = this.count; + let newCount = this.count; if (!node) { newCount++; } else if (!newNode) { @@ -415,8 +392,8 @@ class HashArrayMapNode { } } - var isEditable = ownerID && ownerID === this.ownerID; - var newNodes = setIn(nodes, idx, newNode, isEditable); + const isEditable = ownerID && ownerID === this.ownerID; + const newNodes = setAt(nodes, idx, newNode, isEditable); if (isEditable) { this.count = newCount; @@ -429,7 +406,6 @@ class HashArrayMapNode { } class HashCollisionNode { - constructor(ownerID, keyHash, entries) { this.ownerID = ownerID; this.keyHash = keyHash; @@ -437,8 +413,8 @@ class HashCollisionNode { } get(shift, keyHash, key, notSetValue) { - var entries = this.entries; - for (var ii = 0, len = entries.length; ii < len; ii++) { + const entries = this.entries; + for (let ii = 0, len = entries.length; ii < len; ii++) { if (is(key, entries[ii][0])) { return entries[ii][1]; } @@ -451,7 +427,7 @@ class HashCollisionNode { keyHash = hash(key); } - var removed = value === NOT_SET; + const removed = value === NOT_SET; if (keyHash !== this.keyHash) { if (removed) { @@ -462,32 +438,37 @@ class HashCollisionNode { return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]); } - var entries = this.entries; - var idx = 0; - for (var len = entries.length; idx < len; idx++) { + const entries = this.entries; + let idx = 0; + const len = entries.length; + for (; idx < len; idx++) { if (is(key, entries[idx][0])) { break; } } - var exists = idx < len; + const exists = idx < len; if (exists ? entries[idx][1] === value : removed) { return this; } SetRef(didAlter); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here (removed || !exists) && SetRef(didChangeSize); if (removed && len === 2) { return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]); } - var isEditable = ownerID && ownerID === this.ownerID; - var newEntries = isEditable ? entries : arrCopy(entries); + const isEditable = ownerID && ownerID === this.ownerID; + const newEntries = isEditable ? entries : arrCopy(entries); if (exists) { if (removed) { - idx === len - 1 ? newEntries.pop() : (newEntries[idx] = newEntries.pop()); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + idx === len - 1 + ? newEntries.pop() + : (newEntries[idx] = newEntries.pop()); } else { newEntries[idx] = [key, value]; } @@ -505,7 +486,6 @@ class HashCollisionNode { } class ValueNode { - constructor(ownerID, keyHash, entry) { this.ownerID = ownerID; this.keyHash = keyHash; @@ -517,8 +497,8 @@ class ValueNode { } update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { - var removed = value === NOT_SET; - var keyMatch = is(key, this.entry[0]); + const removed = value === NOT_SET; + const keyMatch = is(key, this.entry[0]); if (keyMatch ? value === this.entry[1] : removed) { return this; } @@ -543,36 +523,35 @@ class ValueNode { } } - // #pragma Iterators -ArrayMapNode.prototype.iterate = -HashCollisionNode.prototype.iterate = function (fn, reverse) { - var entries = this.entries; - for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) { - if (fn(entries[reverse ? maxIndex - ii : ii]) === false) { - return false; +ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = + function (fn, reverse) { + const entries = this.entries; + for (let ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) { + if (fn(entries[reverse ? maxIndex - ii : ii]) === false) { + return false; + } } - } -} + }; -BitmapIndexedNode.prototype.iterate = -HashArrayMapNode.prototype.iterate = function (fn, reverse) { - var nodes = this.nodes; - for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) { - var node = nodes[reverse ? maxIndex - ii : ii]; - if (node && node.iterate(fn, reverse) === false) { - return false; +BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = + function (fn, reverse) { + const nodes = this.nodes; + for (let ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) { + const node = nodes[reverse ? maxIndex - ii : ii]; + if (node && node.iterate(fn, reverse) === false) { + return false; + } } - } -} + }; +// eslint-disable-next-line @typescript-eslint/no-unused-vars ValueNode.prototype.iterate = function (fn, reverse) { return fn(this.entry); -} +}; class MapIterator extends Iterator { - constructor(map, type, reverse) { this._type = type; this._reverse = reverse; @@ -580,12 +559,12 @@ class MapIterator extends Iterator { } next() { - var type = this._type; - var stack = this._stack; + const type = this._type; + let stack = this._stack; while (stack) { - var node = stack.node; - var index = stack.index++; - var maxIndex; + const node = stack.node; + const index = stack.index++; + let maxIndex; if (node.entry) { if (index === 0) { return mapIteratorValue(type, node.entry); @@ -593,12 +572,15 @@ class MapIterator extends Iterator { } else if (node.entries) { maxIndex = node.entries.length - 1; if (index <= maxIndex) { - return mapIteratorValue(type, node.entries[this._reverse ? maxIndex - index : index]); + return mapIteratorValue( + type, + node.entries[this._reverse ? maxIndex - index : index] + ); } } else { maxIndex = node.nodes.length - 1; if (index <= maxIndex) { - var subNode = node.nodes[this._reverse ? maxIndex - index : index]; + const subNode = node.nodes[this._reverse ? maxIndex - index : index]; if (subNode) { if (subNode.entry) { return mapIteratorValue(type, subNode.entry); @@ -622,12 +604,12 @@ function mapIteratorFrame(node, prev) { return { node: node, index: 0, - __prev: prev + __prev: prev, }; } function makeMap(size, root, ownerID, hash) { - var map = Object.create(MapPrototype); + const map = Object.create(MapPrototype); map.size = size; map._root = root; map.__ownerID = ownerID; @@ -636,14 +618,14 @@ function makeMap(size, root, ownerID, hash) { return map; } -var EMPTY_MAP; +let EMPTY_MAP; export function emptyMap() { return EMPTY_MAP || (EMPTY_MAP = makeMap(0)); } function updateMap(map, k, v) { - var newRoot; - var newSize; + let newRoot; + let newSize; if (!map._root) { if (v === NOT_SET) { return map; @@ -651,13 +633,22 @@ function updateMap(map, k, v) { newSize = 1; newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]); } else { - var didChangeSize = MakeRef(CHANGE_LENGTH); - var didAlter = MakeRef(DID_ALTER); - newRoot = updateNode(map._root, map.__ownerID, 0, undefined, k, v, didChangeSize, didAlter); + const didChangeSize = MakeRef(); + const didAlter = MakeRef(); + newRoot = updateNode( + map._root, + map.__ownerID, + 0, + undefined, + k, + v, + didChangeSize, + didAlter + ); if (!didAlter.value) { return map; } - newSize = map.size + (didChangeSize.value ? v === NOT_SET ? -1 : 1 : 0); + newSize = map.size + (didChangeSize.value ? (v === NOT_SET ? -1 : 1) : 0); } if (map.__ownerID) { map.size = newSize; @@ -669,7 +660,16 @@ function updateMap(map, k, v) { return newRoot ? makeMap(newSize, newRoot) : emptyMap(); } -function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, didAlter) { +function updateNode( + node, + ownerID, + shift, + keyHash, + key, + value, + didChangeSize, + didAlter +) { if (!node) { if (value === NOT_SET) { return node; @@ -678,11 +678,21 @@ function updateNode(node, ownerID, shift, keyHash, key, value, didChangeSize, di SetRef(didChangeSize); return new ValueNode(ownerID, keyHash, [key, value]); } - return node.update(ownerID, shift, keyHash, key, value, didChangeSize, didAlter); + return node.update( + ownerID, + shift, + keyHash, + key, + value, + didChangeSize, + didAlter + ); } function isLeafNode(node) { - return node.constructor === ValueNode || node.constructor === HashCollisionNode; + return ( + node.constructor === ValueNode || node.constructor === HashCollisionNode + ); } function mergeIntoNode(node, ownerID, shift, keyHash, entry) { @@ -690,13 +700,15 @@ function mergeIntoNode(node, ownerID, shift, keyHash, entry) { return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]); } - var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK; - var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; + const idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK; + const idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK; - var newNode; - var nodes = idx1 === idx2 ? - [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] : - ((newNode = new ValueNode(ownerID, keyHash, entry)), idx1 < idx2 ? [node, newNode] : [newNode, node]); + let newNode; + const nodes = + idx1 === idx2 + ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)] + : ((newNode = new ValueNode(ownerID, keyHash, entry)), + idx1 < idx2 ? [node, newNode] : [newNode, node]); return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes); } @@ -705,20 +717,20 @@ function createNodes(ownerID, entries, key, value) { if (!ownerID) { ownerID = new OwnerID(); } - var node = new ValueNode(ownerID, hash(key), [key, value]); - for (var ii = 0; ii < entries.length; ii++) { - var entry = entries[ii]; + let node = new ValueNode(ownerID, hash(key), [key, value]); + for (let ii = 0; ii < entries.length; ii++) { + const entry = entries[ii]; node = node.update(ownerID, 0, undefined, entry[0], entry[1]); } return node; } function packNodes(ownerID, nodes, count, excluding) { - var bitmap = 0; - var packedII = 0; - var packedNodes = new Array(count); - for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) { - var node = nodes[ii]; + let bitmap = 0; + let packedII = 0; + const packedNodes = new Array(count); + for (let ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) { + const node = nodes[ii]; if (node !== undefined && ii !== excluding) { bitmap |= bit; packedNodes[packedII++] = node; @@ -728,117 +740,39 @@ function packNodes(ownerID, nodes, count, excluding) { } function expandNodes(ownerID, nodes, bitmap, including, node) { - var count = 0; - var expandedNodes = new Array(SIZE); - for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) { + let count = 0; + const expandedNodes = new Array(SIZE); + for (let ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) { expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined; } expandedNodes[including] = node; return new HashArrayMapNode(ownerID, count + 1, expandedNodes); } -function mergeIntoMapWith(map, merger, iterables) { - var iters = []; - for (var ii = 0; ii < iterables.length; ii++) { - var value = iterables[ii]; - var iter = KeyedIterable(value); - if (!isIterable(value)) { - iter = iter.map(v => fromJS(v)); - } - iters.push(iter); - } - return mergeIntoCollectionWith(map, merger, iters); -} - -export function deepMerger(existing, value, key) { - return existing && existing.mergeDeep && isIterable(value) ? - existing.mergeDeep(value) : - is(existing, value) ? existing : value; -} - -export function deepMergerWith(merger) { - return (existing, value, key) => { - if (existing && existing.mergeDeepWith && isIterable(value)) { - return existing.mergeDeepWith(merger, value); - } - var nextValue = merger(existing, value, key); - return is(existing, nextValue) ? existing : nextValue; - }; -} - -export function mergeIntoCollectionWith(collection, merger, iters) { - iters = iters.filter(x => x.size !== 0); - if (iters.length === 0) { - return collection; - } - if (collection.size === 0 && !collection.__ownerID && iters.length === 1) { - return collection.constructor(iters[0]); - } - return collection.withMutations(collection => { - var mergeIntoMap = merger ? - (value, key) => { - collection.update(key, NOT_SET, existing => - existing === NOT_SET ? value : merger(existing, value, key) - ); - } : - (value, key) => { - collection.set(key, value); - } - for (var ii = 0; ii < iters.length; ii++) { - iters[ii].forEach(mergeIntoMap); - } - }); -} - -function updateInDeepMap(existing, keyPathIter, notSetValue, updater) { - var isNotSet = existing === NOT_SET; - var step = keyPathIter.next(); - if (step.done) { - var existingValue = isNotSet ? notSetValue : existing; - var newValue = updater(existingValue); - return newValue === existingValue ? existing : newValue; - } - invariant( - isNotSet || (existing && existing.set), - 'invalid keyPath' - ); - var key = step.value; - var nextExisting = isNotSet ? NOT_SET : existing.get(key, NOT_SET); - var nextUpdated = updateInDeepMap( - nextExisting, - keyPathIter, - notSetValue, - updater - ); - return nextUpdated === nextExisting ? existing : - nextUpdated === NOT_SET ? existing.remove(key) : - (isNotSet ? emptyMap() : existing).set(key, nextUpdated); -} - function popCount(x) { - x = x - ((x >> 1) & 0x55555555); + x -= (x >> 1) & 0x55555555; x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x + (x >> 4)) & 0x0f0f0f0f; - x = x + (x >> 8); - x = x + (x >> 16); + x += x >> 8; + x += x >> 16; return x & 0x7f; } -function setIn(array, idx, val, canEdit) { - var newArray = canEdit ? array : arrCopy(array); +function setAt(array, idx, val, canEdit) { + const newArray = canEdit ? array : arrCopy(array); newArray[idx] = val; return newArray; } function spliceIn(array, idx, val, canEdit) { - var newLen = array.length + 1; + const newLen = array.length + 1; if (canEdit && idx + 1 === newLen) { array[idx] = val; return array; } - var newArray = new Array(newLen); - var after = 0; - for (var ii = 0; ii < newLen; ii++) { + const newArray = new Array(newLen); + let after = 0; + for (let ii = 0; ii < newLen; ii++) { if (ii === idx) { newArray[ii] = val; after = -1; @@ -850,14 +784,14 @@ function spliceIn(array, idx, val, canEdit) { } function spliceOut(array, idx, canEdit) { - var newLen = array.length - 1; + const newLen = array.length - 1; if (canEdit && idx === newLen) { array.pop(); return array; } - var newArray = new Array(newLen); - var after = 0; - for (var ii = 0; ii < newLen; ii++) { + const newArray = new Array(newLen); + let after = 0; + for (let ii = 0; ii < newLen; ii++) { if (ii === idx) { after = 1; } @@ -866,6 +800,6 @@ function spliceOut(array, idx, canEdit) { return newArray; } -var MAX_ARRAY_MAP_SIZE = SIZE / 4; -var MAX_BITMAP_INDEXED_SIZE = SIZE / 2; -var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4; +const MAX_ARRAY_MAP_SIZE = SIZE / 4; +const MAX_BITMAP_INDEXED_SIZE = SIZE / 2; +const MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4; diff --git a/src/Math.js b/src/Math.js index 7f5570b01b..0075e73cd3 100644 --- a/src/Math.js +++ b/src/Math.js @@ -1,28 +1,19 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -export var imul = - typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 ? - Math.imul : - function imul(a, b) { - a = a | 0; // int - b = b | 0; // int - var c = a & 0xffff; - var d = b & 0xffff; - // Shift by 0 fixes the sign on the high part. - return (c * d) + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0) | 0; // int - }; +export const imul = + typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2 + ? Math.imul + : function imul(a, b) { + a |= 0; // int + b |= 0; // int + const c = a & 0xffff; + const d = b & 0xffff; + // Shift by 0 fixes the sign on the high part. + return (c * d + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0)) | 0; // int + }; // v8 has an optimization for storing 31-bit signed numbers. // Values which have either 00 or 11 as the high order bits qualify. // This function drops the highest order bit in a signed number, maintaining // the sign bit. export function smi(i32) { - return ((i32 >>> 1) & 0x40000000) | (i32 & 0xBFFFFFFF); + return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff); } diff --git a/src/Operations.js b/src/Operations.js index 23dc744a14..bb3b16568d 100644 --- a/src/Operations.js +++ b/src/Operations.js @@ -1,24 +1,43 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { NOT_SET, ensureSize, wrapIndex, wholeSlice, resolveBegin, resolveEnd } from './TrieUtils' -import { isIterable, isKeyed, isIndexed, isOrdered, - Iterable, KeyedIterable, SetIterable, IndexedIterable, - IS_ORDERED_SENTINEL } from './Iterable' -import { getIterator, Iterator, iteratorValue, iteratorDone, - ITERATE_KEYS, ITERATE_VALUES, ITERATE_ENTRIES } from './Iterator' -import { isSeq, Seq, KeyedSeq, SetSeq, IndexedSeq, - keyedSeqFromValue, indexedSeqFromValue, ArraySeq } from './Seq' - -import { Map } from './Map' -import { OrderedMap } from './OrderedMap' - +import { + NOT_SET, + ensureSize, + wrapIndex, + wholeSlice, + resolveBegin, + resolveEnd, +} from './TrieUtils'; +import { + Collection, + KeyedCollection, + SetCollection, + IndexedCollection, +} from './Collection'; +import { isCollection } from './predicates/isCollection'; +import { IS_KEYED_SYMBOL, isKeyed } from './predicates/isKeyed'; +import { IS_INDEXED_SYMBOL, isIndexed } from './predicates/isIndexed'; +import { isOrdered, IS_ORDERED_SYMBOL } from './predicates/isOrdered'; +import { isSeq } from './predicates/isSeq'; +import { + getIterator, + Iterator, + iteratorValue, + iteratorDone, + ITERATE_KEYS, + ITERATE_VALUES, + ITERATE_ENTRIES, +} from './Iterator'; +import { + Seq, + KeyedSeq, + SetSeq, + IndexedSeq, + keyedSeqFromValue, + indexedSeqFromValue, + ArraySeq, +} from './Seq'; + +import { Map } from './Map'; +import { OrderedMap } from './OrderedMap'; export class ToKeyedSequence extends KeyedSeq { constructor(indexed, useKeys) { @@ -40,7 +59,7 @@ export class ToKeyedSequence extends KeyedSeq { } reverse() { - var reversedSequence = reverseFactory(this, true); + const reversedSequence = reverseFactory(this, true); if (!this._useKeys) { reversedSequence.valueSeq = () => this._iter.toSeq().reverse(); } @@ -48,7 +67,7 @@ export class ToKeyedSequence extends KeyedSeq { } map(mapper, context) { - var mappedSequence = mapFactory(this, mapper, context); + const mappedSequence = mapFactory(this, mapper, context); if (!this._useKeys) { mappedSequence.valueSeq = () => this._iter.toSeq().map(mapper, context); } @@ -63,8 +82,7 @@ export class ToKeyedSequence extends KeyedSeq { return this._iter.__iterator(type, reverse); } } -ToKeyedSequence.prototype[IS_ORDERED_SENTINEL] = true; - +ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true; export class ToIndexedSequence extends IndexedSeq { constructor(iter) { @@ -77,24 +95,34 @@ export class ToIndexedSequence extends IndexedSeq { } __iterate(fn, reverse) { - var i = 0; + let i = 0; + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here reverse && ensureSize(this); - return this._iter.__iterate(v => fn(v, reverse ? this.size - ++i : i++, this), reverse); + return this._iter.__iterate( + (v) => fn(v, reverse ? this.size - ++i : i++, this), + reverse + ); } __iterator(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); - var i = 0; + const iterator = this._iter.__iterator(ITERATE_VALUES, reverse); + let i = 0; + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here reverse && ensureSize(this); return new Iterator(() => { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, reverse ? this.size - ++i : i++, step.value, step) + const step = iterator.next(); + return step.done + ? step + : iteratorValue( + type, + reverse ? this.size - ++i : i++, + step.value, + step + ); }); } } - export class ToSetSequence extends SetSeq { constructor(iter) { this._iter = iter; @@ -106,36 +134,40 @@ export class ToSetSequence extends SetSeq { } __iterate(fn, reverse) { - return this._iter.__iterate(v => fn(v, v, this), reverse); + return this._iter.__iterate((v) => fn(v, v, this), reverse); } __iterator(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); + const iterator = this._iter.__iterator(ITERATE_VALUES, reverse); return new Iterator(() => { - var step = iterator.next(); - return step.done ? step : - iteratorValue(type, step.value, step.value, step); + const step = iterator.next(); + return step.done + ? step + : iteratorValue(type, step.value, step.value, step); }); } } - export class FromEntriesSequence extends KeyedSeq { constructor(entries) { this._iter = entries; this.size = entries.size; } + entrySeq() { + return this._iter.toSeq(); + } + __iterate(fn, reverse) { - return this._iter.__iterate(entry => { + return this._iter.__iterate((entry) => { // Check if entry exists first so array access doesn't throw for holes // in the parent iteration. if (entry) { validateEntry(entry); - var indexedIterable = isIterable(entry); + const indexedCollection = isCollection(entry); return fn( - indexedIterable ? entry.get(1) : entry[1], - indexedIterable ? entry.get(0) : entry[0], + indexedCollection ? entry.get(1) : entry[1], + indexedCollection ? entry.get(0) : entry[0], this ); } @@ -143,23 +175,23 @@ export class FromEntriesSequence extends KeyedSeq { } __iterator(type, reverse) { - var iterator = this._iter.__iterator(ITERATE_VALUES, reverse); + const iterator = this._iter.__iterator(ITERATE_VALUES, reverse); return new Iterator(() => { while (true) { - var step = iterator.next(); + const step = iterator.next(); if (step.done) { return step; } - var entry = step.value; + const entry = step.value; // Check if entry exists first so array access doesn't throw for holes // in the parent iteration. if (entry) { validateEntry(entry); - var indexedIterable = isIterable(entry); + const indexedCollection = isCollection(entry); return iteratorValue( type, - indexedIterable ? entry.get(0) : entry[0], - indexedIterable ? entry.get(1) : entry[1], + indexedCollection ? entry.get(0) : entry[0], + indexedCollection ? entry.get(1) : entry[1], step ); } @@ -169,123 +201,121 @@ export class FromEntriesSequence extends KeyedSeq { } ToIndexedSequence.prototype.cacheResult = -ToKeyedSequence.prototype.cacheResult = -ToSetSequence.prototype.cacheResult = -FromEntriesSequence.prototype.cacheResult = - cacheResultThrough; - - -export function flipFactory(iterable) { - var flipSequence = makeSequence(iterable); - flipSequence._iter = iterable; - flipSequence.size = iterable.size; - flipSequence.flip = () => iterable; + ToKeyedSequence.prototype.cacheResult = + ToSetSequence.prototype.cacheResult = + FromEntriesSequence.prototype.cacheResult = + cacheResultThrough; + +export function flipFactory(collection) { + const flipSequence = makeSequence(collection); + flipSequence._iter = collection; + flipSequence.size = collection.size; + flipSequence.flip = () => collection; flipSequence.reverse = function () { - var reversedSequence = iterable.reverse.apply(this); // super.reverse() - reversedSequence.flip = () => iterable.reverse(); + const reversedSequence = collection.reverse.apply(this); // super.reverse() + reversedSequence.flip = () => collection.reverse(); return reversedSequence; }; - flipSequence.has = key => iterable.includes(key); - flipSequence.includes = key => iterable.has(key); + flipSequence.has = (key) => collection.includes(key); + flipSequence.includes = (key) => collection.has(key); flipSequence.cacheResult = cacheResultThrough; flipSequence.__iterateUncached = function (fn, reverse) { - return iterable.__iterate((v, k) => fn(k, v, this) !== false, reverse); - } - flipSequence.__iteratorUncached = function(type, reverse) { + return collection.__iterate((v, k) => fn(k, v, this) !== false, reverse); + }; + flipSequence.__iteratorUncached = function (type, reverse) { if (type === ITERATE_ENTRIES) { - var iterator = iterable.__iterator(type, reverse); + const iterator = collection.__iterator(type, reverse); return new Iterator(() => { - var step = iterator.next(); + const step = iterator.next(); if (!step.done) { - var k = step.value[0]; + const k = step.value[0]; step.value[0] = step.value[1]; step.value[1] = k; } return step; }); } - return iterable.__iterator( + return collection.__iterator( type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES, reverse ); - } + }; return flipSequence; } - -export function mapFactory(iterable, mapper, context) { - var mappedSequence = makeSequence(iterable); - mappedSequence.size = iterable.size; - mappedSequence.has = key => iterable.has(key); +export function mapFactory(collection, mapper, context) { + const mappedSequence = makeSequence(collection); + mappedSequence.size = collection.size; + mappedSequence.has = (key) => collection.has(key); mappedSequence.get = (key, notSetValue) => { - var v = iterable.get(key, NOT_SET); - return v === NOT_SET ? - notSetValue : - mapper.call(context, v, key, iterable); + const v = collection.get(key, NOT_SET); + return v === NOT_SET + ? notSetValue + : mapper.call(context, v, key, collection); }; mappedSequence.__iterateUncached = function (fn, reverse) { - return iterable.__iterate( + return collection.__iterate( (v, k, c) => fn(mapper.call(context, v, k, c), k, this) !== false, reverse ); - } + }; mappedSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); + const iterator = collection.__iterator(ITERATE_ENTRIES, reverse); return new Iterator(() => { - var step = iterator.next(); + const step = iterator.next(); if (step.done) { return step; } - var entry = step.value; - var key = entry[0]; + const entry = step.value; + const key = entry[0]; return iteratorValue( type, key, - mapper.call(context, entry[1], key, iterable), + mapper.call(context, entry[1], key, collection), step ); }); - } + }; return mappedSequence; } - -export function reverseFactory(iterable, useKeys) { - var reversedSequence = makeSequence(iterable); - reversedSequence._iter = iterable; - reversedSequence.size = iterable.size; - reversedSequence.reverse = () => iterable; - if (iterable.flip) { +export function reverseFactory(collection, useKeys) { + const reversedSequence = makeSequence(collection); + reversedSequence._iter = collection; + reversedSequence.size = collection.size; + reversedSequence.reverse = () => collection; + if (collection.flip) { reversedSequence.flip = function () { - var flipSequence = flipFactory(iterable); - flipSequence.reverse = () => iterable.flip(); + const flipSequence = flipFactory(collection); + flipSequence.reverse = () => collection.flip(); return flipSequence; }; } reversedSequence.get = (key, notSetValue) => - iterable.get(useKeys ? key : -1 - key, notSetValue); - reversedSequence.has = key => - iterable.has(useKeys ? key : -1 - key); - reversedSequence.includes = value => iterable.includes(value); + collection.get(useKeys ? key : -1 - key, notSetValue); + reversedSequence.has = (key) => collection.has(useKeys ? key : -1 - key); + reversedSequence.includes = (value) => collection.includes(value); reversedSequence.cacheResult = cacheResultThrough; reversedSequence.__iterate = function (fn, reverse) { - var i = 0; - reverse && ensureSize(iterable); - return iterable.__iterate((v, k) => - fn(v, useKeys ? k : reverse ? this.size - ++i : i++, this), + let i = 0; + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + reverse && ensureSize(collection); + return collection.__iterate( + (v, k) => fn(v, useKeys ? k : reverse ? this.size - ++i : i++, this), !reverse ); }; reversedSequence.__iterator = (type, reverse) => { - var i = 0; - reverse && ensureSize(iterable); - var iterator = iterable.__iterator(ITERATE_ENTRIES, !reverse); + let i = 0; + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + reverse && ensureSize(collection); + const iterator = collection.__iterator(ITERATE_ENTRIES, !reverse); return new Iterator(() => { - var step = iterator.next(); + const step = iterator.next(); if (step.done) { return step; } - var entry = step.value; + const entry = step.value; return iteratorValue( type, useKeys ? entry[0] : reverse ? this.size - ++i : i++, @@ -293,27 +323,27 @@ export function reverseFactory(iterable, useKeys) { step ); }); - } + }; return reversedSequence; } - -export function filterFactory(iterable, predicate, context, useKeys) { - var filterSequence = makeSequence(iterable); +export function filterFactory(collection, predicate, context, useKeys) { + const filterSequence = makeSequence(collection); if (useKeys) { - filterSequence.has = key => { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && !!predicate.call(context, v, key, iterable); + filterSequence.has = (key) => { + const v = collection.get(key, NOT_SET); + return v !== NOT_SET && !!predicate.call(context, v, key, collection); }; filterSequence.get = (key, notSetValue) => { - var v = iterable.get(key, NOT_SET); - return v !== NOT_SET && predicate.call(context, v, key, iterable) ? - v : notSetValue; + const v = collection.get(key, NOT_SET); + return v !== NOT_SET && predicate.call(context, v, key, collection) + ? v + : notSetValue; }; } filterSequence.__iterateUncached = function (fn, reverse) { - var iterations = 0; - iterable.__iterate((v, k, c) => { + let iterations = 0; + collection.__iterate((v, k, c) => { if (predicate.call(context, v, k, c)) { iterations++; return fn(v, useKeys ? k : iterations - 1, this); @@ -322,124 +352,135 @@ export function filterFactory(iterable, predicate, context, useKeys) { return iterations; }; filterSequence.__iteratorUncached = function (type, reverse) { - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterations = 0; + const iterator = collection.__iterator(ITERATE_ENTRIES, reverse); + let iterations = 0; return new Iterator(() => { while (true) { - var step = iterator.next(); + const step = iterator.next(); if (step.done) { return step; } - var entry = step.value; - var key = entry[0]; - var value = entry[1]; - if (predicate.call(context, value, key, iterable)) { + const entry = step.value; + const key = entry[0]; + const value = entry[1]; + if (predicate.call(context, value, key, collection)) { return iteratorValue(type, useKeys ? key : iterations++, value, step); } } }); - } + }; return filterSequence; } - -export function countByFactory(iterable, grouper, context) { - var groups = Map().asMutable(); - iterable.__iterate((v, k) => { - groups.update( - grouper.call(context, v, k, iterable), - 0, - a => a + 1 - ); +export function countByFactory(collection, grouper, context) { + const groups = Map().asMutable(); + collection.__iterate((v, k) => { + groups.update(grouper.call(context, v, k, collection), 0, (a) => a + 1); }); return groups.asImmutable(); } - -export function groupByFactory(iterable, grouper, context) { - var isKeyedIter = isKeyed(iterable); - var groups = (isOrdered(iterable) ? OrderedMap() : Map()).asMutable(); - iterable.__iterate((v, k) => { +export function groupByFactory(collection, grouper, context) { + const isKeyedIter = isKeyed(collection); + const groups = (isOrdered(collection) ? OrderedMap() : Map()).asMutable(); + collection.__iterate((v, k) => { groups.update( - grouper.call(context, v, k, iterable), - a => (a = a || [], a.push(isKeyedIter ? [k, v] : v), a) + grouper.call(context, v, k, collection), + (a) => ((a = a || []), a.push(isKeyedIter ? [k, v] : v), a) ); }); - var coerce = iterableClass(iterable); - return groups.map(arr => reify(iterable, coerce(arr))); + const coerce = collectionClass(collection); + return groups.map((arr) => reify(collection, coerce(arr))).asImmutable(); } +export function partitionFactory(collection, predicate, context) { + const isKeyedIter = isKeyed(collection); + const groups = [[], []]; + collection.__iterate((v, k) => { + groups[predicate.call(context, v, k, collection) ? 1 : 0].push( + isKeyedIter ? [k, v] : v + ); + }); + const coerce = collectionClass(collection); + return groups.map((arr) => reify(collection, coerce(arr))); +} -export function sliceFactory(iterable, begin, end, useKeys) { - var originalSize = iterable.size; +export function sliceFactory(collection, begin, end, useKeys) { + const originalSize = collection.size; if (wholeSlice(begin, end, originalSize)) { - return iterable; + return collection; } - var resolvedBegin = resolveBegin(begin, originalSize); - var resolvedEnd = resolveEnd(end, originalSize); - - // begin or end will be NaN if they were provided as negative numbers and - // this iterable's size is unknown. In that case, cache first so there is + // begin or end can not be resolved if they were provided as negative numbers and + // this collection's size is unknown. In that case, cache first so there is // a known size and these do not resolve to NaN. - if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) { - return sliceFactory(iterable.toSeq().cacheResult(), begin, end, useKeys); + if (typeof originalSize === 'undefined' && (begin < 0 || end < 0)) { + return sliceFactory(collection.toSeq().cacheResult(), begin, end, useKeys); } + const resolvedBegin = resolveBegin(begin, originalSize); + const resolvedEnd = resolveEnd(end, originalSize); + // Note: resolvedEnd is undefined when the original sequence's length is // unknown and this slice did not supply an end and should contain all // elements after resolvedBegin. // In that case, resolvedSize will be NaN and sliceSize will remain undefined. - var resolvedSize = resolvedEnd - resolvedBegin; - var sliceSize; + const resolvedSize = resolvedEnd - resolvedBegin; + let sliceSize; if (resolvedSize === resolvedSize) { sliceSize = resolvedSize < 0 ? 0 : resolvedSize; } - var sliceSeq = makeSequence(iterable); + const sliceSeq = makeSequence(collection); - // If iterable.size is undefined, the size of the realized sliceSeq is + // If collection.size is undefined, the size of the realized sliceSeq is // unknown at this point unless the number of items to slice is 0 - sliceSeq.size = sliceSize === 0 ? sliceSize : iterable.size && sliceSize || undefined; + sliceSeq.size = + sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined; - if (!useKeys && isSeq(iterable) && sliceSize >= 0) { + if (!useKeys && isSeq(collection) && sliceSize >= 0) { sliceSeq.get = function (index, notSetValue) { index = wrapIndex(this, index); - return index >= 0 && index < sliceSize ? - iterable.get(index + resolvedBegin, notSetValue) : - notSetValue; - } + return index >= 0 && index < sliceSize + ? collection.get(index + resolvedBegin, notSetValue) + : notSetValue; + }; } - sliceSeq.__iterateUncached = function(fn, reverse) { + sliceSeq.__iterateUncached = function (fn, reverse) { if (sliceSize === 0) { return 0; } if (reverse) { return this.cacheResult().__iterate(fn, reverse); } - var skipped = 0; - var isSkipping = true; - var iterations = 0; - iterable.__iterate((v, k) => { + let skipped = 0; + let isSkipping = true; + let iterations = 0; + collection.__iterate((v, k) => { if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) { iterations++; - return fn(v, useKeys ? k : iterations - 1, this) !== false && - iterations !== sliceSize; + return ( + fn(v, useKeys ? k : iterations - 1, this) !== false && + iterations !== sliceSize + ); } }); return iterations; }; - sliceSeq.__iteratorUncached = function(type, reverse) { + sliceSeq.__iteratorUncached = function (type, reverse) { if (sliceSize !== 0 && reverse) { return this.cacheResult().__iterator(type, reverse); } // Don't bother instantiating parent iterator if taking 0. - var iterator = sliceSize !== 0 && iterable.__iterator(type, reverse); - var skipped = 0; - var iterations = 0; + if (sliceSize === 0) { + return new Iterator(iteratorDone); + } + const iterator = collection.__iterator(type, reverse); + let skipped = 0; + let iterations = 0; return new Iterator(() => { while (skipped++ < resolvedBegin) { iterator.next(); @@ -447,71 +488,69 @@ export function sliceFactory(iterable, begin, end, useKeys) { if (++iterations > sliceSize) { return iteratorDone(); } - var step = iterator.next(); - if (useKeys || type === ITERATE_VALUES) { + const step = iterator.next(); + if (useKeys || type === ITERATE_VALUES || step.done) { return step; - } else if (type === ITERATE_KEYS) { + } + if (type === ITERATE_KEYS) { return iteratorValue(type, iterations - 1, undefined, step); - } else { - return iteratorValue(type, iterations - 1, step.value[1], step); } + return iteratorValue(type, iterations - 1, step.value[1], step); }); - } + }; return sliceSeq; } - -export function takeWhileFactory(iterable, predicate, context) { - var takeSequence = makeSequence(iterable); - takeSequence.__iterateUncached = function(fn, reverse) { +export function takeWhileFactory(collection, predicate, context) { + const takeSequence = makeSequence(collection); + takeSequence.__iterateUncached = function (fn, reverse) { if (reverse) { return this.cacheResult().__iterate(fn, reverse); } - var iterations = 0; - iterable.__iterate((v, k, c) => - predicate.call(context, v, k, c) && ++iterations && fn(v, k, this) + let iterations = 0; + collection.__iterate( + (v, k, c) => + predicate.call(context, v, k, c) && ++iterations && fn(v, k, this) ); return iterations; }; - takeSequence.__iteratorUncached = function(type, reverse) { + takeSequence.__iteratorUncached = function (type, reverse) { if (reverse) { return this.cacheResult().__iterator(type, reverse); } - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var iterating = true; + const iterator = collection.__iterator(ITERATE_ENTRIES, reverse); + let iterating = true; return new Iterator(() => { if (!iterating) { return iteratorDone(); } - var step = iterator.next(); + const step = iterator.next(); if (step.done) { return step; } - var entry = step.value; - var k = entry[0]; - var v = entry[1]; + const entry = step.value; + const k = entry[0]; + const v = entry[1]; if (!predicate.call(context, v, k, this)) { iterating = false; return iteratorDone(); } - return type === ITERATE_ENTRIES ? step : - iteratorValue(type, k, v, step); + return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step); }); }; return takeSequence; } - -export function skipWhileFactory(iterable, predicate, context, useKeys) { - var skipSequence = makeSequence(iterable); +export function skipWhileFactory(collection, predicate, context, useKeys) { + const skipSequence = makeSequence(collection); skipSequence.__iterateUncached = function (fn, reverse) { if (reverse) { return this.cacheResult().__iterate(fn, reverse); } - var isSkipping = true; - var iterations = 0; - iterable.__iterate((v, k, c) => { + let isSkipping = true; + let iterations = 0; + collection.__iterate((v, k, c) => { if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) { iterations++; return fn(v, useKeys ? k : iterations - 1, this); @@ -519,127 +558,211 @@ export function skipWhileFactory(iterable, predicate, context, useKeys) { }); return iterations; }; - skipSequence.__iteratorUncached = function(type, reverse) { + skipSequence.__iteratorUncached = function (type, reverse) { if (reverse) { return this.cacheResult().__iterator(type, reverse); } - var iterator = iterable.__iterator(ITERATE_ENTRIES, reverse); - var skipping = true; - var iterations = 0; + const iterator = collection.__iterator(ITERATE_ENTRIES, reverse); + let skipping = true; + let iterations = 0; return new Iterator(() => { - var step, k, v; + let step; + let k; + let v; do { step = iterator.next(); if (step.done) { if (useKeys || type === ITERATE_VALUES) { return step; - } else if (type === ITERATE_KEYS) { + } + if (type === ITERATE_KEYS) { return iteratorValue(type, iterations++, undefined, step); - } else { - return iteratorValue(type, iterations++, step.value[1], step); } + return iteratorValue(type, iterations++, step.value[1], step); } - var entry = step.value; + const entry = step.value; k = entry[0]; v = entry[1]; + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here skipping && (skipping = predicate.call(context, v, k, this)); } while (skipping); - return type === ITERATE_ENTRIES ? step : - iteratorValue(type, k, v, step); + return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step); }); }; return skipSequence; } +class ConcatSeq extends Seq { + constructor(iterables) { + this._wrappedIterables = iterables.flatMap((iterable) => { + if (iterable._wrappedIterables) { + return iterable._wrappedIterables; + } + return [iterable]; + }); + this.size = this._wrappedIterables.reduce((sum, iterable) => { + if (sum !== undefined) { + const size = iterable.size; + if (size !== undefined) { + return sum + size; + } + } + }, 0); + this[IS_KEYED_SYMBOL] = this._wrappedIterables[0][IS_KEYED_SYMBOL]; + this[IS_INDEXED_SYMBOL] = this._wrappedIterables[0][IS_INDEXED_SYMBOL]; + this[IS_ORDERED_SYMBOL] = this._wrappedIterables[0][IS_ORDERED_SYMBOL]; + } -export function concatFactory(iterable, values) { - var isKeyedIterable = isKeyed(iterable); - var iters = [iterable].concat(values).map(v => { - if (!isIterable(v)) { - v = isKeyedIterable ? - keyedSeqFromValue(v) : - indexedSeqFromValue(Array.isArray(v) ? v : [v]); - } else if (isKeyedIterable) { - v = KeyedIterable(v); + __iterateUncached(fn, reverse) { + if (this._wrappedIterables.length === 0) { + return; } - return v; - }).filter(v => v.size !== 0); + + if (reverse) { + return this.cacheResult().__iterate(fn, reverse); + } + + let iterableIndex = 0; + const useKeys = isKeyed(this); + const iteratorType = useKeys ? ITERATE_ENTRIES : ITERATE_VALUES; + let currentIterator = this._wrappedIterables[iterableIndex].__iterator( + iteratorType, + reverse + ); + + let keepGoing = true; + let index = 0; + while (keepGoing) { + let next = currentIterator.next(); + while (next.done) { + iterableIndex++; + if (iterableIndex === this._wrappedIterables.length) { + return index; + } + currentIterator = this._wrappedIterables[iterableIndex].__iterator( + iteratorType, + reverse + ); + next = currentIterator.next(); + } + const fnResult = useKeys + ? fn(next.value[1], next.value[0], this) + : fn(next.value, index, this); + keepGoing = fnResult !== false; + index++; + } + return index; + } + + __iteratorUncached(type, reverse) { + if (this._wrappedIterables.length === 0) { + return new Iterator(iteratorDone); + } + + if (reverse) { + return this.cacheResult().__iterator(type, reverse); + } + + let iterableIndex = 0; + let currentIterator = this._wrappedIterables[iterableIndex].__iterator( + type, + reverse + ); + return new Iterator(() => { + let next = currentIterator.next(); + while (next.done) { + iterableIndex++; + if (iterableIndex === this._wrappedIterables.length) { + return next; + } + currentIterator = this._wrappedIterables[iterableIndex].__iterator( + type, + reverse + ); + next = currentIterator.next(); + } + return next; + }); + } +} + +export function concatFactory(collection, values) { + const isKeyedCollection = isKeyed(collection); + const iters = [collection] + .concat(values) + .map((v) => { + if (!isCollection(v)) { + v = isKeyedCollection + ? keyedSeqFromValue(v) + : indexedSeqFromValue(Array.isArray(v) ? v : [v]); + } else if (isKeyedCollection) { + v = KeyedCollection(v); + } + return v; + }) + .filter((v) => v.size !== 0); if (iters.length === 0) { - return iterable; + return collection; } if (iters.length === 1) { - var singleton = iters[0]; - if (singleton === iterable || - isKeyedIterable && isKeyed(singleton) || - isIndexed(iterable) && isIndexed(singleton)) { + const singleton = iters[0]; + if ( + singleton === collection || + (isKeyedCollection && isKeyed(singleton)) || + (isIndexed(collection) && isIndexed(singleton)) + ) { return singleton; } } - var concatSeq = new ArraySeq(iters); - if (isKeyedIterable) { - concatSeq = concatSeq.toKeyedSeq(); - } else if (!isIndexed(iterable)) { - concatSeq = concatSeq.toSetSeq(); - } - concatSeq = concatSeq.flatten(true); - concatSeq.size = iters.reduce( - (sum, seq) => { - if (sum !== undefined) { - var size = seq.size; - if (size !== undefined) { - return sum + size; - } - } - }, - 0 - ); - return concatSeq; + return new ConcatSeq(iters); } - -export function flattenFactory(iterable, depth, useKeys) { - var flatSequence = makeSequence(iterable); - flatSequence.__iterateUncached = function(fn, reverse) { +export function flattenFactory(collection, depth, useKeys) { + const flatSequence = makeSequence(collection); + flatSequence.__iterateUncached = function (fn, reverse) { if (reverse) { return this.cacheResult().__iterate(fn, reverse); } - var iterations = 0; - var stopped = false; + let iterations = 0; + let stopped = false; function flatDeep(iter, currentDepth) { iter.__iterate((v, k) => { - if ((!depth || currentDepth < depth) && isIterable(v)) { + if ((!depth || currentDepth < depth) && isCollection(v)) { flatDeep(v, currentDepth + 1); - } else if (fn(v, useKeys ? k : iterations++, flatSequence) === false) { - stopped = true; + } else { + iterations++; + if (fn(v, useKeys ? k : iterations - 1, flatSequence) === false) { + stopped = true; + } } return !stopped; }, reverse); } - flatDeep(iterable, 0); + flatDeep(collection, 0); return iterations; - } - flatSequence.__iteratorUncached = function(type, reverse) { + }; + flatSequence.__iteratorUncached = function (type, reverse) { if (reverse) { return this.cacheResult().__iterator(type, reverse); } - var iterator = iterable.__iterator(type, reverse); - var stack = []; - var iterations = 0; + let iterator = collection.__iterator(type, reverse); + const stack = []; + let iterations = 0; return new Iterator(() => { while (iterator) { - var step = iterator.next(); + const step = iterator.next(); if (step.done !== false) { iterator = stack.pop(); continue; } - var v = step.value; + let v = step.value; if (type === ITERATE_ENTRIES) { v = v[1]; } - if ((!depth || stack.length < depth) && isIterable(v)) { + if ((!depth || stack.length < depth) && isCollection(v)) { stack.push(iterator); iterator = v.__iterator(type, reverse); } else { @@ -648,35 +771,35 @@ export function flattenFactory(iterable, depth, useKeys) { } return iteratorDone(); }); - } + }; return flatSequence; } - -export function flatMapFactory(iterable, mapper, context) { - var coerce = iterableClass(iterable); - return iterable.toSeq().map( - (v, k) => coerce(mapper.call(context, v, k, iterable)) - ).flatten(true); +export function flatMapFactory(collection, mapper, context) { + const coerce = collectionClass(collection); + return collection + .toSeq() + .map((v, k) => coerce(mapper.call(context, v, k, collection))) + .flatten(true); } - -export function interposeFactory(iterable, separator) { - var interposedSequence = makeSequence(iterable); - interposedSequence.size = iterable.size && iterable.size * 2 -1; - interposedSequence.__iterateUncached = function(fn, reverse) { - var iterations = 0; - iterable.__iterate((v, k) => - (!iterations || fn(separator, iterations++, this) !== false) && - fn(v, iterations++, this) !== false, +export function interposeFactory(collection, separator) { + const interposedSequence = makeSequence(collection); + interposedSequence.size = collection.size && collection.size * 2 - 1; + interposedSequence.__iterateUncached = function (fn, reverse) { + let iterations = 0; + collection.__iterate( + (v) => + (!iterations || fn(separator, iterations++, this) !== false) && + fn(v, iterations++, this) !== false, reverse ); return iterations; }; - interposedSequence.__iteratorUncached = function(type, reverse) { - var iterator = iterable.__iterator(ITERATE_VALUES, reverse); - var iterations = 0; - var step; + interposedSequence.__iteratorUncached = function (type, reverse) { + const iterator = collection.__iterator(ITERATE_VALUES, reverse); + let iterations = 0; + let step; return new Iterator(() => { if (!step || iterations % 2) { step = iterator.next(); @@ -684,63 +807,74 @@ export function interposeFactory(iterable, separator) { return step; } } - return iterations % 2 ? - iteratorValue(type, iterations++, separator) : - iteratorValue(type, iterations++, step.value, step); + return iterations % 2 + ? iteratorValue(type, iterations++, separator) + : iteratorValue(type, iterations++, step.value, step); }); }; return interposedSequence; } - -export function sortFactory(iterable, comparator, mapper) { +export function sortFactory(collection, comparator, mapper) { if (!comparator) { comparator = defaultComparator; } - var isKeyedIterable = isKeyed(iterable); - var index = 0; - var entries = iterable.toSeq().map( - (v, k) => [k, v, index++, mapper ? mapper(v, k, iterable) : v] - ).toArray(); - entries.sort((a, b) => comparator(a[3], b[3]) || a[2] - b[2]).forEach( - isKeyedIterable ? - (v, i) => { entries[i].length = 2; } : - (v, i) => { entries[i] = v[1]; } - ); - return isKeyedIterable ? KeyedSeq(entries) : - isIndexed(iterable) ? IndexedSeq(entries) : - SetSeq(entries); + const isKeyedCollection = isKeyed(collection); + let index = 0; + const entries = collection + .toSeq() + .map((v, k) => [k, v, index++, mapper ? mapper(v, k, collection) : v]) + .valueSeq() + .toArray(); + entries + .sort((a, b) => comparator(a[3], b[3]) || a[2] - b[2]) + .forEach( + isKeyedCollection + ? (v, i) => { + entries[i].length = 2; + } + : (v, i) => { + entries[i] = v[1]; + } + ); + return isKeyedCollection + ? KeyedSeq(entries) + : isIndexed(collection) + ? IndexedSeq(entries) + : SetSeq(entries); } - -export function maxFactory(iterable, comparator, mapper) { +export function maxFactory(collection, comparator, mapper) { if (!comparator) { comparator = defaultComparator; } if (mapper) { - var entry = iterable.toSeq() - .map((v, k) => [v, mapper(v, k, iterable)]) - .reduce((a, b) => maxCompare(comparator, a[1], b[1]) ? b : a); + const entry = collection + .toSeq() + .map((v, k) => [v, mapper(v, k, collection)]) + .reduce((a, b) => (maxCompare(comparator, a[1], b[1]) ? b : a)); return entry && entry[0]; - } else { - return iterable.reduce((a, b) => maxCompare(comparator, a, b) ? b : a); } + return collection.reduce((a, b) => (maxCompare(comparator, a, b) ? b : a)); } function maxCompare(comparator, a, b) { - var comp = comparator(b, a); + const comp = comparator(b, a); // b is considered the new max if the comparator declares them equal, but // they are not equal and b is in fact a nullish value. - return (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || comp > 0; + return ( + (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) || + comp > 0 + ); } - -export function zipWithFactory(keyIter, zipper, iters) { - var zipSequence = makeSequence(keyIter); - zipSequence.size = new ArraySeq(iters).map(i => i.size).min(); +export function zipWithFactory(keyIter, zipper, iters, zipAll) { + const zipSequence = makeSequence(keyIter); + const sizes = new ArraySeq(iters).map((i) => i.size); + zipSequence.size = zipAll ? sizes.max() : sizes.min(); // Note: this a generic base implementation of __iterate in terms of // __iterator which may be more generically useful in the future. - zipSequence.__iterate = function(fn, reverse) { + zipSequence.__iterate = function (fn, reverse) { /* generic: var iterator = this.__iterator(ITERATE_ENTRIES, reverse); var step; @@ -754,9 +888,9 @@ export function zipWithFactory(keyIter, zipper, iters) { return iterations; */ // indexed: - var iterator = this.__iterator(ITERATE_VALUES, reverse); - var step; - var iterations = 0; + const iterator = this.__iterator(ITERATE_VALUES, reverse); + let step; + let iterations = 0; while (!(step = iterator.next()).done) { if (fn(step.value, iterations++, this) === false) { break; @@ -764,17 +898,19 @@ export function zipWithFactory(keyIter, zipper, iters) { } return iterations; }; - zipSequence.__iteratorUncached = function(type, reverse) { - var iterators = iters.map(i => - (i = Iterable(i), getIterator(reverse ? i.reverse() : i)) + zipSequence.__iteratorUncached = function (type, reverse) { + const iterators = iters.map( + (i) => ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)) ); - var iterations = 0; - var isDone = false; + let iterations = 0; + let isDone = false; return new Iterator(() => { - var steps; + let steps; if (!isDone) { - steps = iterators.map(i => i.next()); - isDone = steps.some(s => s.done); + steps = iterators.map((i) => i.next()); + isDone = zipAll + ? steps.every((s) => s.done) + : steps.some((s) => s.done); } if (isDone) { return iteratorDone(); @@ -782,14 +918,16 @@ export function zipWithFactory(keyIter, zipper, iters) { return iteratorValue( type, iterations++, - zipper.apply(null, steps.map(s => s.value)) + zipper.apply( + null, + steps.map((s) => s.value) + ) ); }); }; - return zipSequence + return zipSequence; } - // #pragma Helper Functions export function reify(iter, seq) { @@ -802,18 +940,21 @@ function validateEntry(entry) { } } -function iterableClass(iterable) { - return isKeyed(iterable) ? KeyedIterable : - isIndexed(iterable) ? IndexedIterable : - SetIterable; +function collectionClass(collection) { + return isKeyed(collection) + ? KeyedCollection + : isIndexed(collection) + ? IndexedCollection + : SetCollection; } -function makeSequence(iterable) { +function makeSequence(collection) { return Object.create( - ( - isKeyed(iterable) ? KeyedSeq : - isIndexed(iterable) ? IndexedSeq : - SetSeq + (isKeyed(collection) + ? KeyedSeq + : isIndexed(collection) + ? IndexedSeq + : SetSeq ).prototype ); } @@ -823,9 +964,8 @@ function cacheResultThrough() { this._iter.cacheResult(); this.size = this._iter.size; return this; - } else { - return Seq.prototype.cacheResult.call(this); } + return Seq.prototype.cacheResult.call(this); } function defaultComparator(a, b) { diff --git a/src/OrderedMap.js b/src/OrderedMap.js index 2351a70c93..c6867b6c83 100644 --- a/src/OrderedMap.js +++ b/src/OrderedMap.js @@ -1,31 +1,25 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { KeyedIterable, IS_ORDERED_SENTINEL, isOrdered } from './Iterable' -import { Map, isMap, emptyMap } from './Map' -import { emptyList } from './List' -import { DELETE, NOT_SET, SIZE } from './TrieUtils' -import assertNotInfinite from './utils/assertNotInfinite' - +import { KeyedCollection } from './Collection'; +import { IS_ORDERED_SYMBOL } from './predicates/isOrdered'; +import { isOrderedMap } from './predicates/isOrderedMap'; +import { Map, emptyMap } from './Map'; +import { emptyList } from './List'; +import { DELETE, NOT_SET, SIZE } from './TrieUtils'; +import assertNotInfinite from './utils/assertNotInfinite'; export class OrderedMap extends Map { - // @pragma Construction constructor(value) { - return value === null || value === undefined ? emptyOrderedMap() : - isOrderedMap(value) ? value : - emptyOrderedMap().withMutations(map => { - var iter = KeyedIterable(value); - assertNotInfinite(iter.size); - iter.forEach((v, k) => map.set(k, v)); - }); + // eslint-disable-next-line no-constructor-return + return value === undefined || value === null + ? emptyOrderedMap() + : isOrderedMap(value) + ? value + : emptyOrderedMap().withMutations((map) => { + const iter = KeyedCollection(value); + assertNotInfinite(iter.size); + iter.forEach((v, k) => map.set(k, v)); + }); } static of(/*...values*/) { @@ -39,7 +33,7 @@ export class OrderedMap extends Map { // @pragma Access get(k, notSetValue) { - var index = this._map.get(k); + const index = this._map.get(k); return index !== undefined ? this._list.get(index)[1] : notSetValue; } @@ -53,6 +47,7 @@ export class OrderedMap extends Map { this.size = 0; this._map.clear(); this._list.clear(); + this.__altered = true; return this; } return emptyOrderedMap(); @@ -66,13 +61,9 @@ export class OrderedMap extends Map { return updateOrderedMap(this, k, NOT_SET); } - wasAltered() { - return this._map.wasAltered() || this._list.wasAltered(); - } - __iterate(fn, reverse) { return this._list.__iterate( - entry => entry && fn(entry[1], entry[0], this), + (entry) => entry && fn(entry[1], entry[0], this), reverse ); } @@ -85,10 +76,14 @@ export class OrderedMap extends Map { if (ownerID === this.__ownerID) { return this; } - var newMap = this._map.__ensureOwner(ownerID); - var newList = this._list.__ensureOwner(ownerID); + const newMap = this._map.__ensureOwner(ownerID); + const newList = this._list.__ensureOwner(ownerID); if (!ownerID) { + if (this.size === 0) { + return emptyOrderedMap(); + } this.__ownerID = ownerID; + this.__altered = false; this._map = newMap; this._list = newList; return this; @@ -97,46 +92,49 @@ export class OrderedMap extends Map { } } -function isOrderedMap(maybeOrderedMap) { - return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); -} - OrderedMap.isOrderedMap = isOrderedMap; -OrderedMap.prototype[IS_ORDERED_SENTINEL] = true; +OrderedMap.prototype[IS_ORDERED_SYMBOL] = true; OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove; - - function makeOrderedMap(map, list, ownerID, hash) { - var omap = Object.create(OrderedMap.prototype); + const omap = Object.create(OrderedMap.prototype); omap.size = map ? map.size : 0; omap._map = map; omap._list = list; omap.__ownerID = ownerID; omap.__hash = hash; + omap.__altered = false; return omap; } -var EMPTY_ORDERED_MAP; +let EMPTY_ORDERED_MAP; export function emptyOrderedMap() { - return EMPTY_ORDERED_MAP || (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())); + return ( + EMPTY_ORDERED_MAP || + (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList())) + ); } function updateOrderedMap(omap, k, v) { - var map = omap._map; - var list = omap._list; - var i = map.get(k); - var has = i !== undefined; - var newMap; - var newList; - if (v === NOT_SET) { // removed + const map = omap._map; + const list = omap._list; + const i = map.get(k); + const has = i !== undefined; + let newMap; + let newList; + if (v === NOT_SET) { + // removed if (!has) { return omap; } if (list.size >= SIZE && list.size >= map.size * 2) { newList = list.filter((entry, idx) => entry !== undefined && i !== idx); - newMap = newList.toKeyedSeq().map(entry => entry[0]).flip().toMap(); + newMap = newList + .toKeyedSeq() + .map((entry) => entry[0]) + .flip() + .toMap(); if (omap.__ownerID) { newMap.__ownerID = newList.__ownerID = omap.__ownerID; } @@ -144,23 +142,22 @@ function updateOrderedMap(omap, k, v) { newMap = map.remove(k); newList = i === list.size - 1 ? list.pop() : list.set(i, undefined); } - } else { - if (has) { - if (v === list.get(i)[1]) { - return omap; - } - newMap = map; - newList = list.set(i, [k, v]); - } else { - newMap = map.set(k, list.size); - newList = list.set(list.size, [k, v]); + } else if (has) { + if (v === list.get(i)[1]) { + return omap; } + newMap = map; + newList = list.set(i, [k, v]); + } else { + newMap = map.set(k, list.size); + newList = list.set(list.size, [k, v]); } if (omap.__ownerID) { omap.size = newMap.size; omap._map = newMap; omap._list = newList; omap.__hash = undefined; + omap.__altered = true; return omap; } return makeOrderedMap(newMap, newList); diff --git a/src/OrderedSet.js b/src/OrderedSet.js index e9066894c0..98da36416f 100644 --- a/src/OrderedSet.js +++ b/src/OrderedSet.js @@ -1,31 +1,25 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { SetIterable, KeyedIterable, IS_ORDERED_SENTINEL, isOrdered } from './Iterable' -import { IndexedIterablePrototype } from './IterableImpl' -import { Set, isSet } from './Set' -import { emptyOrderedMap } from './OrderedMap' -import assertNotInfinite from './utils/assertNotInfinite' - +import { SetCollection, KeyedCollection } from './Collection'; +import { IS_ORDERED_SYMBOL } from './predicates/isOrdered'; +import { isOrderedSet } from './predicates/isOrderedSet'; +import { IndexedCollectionPrototype } from './CollectionImpl'; +import { Set } from './Set'; +import { emptyOrderedMap } from './OrderedMap'; +import assertNotInfinite from './utils/assertNotInfinite'; export class OrderedSet extends Set { - // @pragma Construction constructor(value) { - return value === null || value === undefined ? emptyOrderedSet() : - isOrderedSet(value) ? value : - emptyOrderedSet().withMutations(set => { - var iter = SetIterable(value); - assertNotInfinite(iter.size); - iter.forEach(v => set.add(v)); - }); + // eslint-disable-next-line no-constructor-return + return value === undefined || value === null + ? emptyOrderedSet() + : isOrderedSet(value) + ? value + : emptyOrderedSet().withMutations((set) => { + const iter = SetCollection(value); + assertNotInfinite(iter.size); + iter.forEach((v) => set.add(v)); + }); } static of(/*...values*/) { @@ -33,7 +27,7 @@ export class OrderedSet extends Set { } static fromKeys(value) { - return this(KeyedIterable(value).keySeq()); + return this(KeyedCollection(value).keySeq()); } toString() { @@ -41,29 +35,28 @@ export class OrderedSet extends Set { } } -function isOrderedSet(maybeOrderedSet) { - return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet); -} - OrderedSet.isOrderedSet = isOrderedSet; -var OrderedSetPrototype = OrderedSet.prototype; -OrderedSetPrototype[IS_ORDERED_SENTINEL] = true; -OrderedSetPrototype.zip = IndexedIterablePrototype.zip; -OrderedSetPrototype.zipWith = IndexedIterablePrototype.zipWith; +const OrderedSetPrototype = OrderedSet.prototype; +OrderedSetPrototype[IS_ORDERED_SYMBOL] = true; +OrderedSetPrototype.zip = IndexedCollectionPrototype.zip; +OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith; +OrderedSetPrototype.zipAll = IndexedCollectionPrototype.zipAll; OrderedSetPrototype.__empty = emptyOrderedSet; OrderedSetPrototype.__make = makeOrderedSet; function makeOrderedSet(map, ownerID) { - var set = Object.create(OrderedSetPrototype); + const set = Object.create(OrderedSetPrototype); set.size = map ? map.size : 0; set._map = map; set.__ownerID = ownerID; return set; } -var EMPTY_ORDERED_SET; +let EMPTY_ORDERED_SET; function emptyOrderedSet() { - return EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap())); + return ( + EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap())) + ); } diff --git a/src/PairSorting.js b/src/PairSorting.js new file mode 100644 index 0000000000..a8d6e4e240 --- /dev/null +++ b/src/PairSorting.js @@ -0,0 +1,4 @@ +export const PairSorting = { + LeftThenRight: -1, + RightThenLeft: +1, +}; diff --git a/src/Range.js b/src/Range.js index 4893d6d747..a7ac912aed 100644 --- a/src/Range.js +++ b/src/Range.js @@ -1,19 +1,9 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { wrapIndex, wholeSlice, resolveBegin, resolveEnd } from './TrieUtils' -import { IndexedSeq } from './Seq' -import { Iterator, iteratorValue, iteratorDone } from './Iterator' - -import invariant from './utils/invariant' -import deepEqual from './utils/deepEqual' +import { wrapIndex, wholeSlice, resolveBegin, resolveEnd } from './TrieUtils'; +import { IndexedSeq } from './Seq'; +import { Iterator, iteratorValue, iteratorDone } from './Iterator'; +import invariant from './utils/invariant'; +import deepEqual from './utils/deepEqual'; /** * Returns a lazy seq of nums from start (inclusive) to end @@ -21,17 +11,22 @@ import deepEqual from './utils/deepEqual' * infinity. When start is equal to end, returns empty list. */ export class Range extends IndexedSeq { - - constructor(start, end, step) { + constructor(start, end, step = 1) { if (!(this instanceof Range)) { + // eslint-disable-next-line no-constructor-return return new Range(start, end, step); } invariant(step !== 0, 'Cannot step a Range by 0'); - start = start || 0; - if (end === undefined) { - end = Infinity; - } - step = step === undefined ? 1 : Math.abs(step); + invariant( + start !== undefined, + 'You must define a start value when using Range' + ); + invariant( + end !== undefined, + 'You must define an end value when using Range' + ); + + step = Math.abs(step); if (end < start) { step = -step; } @@ -41,33 +36,33 @@ export class Range extends IndexedSeq { this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1); if (this.size === 0) { if (EMPTY_RANGE) { + // eslint-disable-next-line no-constructor-return return EMPTY_RANGE; } + // eslint-disable-next-line @typescript-eslint/no-this-alias EMPTY_RANGE = this; } } toString() { - if (this.size === 0) { - return 'Range []'; - } - return 'Range [ ' + - this._start + '...' + this._end + - (this._step !== 1 ? ' by ' + this._step : '') + - ' ]'; + return this.size === 0 + ? 'Range []' + : `Range [ ${this._start}...${this._end}${this._step !== 1 ? ' by ' + this._step : ''} ]`; } get(index, notSetValue) { - return this.has(index) ? - this._start + wrapIndex(this, index) * this._step : - notSetValue; + return this.has(index) + ? this._start + wrapIndex(this, index) * this._step + : notSetValue; } includes(searchValue) { - var possibleIndex = (searchValue - this._start) / this._step; - return possibleIndex >= 0 && + const possibleIndex = (searchValue - this._start) / this._step; + return ( + possibleIndex >= 0 && possibleIndex < this.size && - possibleIndex === Math.floor(possibleIndex); + possibleIndex === Math.floor(possibleIndex) + ); } slice(begin, end) { @@ -79,15 +74,19 @@ export class Range extends IndexedSeq { if (end <= begin) { return new Range(0, 0); } - return new Range(this.get(begin, this._end), this.get(end, this._end), this._step); + return new Range( + this.get(begin, this._end), + this.get(end, this._end), + this._step + ); } indexOf(searchValue) { - var offsetValue = searchValue - this._start; + const offsetValue = searchValue - this._start; if (offsetValue % this._step === 0) { - var index = offsetValue / this._step; + const index = offsetValue / this._step; if (index >= 0 && index < this.size) { - return index + return index; } } return -1; @@ -98,10 +97,10 @@ export class Range extends IndexedSeq { } __iterate(fn, reverse) { - var size = this.size; - var step = this._step; - var value = reverse ? this._start + (size - 1) * step : this._start; - var i = 0; + const size = this.size; + const step = this._step; + let value = reverse ? this._start + (size - 1) * step : this._start; + let i = 0; while (i !== size) { if (fn(value, reverse ? size - ++i : i++, this) === false) { break; @@ -112,27 +111,27 @@ export class Range extends IndexedSeq { } __iterator(type, reverse) { - var size = this.size; - var step = this._step; - var value = reverse ? this._start + (size - 1) * step : this._start; - var i = 0; + const size = this.size; + const step = this._step; + let value = reverse ? this._start + (size - 1) * step : this._start; + let i = 0; return new Iterator(() => { if (i === size) { return iteratorDone(); } - var v = value; + const v = value; value += reverse ? -step : step; return iteratorValue(type, reverse ? size - ++i : i++, v); }); } equals(other) { - return other instanceof Range ? - this._start === other._start && - this._end === other._end && - this._step === other._step : - deepEqual(this, other); + return other instanceof Range + ? this._start === other._start && + this._end === other._end && + this._step === other._step + : deepEqual(this, other); } } -var EMPTY_RANGE; +let EMPTY_RANGE; diff --git a/src/Record.js b/src/Record.js index a720e96c97..89100a6410 100644 --- a/src/Record.js +++ b/src/Record.js @@ -1,26 +1,55 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ +import { toJS } from './toJS'; +import { KeyedCollection } from './Collection'; +import { keyedSeqFromValue } from './Seq'; +import { List } from './List'; +import { ITERATE_ENTRIES, ITERATOR_SYMBOL } from './Iterator'; +import { isRecord, IS_RECORD_SYMBOL } from './predicates/isRecord'; +import { CollectionPrototype } from './CollectionImpl'; +import { DELETE } from './TrieUtils'; +import { getIn } from './methods/getIn'; +import { setIn } from './methods/setIn'; +import { deleteIn } from './methods/deleteIn'; +import { update } from './methods/update'; +import { updateIn } from './methods/updateIn'; +import { merge, mergeWith } from './methods/merge'; +import { mergeDeep, mergeDeepWith } from './methods/mergeDeep'; +import { mergeIn } from './methods/mergeIn'; +import { mergeDeepIn } from './methods/mergeDeepIn'; +import { withMutations } from './methods/withMutations'; +import { asMutable } from './methods/asMutable'; +import { asImmutable } from './methods/asImmutable'; -import { KeyedIterable } from './Iterable' -import { KeyedCollection } from './Collection' -import { Map, MapPrototype, emptyMap } from './Map' -import { DELETE } from './TrieUtils' +import invariant from './utils/invariant'; +import quoteString from './utils/quoteString'; +import { isImmutable } from './predicates/isImmutable'; -import invariant from './utils/invariant' +function throwOnInvalidDefaultValues(defaultValues) { + if (isRecord(defaultValues)) { + throw new Error( + 'Can not call `Record` with an immutable Record as default values. Use a plain javascript object instead.' + ); + } + if (isImmutable(defaultValues)) { + throw new Error( + 'Can not call `Record` with an immutable Collection as default values. Use a plain javascript object instead.' + ); + } -export class Record extends KeyedCollection { + if (defaultValues === null || typeof defaultValues !== 'object') { + throw new Error( + 'Can not call `Record` with a non-object as default values. Use a plain javascript object instead.' + ); + } +} +export class Record { constructor(defaultValues, name) { - var hasInitialized; + let hasInitialized; + + throwOnInvalidDefaultValues(defaultValues); - var RecordType = function Record(values) { + const RecordType = function Record(values) { if (values instanceof RecordType) { return values; } @@ -29,156 +58,211 @@ export class Record extends KeyedCollection { } if (!hasInitialized) { hasInitialized = true; - var keys = Object.keys(defaultValues); - RecordTypePrototype.size = keys.length; + const keys = Object.keys(defaultValues); + const indices = (RecordTypePrototype._indices = {}); + // Deprecated: left to attempt not to break any external code which + // relies on a ._name property existing on record instances. + // Use Record.getDescriptiveName() instead RecordTypePrototype._name = name; RecordTypePrototype._keys = keys; RecordTypePrototype._defaultValues = defaultValues; - for (var i = 0; i < keys.length; i++) { - var propName = keys[i]; + for (let i = 0; i < keys.length; i++) { + const propName = keys[i]; + indices[propName] = i; if (RecordTypePrototype[propName]) { - typeof console === 'object' && console.warn && console.warn( - 'Cannot define ' + recordName(this) + ' with property "' + - propName + '" since that property name is part of the Record API.' - ); + /* eslint-disable no-console */ + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + typeof console === 'object' && + console.warn && + console.warn( + 'Cannot define ' + + recordName(this) + + ' with property "' + + propName + + '" since that property name is part of the Record API.' + ); + /* eslint-enable no-console */ } else { setProp(RecordTypePrototype, propName); } } } - this._map = Map(values); + this.__ownerID = undefined; + this._values = List().withMutations((l) => { + l.setSize(this._keys.length); + KeyedCollection(values).forEach((v, k) => { + l.set(this._indices[k], v === this._defaultValues[k] ? undefined : v); + }); + }); + return this; }; - var RecordTypePrototype = RecordType.prototype = Object.create(RecordPrototype); + const RecordTypePrototype = (RecordType.prototype = + Object.create(RecordPrototype)); RecordTypePrototype.constructor = RecordType; + if (name) { + RecordType.displayName = name; + } + + // eslint-disable-next-line no-constructor-return return RecordType; } toString() { - return this.__toString(recordName(this) + ' {', '}'); + let str = recordName(this) + ' { '; + const keys = this._keys; + let k; + for (let i = 0, l = keys.length; i !== l; i++) { + k = keys[i]; + str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k)); + } + return str + ' }'; + } + + equals(other) { + return ( + this === other || + (isRecord(other) && recordSeq(this).equals(recordSeq(other))) + ); + } + + hashCode() { + return recordSeq(this).hashCode(); } // @pragma Access has(k) { - return this._defaultValues.hasOwnProperty(k); + return this._indices.hasOwnProperty(k); } get(k, notSetValue) { if (!this.has(k)) { return notSetValue; } - var defaultVal = this._defaultValues[k]; - return this._map ? this._map.get(k, defaultVal) : defaultVal; + const index = this._indices[k]; + const value = this._values.get(index); + return value === undefined ? this._defaultValues[k] : value; } // @pragma Modification - clear() { - if (this.__ownerID) { - this._map && this._map.clear(); - return this; - } - var RecordType = this.constructor; - return RecordType._empty || (RecordType._empty = makeRecord(this, emptyMap())); - } - set(k, v) { - if (!this.has(k)) { - return this; - } - if (this._map && !this._map.has(k)) { - var defaultVal = this._defaultValues[k]; - if (v === defaultVal) { - return this; + if (this.has(k)) { + const newValues = this._values.set( + this._indices[k], + v === this._defaultValues[k] ? undefined : v + ); + if (newValues !== this._values && !this.__ownerID) { + return makeRecord(this, newValues); } } - var newMap = this._map && this._map.set(k, v); - if (this.__ownerID || newMap === this._map) { - return this; - } - return makeRecord(this, newMap); + return this; } remove(k) { - if (!this.has(k)) { - return this; - } - var newMap = this._map && this._map.remove(k); - if (this.__ownerID || newMap === this._map) { - return this; - } - return makeRecord(this, newMap); + return this.set(k); + } + + clear() { + const newValues = this._values.clear().setSize(this._keys.length); + + return this.__ownerID ? this : makeRecord(this, newValues); } wasAltered() { - return this._map.wasAltered(); + return this._values.wasAltered(); + } + + toSeq() { + return recordSeq(this); + } + + toJS() { + return toJS(this); + } + + entries() { + return this.__iterator(ITERATE_ENTRIES); } __iterator(type, reverse) { - return KeyedIterable(this._defaultValues).map((_, k) => this.get(k)).__iterator(type, reverse); + return recordSeq(this).__iterator(type, reverse); } __iterate(fn, reverse) { - return KeyedIterable(this._defaultValues).map((_, k) => this.get(k)).__iterate(fn, reverse); + return recordSeq(this).__iterate(fn, reverse); } __ensureOwner(ownerID) { if (ownerID === this.__ownerID) { return this; } - var newMap = this._map && this._map.__ensureOwner(ownerID); + const newValues = this._values.__ensureOwner(ownerID); if (!ownerID) { this.__ownerID = ownerID; - this._map = newMap; + this._values = newValues; return this; } - return makeRecord(this, newMap, ownerID); + return makeRecord(this, newValues, ownerID); } } +Record.isRecord = isRecord; Record.getDescriptiveName = recordName; -var RecordPrototype = Record.prototype; +const RecordPrototype = Record.prototype; +RecordPrototype[IS_RECORD_SYMBOL] = true; RecordPrototype[DELETE] = RecordPrototype.remove; -RecordPrototype.deleteIn = -RecordPrototype.removeIn = MapPrototype.removeIn; -RecordPrototype.merge = MapPrototype.merge; -RecordPrototype.mergeWith = MapPrototype.mergeWith; -RecordPrototype.mergeIn = MapPrototype.mergeIn; -RecordPrototype.mergeDeep = MapPrototype.mergeDeep; -RecordPrototype.mergeDeepWith = MapPrototype.mergeDeepWith; -RecordPrototype.mergeDeepIn = MapPrototype.mergeDeepIn; -RecordPrototype.setIn = MapPrototype.setIn; -RecordPrototype.update = MapPrototype.update; -RecordPrototype.updateIn = MapPrototype.updateIn; -RecordPrototype.withMutations = MapPrototype.withMutations; -RecordPrototype.asMutable = MapPrototype.asMutable; -RecordPrototype.asImmutable = MapPrototype.asImmutable; - - -function makeRecord(likeRecord, map, ownerID) { - var record = Object.create(Object.getPrototypeOf(likeRecord)); - record._map = map; +RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn; +RecordPrototype.getIn = getIn; +RecordPrototype.hasIn = CollectionPrototype.hasIn; +RecordPrototype.merge = merge; +RecordPrototype.mergeWith = mergeWith; +RecordPrototype.mergeIn = mergeIn; +RecordPrototype.mergeDeep = mergeDeep; +RecordPrototype.mergeDeepWith = mergeDeepWith; +RecordPrototype.mergeDeepIn = mergeDeepIn; +RecordPrototype.setIn = setIn; +RecordPrototype.update = update; +RecordPrototype.updateIn = updateIn; +RecordPrototype.withMutations = withMutations; +RecordPrototype.asMutable = asMutable; +RecordPrototype.asImmutable = asImmutable; +RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries; +RecordPrototype.toJSON = RecordPrototype.toObject = + CollectionPrototype.toObject; +RecordPrototype.inspect = RecordPrototype.toSource = function () { + return this.toString(); +}; + +function makeRecord(likeRecord, values, ownerID) { + const record = Object.create(Object.getPrototypeOf(likeRecord)); + record._values = values; record.__ownerID = ownerID; return record; } function recordName(record) { - return record._name || record.constructor.name || 'Record'; + return record.constructor.displayName || record.constructor.name || 'Record'; +} + +function recordSeq(record) { + return keyedSeqFromValue(record._keys.map((k) => [k, record.get(k)])); } function setProp(prototype, name) { try { Object.defineProperty(prototype, name, { - get: function() { + get: function () { return this.get(name); }, - set: function(value) { + set: function (value) { invariant(this.__ownerID, 'Cannot set on an immutable record.'); this.set(name, value); - } + }, }); + // eslint-disable-next-line @typescript-eslint/no-unused-vars -- TODO enable eslint here } catch (error) { // Object.defineProperty failed. Probably IE8. } diff --git a/src/Repeat.js b/src/Repeat.js index d63f48350b..0fb106156c 100644 --- a/src/Repeat.js +++ b/src/Repeat.js @@ -1,36 +1,28 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { wholeSlice, resolveBegin, resolveEnd } from './TrieUtils' -import { IndexedSeq } from './Seq' -import { is } from './is' -import { Iterator, iteratorValue, iteratorDone } from './Iterator' - -import deepEqual from './utils/deepEqual' +import { wholeSlice, resolveBegin, resolveEnd } from './TrieUtils'; +import { IndexedSeq } from './Seq'; +import { is } from './is'; +import { Iterator, iteratorValue, iteratorDone } from './Iterator'; +import deepEqual from './utils/deepEqual'; /** * Returns a lazy Seq of `value` repeated `times` times. When `times` is * undefined, returns an infinite sequence of `value`. */ export class Repeat extends IndexedSeq { - constructor(value, times) { if (!(this instanceof Repeat)) { + // eslint-disable-next-line no-constructor-return return new Repeat(value, times); } this._value = value; this.size = times === undefined ? Infinity : Math.max(0, times); if (this.size === 0) { if (EMPTY_REPEAT) { + // eslint-disable-next-line no-constructor-return return EMPTY_REPEAT; } + // eslint-disable-next-line @typescript-eslint/no-this-alias EMPTY_REPEAT = this; } } @@ -51,9 +43,13 @@ export class Repeat extends IndexedSeq { } slice(begin, end) { - var size = this.size; - return wholeSlice(begin, end, size) ? this : - new Repeat(this._value, resolveEnd(end, size) - resolveBegin(begin, size)); + const size = this.size; + return wholeSlice(begin, end, size) + ? this + : new Repeat( + this._value, + resolveEnd(end, size) - resolveBegin(begin, size) + ); } reverse() { @@ -75,8 +71,8 @@ export class Repeat extends IndexedSeq { } __iterate(fn, reverse) { - var size = this.size; - var i = 0; + const size = this.size; + let i = 0; while (i !== size) { if (fn(this._value, reverse ? size - ++i : i++, this) === false) { break; @@ -86,20 +82,20 @@ export class Repeat extends IndexedSeq { } __iterator(type, reverse) { - var size = this.size; - var i = 0; + const size = this.size; + let i = 0; return new Iterator(() => - i === size ? - iteratorDone() : - iteratorValue(type, reverse ? size - ++i : i++, this._value) + i === size + ? iteratorDone() + : iteratorValue(type, reverse ? size - ++i : i++, this._value) ); } equals(other) { - return other instanceof Repeat ? - is(this._value, other._value) : - deepEqual(other); + return other instanceof Repeat + ? is(this._value, other._value) + : deepEqual(this, other); } } -var EMPTY_REPEAT; +let EMPTY_REPEAT; diff --git a/src/Seq.js b/src/Seq.js index 5da111028e..fd2a1dea58 100644 --- a/src/Seq.js +++ b/src/Seq.js @@ -1,27 +1,34 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { wrapIndex } from './TrieUtils' -import { isIterable, isKeyed, Iterable, IS_ORDERED_SENTINEL } from './Iterable' -import { Iterator, iteratorValue, iteratorDone, hasIterator, isIterator, getIterator } from './Iterator' - -import isArrayLike from './utils/isArrayLike' - - -export class Seq extends Iterable { +import { wrapIndex } from './TrieUtils'; +import { Collection } from './Collection'; +import { IS_SEQ_SYMBOL, isSeq } from './predicates/isSeq'; +import { isImmutable } from './predicates/isImmutable'; +import { isCollection } from './predicates/isCollection'; +import { isKeyed } from './predicates/isKeyed'; +import { isAssociative } from './predicates/isAssociative'; +import { isRecord } from './predicates/isRecord'; +import { IS_ORDERED_SYMBOL } from './predicates/isOrdered'; +import { + Iterator, + iteratorValue, + iteratorDone, + hasIterator, + isIterator, + getIterator, + isEntriesIterable, + isKeysIterable, +} from './Iterator'; + +import hasOwnProperty from './utils/hasOwnProperty'; +import isArrayLike from './utils/isArrayLike'; + +export class Seq extends Collection { constructor(value) { - return value === null || value === undefined ? emptySequence() : - isIterable(value) ? value.toSeq() : seqFromValue(value); - } - - static of(/*...values*/) { - return Seq(arguments); + // eslint-disable-next-line no-constructor-return + return value === undefined || value === null + ? emptySequence() + : isImmutable(value) + ? value.toSeq() + : seqFromValue(value); } toSeq() { @@ -43,12 +50,12 @@ export class Seq extends Iterable { // abstract __iterateUncached(fn, reverse) __iterate(fn, reverse) { - var cache = this._cache; + const cache = this._cache; if (cache) { - var size = cache.length; - var i = 0; + const size = cache.length; + let i = 0; while (i !== size) { - var entry = cache[reverse ? size - ++i : i++]; + const entry = cache[reverse ? size - ++i : i++]; if (fn(entry[1], entry[0], this) === false) { break; } @@ -61,15 +68,15 @@ export class Seq extends Iterable { // abstract __iteratorUncached(type, reverse) __iterator(type, reverse) { - var cache = this._cache; + const cache = this._cache; if (cache) { - var size = cache.length; - var i = 0; + const size = cache.length; + let i = 0; return new Iterator(() => { if (i === size) { return iteratorDone(); } - var entry = cache[reverse ? size - ++i : i++]; + const entry = cache[reverse ? size - ++i : i++]; return iteratorValue(type, entry[0], entry[1]); }); } @@ -77,14 +84,18 @@ export class Seq extends Iterable { } } - export class KeyedSeq extends Seq { constructor(value) { - return value === null || value === undefined ? - emptySequence().toKeyedSeq() : - isIterable(value) ? - (isKeyed(value) ? value.toSeq() : value.fromEntrySeq()) : - keyedSeqFromValue(value); + // eslint-disable-next-line no-constructor-return + return value === undefined || value === null + ? emptySequence().toKeyedSeq() + : isCollection(value) + ? isKeyed(value) + ? value.toSeq() + : value.fromEntrySeq() + : isRecord(value) + ? value.toSeq() + : keyedSeqFromValue(value); } toKeyedSeq() { @@ -92,12 +103,18 @@ export class KeyedSeq extends Seq { } } - export class IndexedSeq extends Seq { constructor(value) { - return value === null || value === undefined ? emptySequence() : - !isIterable(value) ? indexedSeqFromValue(value) : - isKeyed(value) ? value.entrySeq() : value.toIndexedSeq(); + // eslint-disable-next-line no-constructor-return + return value === undefined || value === null + ? emptySequence() + : isCollection(value) + ? isKeyed(value) + ? value.entrySeq() + : value.toIndexedSeq() + : isRecord(value) + ? value.toSeq().entrySeq() + : indexedSeqFromValue(value); } static of(/*...values*/) { @@ -113,13 +130,11 @@ export class IndexedSeq extends Seq { } } - export class SetSeq extends Seq { constructor(value) { + // eslint-disable-next-line no-constructor-return return ( - value === null || value === undefined ? emptySequence() : - !isIterable(value) ? indexedSeqFromValue(value) : - isKeyed(value) ? value.entrySeq() : value + isCollection(value) && !isAssociative(value) ? value : IndexedSeq(value) ).toSetSeq(); } @@ -132,17 +147,12 @@ export class SetSeq extends Seq { } } - Seq.isSeq = isSeq; Seq.Keyed = KeyedSeq; Seq.Set = SetSeq; Seq.Indexed = IndexedSeq; -var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@'; - -Seq.prototype[IS_SEQ_SENTINEL] = true; - - +Seq.prototype[IS_SEQ_SYMBOL] = true; // #pragma Root Sequences @@ -157,11 +167,11 @@ export class ArraySeq extends IndexedSeq { } __iterate(fn, reverse) { - var array = this._array; - var size = array.length; - var i = 0; + const array = this._array; + const size = array.length; + let i = 0; while (i !== size) { - var ii = reverse ? size - ++i : i++; + const ii = reverse ? size - ++i : i++; if (fn(array[ii], ii, this) === false) { break; } @@ -170,23 +180,24 @@ export class ArraySeq extends IndexedSeq { } __iterator(type, reverse) { - var array = this._array; - var size = array.length; - var i = 0; + const array = this._array; + const size = array.length; + let i = 0; return new Iterator(() => { if (i === size) { return iteratorDone(); } - var ii = reverse ? size - ++i : i++; + const ii = reverse ? size - ++i : i++; return iteratorValue(type, ii, array[ii]); }); } } - class ObjectSeq extends KeyedSeq { constructor(object) { - var keys = Object.keys(object); + const keys = Object.keys(object).concat( + Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [] + ); this._object = object; this._keys = keys; this.size = keys.length; @@ -200,16 +211,16 @@ class ObjectSeq extends KeyedSeq { } has(key) { - return this._object.hasOwnProperty(key); + return hasOwnProperty.call(this._object, key); } __iterate(fn, reverse) { - var object = this._object; - var keys = this._keys; - var size = keys.length; - var i = 0; + const object = this._object; + const keys = this._keys; + const size = keys.length; + let i = 0; while (i !== size) { - var key = keys[reverse ? size - ++i : i++]; + const key = keys[reverse ? size - ++i : i++]; if (fn(object[key], key, this) === false) { break; } @@ -218,37 +229,36 @@ class ObjectSeq extends KeyedSeq { } __iterator(type, reverse) { - var object = this._object; - var keys = this._keys; - var size = keys.length; - var i = 0; + const object = this._object; + const keys = this._keys; + const size = keys.length; + let i = 0; return new Iterator(() => { if (i === size) { return iteratorDone(); } - var key = keys[reverse ? size - ++i : i++]; + const key = keys[reverse ? size - ++i : i++]; return iteratorValue(type, key, object[key]); }); } } -ObjectSeq.prototype[IS_ORDERED_SENTINEL] = true; +ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true; - -class IterableSeq extends IndexedSeq { - constructor(iterable) { - this._iterable = iterable; - this.size = iterable.length || iterable.size; +class CollectionSeq extends IndexedSeq { + constructor(collection) { + this._collection = collection; + this.size = collection.length || collection.size; } __iterateUncached(fn, reverse) { if (reverse) { return this.cacheResult().__iterate(fn, reverse); } - var iterable = this._iterable; - var iterator = getIterator(iterable); - var iterations = 0; + const collection = this._collection; + const iterator = getIterator(collection); + let iterations = 0; if (isIterator(iterator)) { - var step; + let step; while (!(step = iterator.next()).done) { if (fn(step.value, iterations++, this) === false) { break; @@ -262,125 +272,72 @@ class IterableSeq extends IndexedSeq { if (reverse) { return this.cacheResult().__iterator(type, reverse); } - var iterable = this._iterable; - var iterator = getIterator(iterable); + const collection = this._collection; + const iterator = getIterator(collection); if (!isIterator(iterator)) { return new Iterator(iteratorDone); } - var iterations = 0; + let iterations = 0; return new Iterator(() => { - var step = iterator.next(); + const step = iterator.next(); return step.done ? step : iteratorValue(type, iterations++, step.value); }); } } - -class IteratorSeq extends IndexedSeq { - constructor(iterator) { - this._iterator = iterator; - this._iteratorCache = []; - } - - __iterateUncached(fn, reverse) { - if (reverse) { - return this.cacheResult().__iterate(fn, reverse); - } - var iterator = this._iterator; - var cache = this._iteratorCache; - var iterations = 0; - while (iterations < cache.length) { - if (fn(cache[iterations], iterations++, this) === false) { - return iterations; - } - } - var step; - while (!(step = iterator.next()).done) { - var val = step.value; - cache[iterations] = val; - if (fn(val, iterations++, this) === false) { - break; - } - } - return iterations; - } - - __iteratorUncached(type, reverse) { - if (reverse) { - return this.cacheResult().__iterator(type, reverse); - } - var iterator = this._iterator; - var cache = this._iteratorCache; - var iterations = 0; - return new Iterator(() => { - if (iterations >= cache.length) { - var step = iterator.next(); - if (step.done) { - return step; - } - cache[iterations] = step.value; - } - return iteratorValue(type, iterations, cache[iterations++]); - }); - } -} - - - // # pragma Helper functions -export function isSeq(maybeSeq) { - return !!(maybeSeq && maybeSeq[IS_SEQ_SENTINEL]); -} - -var EMPTY_SEQ; +let EMPTY_SEQ; function emptySequence() { return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([])); } export function keyedSeqFromValue(value) { - var seq = - Array.isArray(value) ? new ArraySeq(value).fromEntrySeq() : - isIterator(value) ? new IteratorSeq(value).fromEntrySeq() : - hasIterator(value) ? new IterableSeq(value).fromEntrySeq() : - typeof value === 'object' ? new ObjectSeq(value) : - undefined; - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of [k, v] entries, '+ - 'or keyed object: ' + value - ); + const seq = maybeIndexedSeqFromValue(value); + if (seq) { + return seq.fromEntrySeq(); + } + if (typeof value === 'object') { + return new ObjectSeq(value); } - return seq; + throw new TypeError( + 'Expected Array or collection object of [k, v] entries, or keyed object: ' + + value + ); } export function indexedSeqFromValue(value) { - var seq = maybeIndexedSeqFromValue(value); - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of values: ' + value - ); + const seq = maybeIndexedSeqFromValue(value); + if (seq) { + return seq; } - return seq; + throw new TypeError( + 'Expected Array or collection object of values: ' + value + ); } function seqFromValue(value) { - var seq = maybeIndexedSeqFromValue(value) || - (typeof value === 'object' && new ObjectSeq(value)); - if (!seq) { - throw new TypeError( - 'Expected Array or iterable object of values, or keyed object: ' + value - ); - } - return seq; + const seq = maybeIndexedSeqFromValue(value); + if (seq) { + return isEntriesIterable(value) + ? seq.fromEntrySeq() + : isKeysIterable(value) + ? seq.toSetSeq() + : seq; + } + if (typeof value === 'object') { + return new ObjectSeq(value); + } + throw new TypeError( + 'Expected Array or collection object of values, or keyed object: ' + value + ); } function maybeIndexedSeqFromValue(value) { - return ( - isArrayLike(value) ? new ArraySeq(value) : - isIterator(value) ? new IteratorSeq(value) : - hasIterator(value) ? new IterableSeq(value) : - undefined - ); + return isArrayLike(value) + ? new ArraySeq(value) + : hasIterator(value) + ? new CollectionSeq(value) + : undefined; } diff --git a/src/Set.js b/src/Set.js index 6118b01ca3..cc42bc10f7 100644 --- a/src/Set.js +++ b/src/Set.js @@ -1,34 +1,30 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { SetIterable, KeyedIterable, isOrdered } from './Iterable' -import { SetCollection } from './Collection' -import { emptyMap, MapPrototype } from './Map' -import { DELETE } from './TrieUtils' -import { sortFactory } from './Operations' -import assertNotInfinite from './utils/assertNotInfinite' - -import { OrderedSet } from './OrderedSet' - +import { Collection, SetCollection, KeyedCollection } from './Collection'; +import { isOrdered } from './predicates/isOrdered'; +import { IS_SET_SYMBOL, isSet } from './predicates/isSet'; +import { emptyMap } from './Map'; +import { DELETE } from './TrieUtils'; +import { sortFactory } from './Operations'; +import assertNotInfinite from './utils/assertNotInfinite'; +import { asImmutable } from './methods/asImmutable'; +import { asMutable } from './methods/asMutable'; +import { withMutations } from './methods/withMutations'; + +import { OrderedSet } from './OrderedSet'; export class Set extends SetCollection { - // @pragma Construction constructor(value) { - return value === null || value === undefined ? emptySet() : - isSet(value) && !isOrdered(value) ? value : - emptySet().withMutations(set => { - var iter = SetIterable(value); - assertNotInfinite(iter.size); - iter.forEach(v => set.add(v)); - }); + // eslint-disable-next-line no-constructor-return + return value === undefined || value === null + ? emptySet() + : isSet(value) && !isOrdered(value) + ? value + : emptySet().withMutations((set) => { + const iter = SetCollection(value); + assertNotInfinite(iter.size); + iter.forEach((v) => set.add(v)); + }); } static of(/*...values*/) { @@ -36,7 +32,21 @@ export class Set extends SetCollection { } static fromKeys(value) { - return this(KeyedIterable(value).keySeq()); + return this(KeyedCollection(value).keySeq()); + } + + static intersect(sets) { + sets = Collection(sets).toArray(); + return sets.length + ? SetPrototype.intersect.apply(Set(sets.pop()), sets) + : emptySet(); + } + + static union(sets) { + sets = Collection(sets).toArray(); + return sets.length + ? SetPrototype.union.apply(Set(sets.pop()), sets) + : emptySet(); } toString() { @@ -52,7 +62,7 @@ export class Set extends SetCollection { // @pragma Modification add(value) { - return updateSet(this, this._map.set(value, true)); + return updateSet(this, this._map.set(value, value)); } remove(value) { @@ -65,17 +75,41 @@ export class Set extends SetCollection { // @pragma Composition + map(mapper, context) { + // keep track if the set is altered by the map function + let didChanges = false; + + const newMap = updateSet( + this, + this._map.mapEntries(([, v]) => { + const mapped = mapper.call(context, v, v, this); + + if (mapped !== v) { + didChanges = true; + } + + return [mapped, mapped]; + }, context) + ); + + return didChanges ? newMap : this; + } + union(...iters) { - iters = iters.filter(x => x.size !== 0); + iters = iters.filter((x) => x.size !== 0); if (iters.length === 0) { return this; } if (this.size === 0 && !this.__ownerID && iters.length === 1) { return this.constructor(iters[0]); } - return this.withMutations(set => { - for (var ii = 0; ii < iters.length; ii++) { - SetIterable(iters[ii]).forEach(value => set.add(value)); + return this.withMutations((set) => { + for (let ii = 0; ii < iters.length; ii++) { + if (typeof iters[ii] === 'string') { + set.add(iters[ii]); + } else { + SetCollection(iters[ii]).forEach((value) => set.add(value)); + } } }); } @@ -84,15 +118,15 @@ export class Set extends SetCollection { if (iters.length === 0) { return this; } - iters = iters.map(iter => SetIterable(iter)); - var toRemove = []; - this.forEach(value => { - if (!iters.every(iter => iter.includes(value))) { + iters = iters.map((iter) => SetCollection(iter)); + const toRemove = []; + this.forEach((value) => { + if (!iters.every((iter) => iter.includes(value))) { toRemove.push(value); } }); - return this.withMutations(set => { - toRemove.forEach(value => { + return this.withMutations((set) => { + toRemove.forEach((value) => { set.remove(value); }); }); @@ -102,27 +136,20 @@ export class Set extends SetCollection { if (iters.length === 0) { return this; } - var toRemove = []; - this.forEach(value => { - if (iters.some(iter => iter.includes(value))) { + iters = iters.map((iter) => SetCollection(iter)); + const toRemove = []; + this.forEach((value) => { + if (iters.some((iter) => iter.includes(value))) { toRemove.push(value); } }); - return this.withMutations(set => { - toRemove.forEach(value => { + return this.withMutations((set) => { + toRemove.forEach((value) => { set.remove(value); }); }); } - merge() { - return this.union.apply(this, arguments); - } - - mergeWith(merger, ...iters) { - return this.union.apply(this, iters); - } - sort(comparator) { // Late binding return OrderedSet(sortFactory(this, comparator)); @@ -138,19 +165,22 @@ export class Set extends SetCollection { } __iterate(fn, reverse) { - return this._map.__iterate((_, k) => fn(k, k, this), reverse); + return this._map.__iterate((k) => fn(k, k, this), reverse); } __iterator(type, reverse) { - return this._map.map((_, k) => k).__iterator(type, reverse); + return this._map.__iterator(type, reverse); } __ensureOwner(ownerID) { if (ownerID === this.__ownerID) { return this; } - var newMap = this._map.__ensureOwner(ownerID); + const newMap = this._map.__ensureOwner(ownerID); if (!ownerID) { + if (this.size === 0) { + return this.__empty(); + } this.__ownerID = ownerID; this._map = newMap; return this; @@ -159,22 +189,21 @@ export class Set extends SetCollection { } } -export function isSet(maybeSet) { - return !!(maybeSet && maybeSet[IS_SET_SENTINEL]); -} - Set.isSet = isSet; -var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@'; - -var SetPrototype = Set.prototype; -SetPrototype[IS_SET_SENTINEL] = true; +const SetPrototype = Set.prototype; +SetPrototype[IS_SET_SYMBOL] = true; SetPrototype[DELETE] = SetPrototype.remove; -SetPrototype.mergeDeep = SetPrototype.merge; -SetPrototype.mergeDeepWith = SetPrototype.mergeWith; -SetPrototype.withMutations = MapPrototype.withMutations; -SetPrototype.asMutable = MapPrototype.asMutable; -SetPrototype.asImmutable = MapPrototype.asImmutable; +SetPrototype.merge = SetPrototype.concat = SetPrototype.union; +SetPrototype.withMutations = withMutations; +SetPrototype.asImmutable = asImmutable; +SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable; +SetPrototype['@@transducer/step'] = function (result, arr) { + return result.add(arr); +}; +SetPrototype['@@transducer/result'] = function (obj) { + return obj.asImmutable(); +}; SetPrototype.__empty = emptySet; SetPrototype.__make = makeSet; @@ -185,20 +214,22 @@ function updateSet(set, newMap) { set._map = newMap; return set; } - return newMap === set._map ? set : - newMap.size === 0 ? set.__empty() : - set.__make(newMap); + return newMap === set._map + ? set + : newMap.size === 0 + ? set.__empty() + : set.__make(newMap); } function makeSet(map, ownerID) { - var set = Object.create(SetPrototype); + const set = Object.create(SetPrototype); set.size = map ? map.size : 0; set._map = map; set.__ownerID = ownerID; return set; } -var EMPTY_SET; +let EMPTY_SET; function emptySet() { return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap())); } diff --git a/src/Stack.js b/src/Stack.js index 7ab85f0d00..32414fa3a0 100644 --- a/src/Stack.js +++ b/src/Stack.js @@ -1,29 +1,24 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { wholeSlice, resolveBegin, resolveEnd, wrapIndex } from './TrieUtils' -import { IndexedIterable } from './Iterable' -import { IndexedCollection } from './Collection' -import { MapPrototype } from './Map' -import { ArraySeq } from './Seq' -import { Iterator, iteratorValue, iteratorDone } from './Iterator' -import assertNotInfinite from './utils/assertNotInfinite' - +import { wholeSlice, resolveBegin, resolveEnd, wrapIndex } from './TrieUtils'; +import { IndexedCollection } from './Collection'; +import { ArraySeq } from './Seq'; +import { Iterator, iteratorValue, iteratorDone } from './Iterator'; +import { IS_STACK_SYMBOL, isStack } from './predicates/isStack'; +import assertNotInfinite from './utils/assertNotInfinite'; +import { asImmutable } from './methods/asImmutable'; +import { asMutable } from './methods/asMutable'; +import { wasAltered } from './methods/wasAltered'; +import { withMutations } from './methods/withMutations'; export class Stack extends IndexedCollection { - // @pragma Construction constructor(value) { - return value === null || value === undefined ? emptyStack() : - isStack(value) ? value : - emptyStack().unshiftAll(value); + // eslint-disable-next-line no-constructor-return + return value === undefined || value === null + ? emptyStack() + : isStack(value) + ? value + : emptyStack().pushAll(value); } static of(/*...values*/) { @@ -37,7 +32,7 @@ export class Stack extends IndexedCollection { // @pragma Access get(index, notSetValue) { - var head = this._head; + let head = this._head; index = wrapIndex(this, index); while (head && index--) { head = head.next; @@ -55,12 +50,12 @@ export class Stack extends IndexedCollection { if (arguments.length === 0) { return this; } - var newSize = this.size + arguments.length; - var head = this._head; - for (var ii = arguments.length - 1; ii >= 0; ii--) { + const newSize = this.size + arguments.length; + let head = this._head; + for (let ii = arguments.length - 1; ii >= 0; ii--) { head = { value: arguments[ii], - next: head + next: head, }; } if (this.__ownerID) { @@ -74,20 +69,23 @@ export class Stack extends IndexedCollection { } pushAll(iter) { - iter = IndexedIterable(iter); + iter = IndexedCollection(iter); if (iter.size === 0) { return this; } + if (this.size === 0 && isStack(iter)) { + return iter; + } assertNotInfinite(iter.size); - var newSize = this.size; - var head = this._head; - iter.reverse().forEach(value => { + let newSize = this.size; + let head = this._head; + iter.__iterate((value) => { newSize++; head = { value: value, - next: head + next: head, }; - }); + }, /* reverse */ true); if (this.__ownerID) { this.size = newSize; this._head = head; @@ -102,18 +100,6 @@ export class Stack extends IndexedCollection { return this.slice(1); } - unshift(/*...values*/) { - return this.push.apply(this, arguments); - } - - unshiftAll(iter) { - return this.pushAll(iter); - } - - shift() { - return this.pop.apply(this, arguments); - } - clear() { if (this.size === 0) { return this; @@ -132,14 +118,14 @@ export class Stack extends IndexedCollection { if (wholeSlice(begin, end, this.size)) { return this; } - var resolvedBegin = resolveBegin(begin, this.size); - var resolvedEnd = resolveEnd(end, this.size); + let resolvedBegin = resolveBegin(begin, this.size); + const resolvedEnd = resolveEnd(end, this.size); if (resolvedEnd !== this.size) { // super.slice(begin, end); return IndexedCollection.prototype.slice.call(this, begin, end); } - var newSize = this.size - resolvedBegin; - var head = this._head; + const newSize = this.size - resolvedBegin; + let head = this._head; while (resolvedBegin--) { head = head.next; } @@ -160,6 +146,9 @@ export class Stack extends IndexedCollection { return this; } if (!ownerID) { + if (this.size === 0) { + return emptyStack(); + } this.__ownerID = ownerID; this.__altered = false; return this; @@ -171,10 +160,13 @@ export class Stack extends IndexedCollection { __iterate(fn, reverse) { if (reverse) { - return new ArraySeq(this.toArray()).__iterate((v, k) => fn(v, k, this), reverse); + return new ArraySeq(this.toArray()).__iterate( + (v, k) => fn(v, k, this), + reverse + ); } - var iterations = 0; - var node = this._head; + let iterations = 0; + let node = this._head; while (node) { if (fn(node.value, iterations++, this) === false) { break; @@ -188,11 +180,11 @@ export class Stack extends IndexedCollection { if (reverse) { return new ArraySeq(this.toArray()).__iterator(type, reverse); } - var iterations = 0; - var node = this._head; + let iterations = 0; + let node = this._head; return new Iterator(() => { if (node) { - var value = node.value; + const value = node.value; node = node.next; return iteratorValue(type, iterations++, value); } @@ -201,24 +193,26 @@ export class Stack extends IndexedCollection { } } -function isStack(maybeStack) { - return !!(maybeStack && maybeStack[IS_STACK_SENTINEL]); -} - Stack.isStack = isStack; -var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@'; - -var StackPrototype = Stack.prototype; -StackPrototype[IS_STACK_SENTINEL] = true; -StackPrototype.withMutations = MapPrototype.withMutations; -StackPrototype.asMutable = MapPrototype.asMutable; -StackPrototype.asImmutable = MapPrototype.asImmutable; -StackPrototype.wasAltered = MapPrototype.wasAltered; - +const StackPrototype = Stack.prototype; +StackPrototype[IS_STACK_SYMBOL] = true; +StackPrototype.shift = StackPrototype.pop; +StackPrototype.unshift = StackPrototype.push; +StackPrototype.unshiftAll = StackPrototype.pushAll; +StackPrototype.withMutations = withMutations; +StackPrototype.wasAltered = wasAltered; +StackPrototype.asImmutable = asImmutable; +StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable; +StackPrototype['@@transducer/step'] = function (result, arr) { + return result.unshift(arr); +}; +StackPrototype['@@transducer/result'] = function (obj) { + return obj.asImmutable(); +}; function makeStack(size, head, ownerID, hash) { - var map = Object.create(StackPrototype); + const map = Object.create(StackPrototype); map.size = size; map._head = head; map.__ownerID = ownerID; @@ -227,7 +221,7 @@ function makeStack(size, head, ownerID, hash) { return map; } -var EMPTY_STACK; +let EMPTY_STACK; function emptyStack() { return EMPTY_STACK || (EMPTY_STACK = makeStack(0)); } diff --git a/src/TrieUtils.js b/src/TrieUtils.js deleted file mode 100644 index 8346f8683d..0000000000 --- a/src/TrieUtils.js +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - - -// Used for setting prototype methods that IE8 chokes on. -export var DELETE = 'delete'; - -// Constants describing the size of trie nodes. -export var SHIFT = 5; // Resulted in best performance after ______? -export var SIZE = 1 << SHIFT; -export var MASK = SIZE - 1; - -// A consistent shared value representing "not set" which equals nothing other -// than itself, and nothing that could be provided externally. -export var NOT_SET = {}; - -// Boolean references, Rough equivalent of `bool &`. -export var CHANGE_LENGTH = { value: false }; -export var DID_ALTER = { value: false }; - -export function MakeRef(ref) { - ref.value = false; - return ref; -} - -export function SetRef(ref) { - ref && (ref.value = true); -} - -// A function which returns a value representing an "owner" for transient writes -// to tries. The return value will only ever equal itself, and will not equal -// the return of any subsequent call of this function. -export function OwnerID() {} - -// http://jsperf.com/copy-array-inline -export function arrCopy(arr, offset) { - offset = offset || 0; - var len = Math.max(0, arr.length - offset); - var newArr = new Array(len); - for (var ii = 0; ii < len; ii++) { - newArr[ii] = arr[ii + offset]; - } - return newArr; -} - -export function ensureSize(iter) { - if (iter.size === undefined) { - iter.size = iter.__iterate(returnTrue); - } - return iter.size; -} - -export function wrapIndex(iter, index) { - // This implements "is array index" which the ECMAString spec defines as: - // - // A String property name P is an array index if and only if - // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal - // to 2^32−1. - // - // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects - if (typeof index !== 'number') { - var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32 - if ('' + uint32Index !== index || uint32Index === 4294967295) { - return NaN; - } - index = uint32Index; - } - return index < 0 ? ensureSize(iter) + index : index; -} - -export function returnTrue() { - return true; -} - -export function wholeSlice(begin, end, size) { - return (begin === 0 || (size !== undefined && begin <= -size)) && - (end === undefined || (size !== undefined && end >= size)); -} - -export function resolveBegin(begin, size) { - return resolveIndex(begin, size, 0); -} - -export function resolveEnd(end, size) { - return resolveIndex(end, size, size); -} - -function resolveIndex(index, size, defaultIndex) { - // Sanitize indices using this shorthand for ToInt32(argument) - // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 - return index === undefined ? - defaultIndex : - index < 0 ? - size === Infinity ? size : - Math.max(0, size + index) | 0 : - size === undefined || size === index ? - index : - Math.min(size, index) | 0; -} diff --git a/src/TrieUtils.ts b/src/TrieUtils.ts new file mode 100644 index 0000000000..d5c75c179b --- /dev/null +++ b/src/TrieUtils.ts @@ -0,0 +1,105 @@ +import type { Collection } from '../type-definitions/immutable'; + +// Used for setting prototype methods that IE8 chokes on. +export const DELETE = 'delete'; + +// Constants describing the size of trie nodes. +export const SHIFT = 5; // Resulted in best performance after ______? +export const SIZE = 1 << SHIFT; +export const MASK = SIZE - 1; + +// A consistent shared value representing "not set" which equals nothing other +// than itself, and nothing that could be provided externally. +export const NOT_SET = {}; + +type Ref = { value: boolean }; + +// Boolean references, Rough equivalent of `bool &`. +export function MakeRef(): Ref { + return { value: false }; +} + +export function SetRef(ref: Ref): void { + if (ref) { + ref.value = true; + } +} + +// A function which returns a value representing an "owner" for transient writes +// to tries. The return value will only ever equal itself, and will not equal +// the return of any subsequent call of this function. +export function OwnerID() {} + +export function ensureSize(iter: Collection): number { + // @ts-expect-error size should exists on Collection + if (iter.size === undefined) { + // @ts-expect-error size should exists on Collection, __iterate does exist on Collection + iter.size = iter.__iterate(returnTrue); + } + // @ts-expect-error size should exists on Collection + return iter.size; +} + +export function wrapIndex( + iter: Collection, + index: number +): number { + // This implements "is array index" which the ECMAString spec defines as: + // + // A String property name P is an array index if and only if + // ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal + // to 2^32−1. + // + // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects + if (typeof index !== 'number') { + const uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32 + if ('' + uint32Index !== index || uint32Index === 4294967295) { + return NaN; + } + index = uint32Index; + } + return index < 0 ? ensureSize(iter) + index : index; +} + +export function returnTrue(): true { + return true; +} + +export function wholeSlice(begin: number, end: number, size: number): boolean { + return ( + ((begin === 0 && !isNeg(begin)) || + (size !== undefined && begin <= -size)) && + (end === undefined || (size !== undefined && end >= size)) + ); +} + +export function resolveBegin(begin: number, size: number): number { + return resolveIndex(begin, size, 0); +} + +export function resolveEnd(end: number, size: number): number { + return resolveIndex(end, size, size); +} + +function resolveIndex( + index: number, + size: number, + defaultIndex: number +): number { + // Sanitize indices using this shorthand for ToInt32(argument) + // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32 + return index === undefined + ? defaultIndex + : isNeg(index) + ? size === Infinity + ? size + : Math.max(0, size + index) | 0 + : size === undefined || size === index + ? index + : Math.min(size, index) | 0; +} + +function isNeg(value: number): boolean { + // Account for -0 which is negative, but not less than 0. + return value < 0 || (value === 0 && 1 / value === -Infinity); +} diff --git a/src/fromJS.js b/src/fromJS.js index a393ebaf4a..7586c12a58 100644 --- a/src/fromJS.js +++ b/src/fromJS.js @@ -1,40 +1,51 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ +import { Seq } from './Seq'; +import { hasIterator } from './Iterator'; +import { isImmutable } from './predicates/isImmutable'; +import { isIndexed } from './predicates/isIndexed'; +import { isKeyed } from './predicates/isKeyed'; +import isArrayLike from './utils/isArrayLike'; +import isPlainObj from './utils/isPlainObj'; -import { KeyedSeq, IndexedSeq } from './Seq' - -export function fromJS(json, converter) { - return converter ? - fromJSWith(converter, json, '', {'': json}) : - fromJSDefault(json); -} - -function fromJSWith(converter, json, key, parentJSON) { - if (Array.isArray(json)) { - return converter.call(parentJSON, key, IndexedSeq(json).map((v, k) => fromJSWith(converter, v, k, json))); - } - if (isPlainObj(json)) { - return converter.call(parentJSON, key, KeyedSeq(json).map((v, k) => fromJSWith(converter, v, k, json))); - } - return json; +export function fromJS(value, converter) { + return fromJSWith( + [], + converter || defaultConverter, + value, + '', + converter && converter.length > 2 ? [] : undefined, + { '': value } + ); } -function fromJSDefault(json) { - if (Array.isArray(json)) { - return IndexedSeq(json).map(fromJSDefault).toList(); - } - if (isPlainObj(json)) { - return KeyedSeq(json).map(fromJSDefault).toMap(); +function fromJSWith(stack, converter, value, key, keyPath, parentValue) { + if ( + typeof value !== 'string' && + !isImmutable(value) && + (isArrayLike(value) || hasIterator(value) || isPlainObj(value)) + ) { + if (~stack.indexOf(value)) { + throw new TypeError('Cannot convert circular structure to Immutable'); + } + stack.push(value); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + keyPath && key !== '' && keyPath.push(key); + const converted = converter.call( + parentValue, + key, + Seq(value).map((v, k) => + fromJSWith(stack, converter, v, k, keyPath, value) + ), + keyPath && keyPath.slice() + ); + stack.pop(); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + keyPath && keyPath.pop(); + return converted; } - return json; + return value; } -function isPlainObj(value) { - return value && (value.constructor === Object || value.constructor === undefined); +function defaultConverter(k, v) { + // Effectively the opposite of "Collection.toSeq()" + return isIndexed(v) ? v.toList() : isKeyed(v) ? v.toMap() : v.toSet(); } diff --git a/src/functional/get.ts b/src/functional/get.ts new file mode 100644 index 0000000000..9ec97d8070 --- /dev/null +++ b/src/functional/get.ts @@ -0,0 +1,63 @@ +import type { Collection, Record } from '../../type-definitions/immutable'; +import { isImmutable } from '../predicates/isImmutable'; +import { has } from './has'; + +/** + * Returns the value within the provided collection associated with the + * provided key, or notSetValue if the key is not defined in the collection. + * + * A functional alternative to `collection.get(key)` which will also work on + * plain Objects and Arrays as an alternative for `collection[key]`. + */ +export function get(collection: Collection, key: K): V | undefined; +export function get( + collection: Collection, + key: K, + notSetValue: NSV +): V | NSV; +export function get( + record: Record, + key: K, + notSetValue: unknown +): TProps[K]; +export function get(collection: Array, key: number): V | undefined; +export function get( + collection: Array, + key: number, + notSetValue: NSV +): V | NSV; +export function get( + object: C, + key: K, + notSetValue: unknown +): C[K]; +export function get( + collection: { [key: string]: V }, + key: string +): V | undefined; +export function get( + collection: { [key: string]: V }, + key: string, + notSetValue: NSV +): V | NSV; +export function get( + collection: Collection | Array | { [key: string]: V }, + key: K, + notSetValue?: NSV +): V | NSV; +export function get( + collection: Collection | Array | { [key: string]: V }, + key: K, + notSetValue?: NSV +): V | NSV { + return isImmutable(collection) + ? collection.get(key, notSetValue) + : !has(collection, key) + ? notSetValue + : // @ts-expect-error weird "get" here, + typeof collection.get === 'function' + ? // @ts-expect-error weird "get" here, + collection.get(key) + : // @ts-expect-error key is unknown here, + collection[key]; +} diff --git a/src/functional/getIn.ts b/src/functional/getIn.ts new file mode 100644 index 0000000000..080e07238a --- /dev/null +++ b/src/functional/getIn.ts @@ -0,0 +1,33 @@ +import coerceKeyPath from '../utils/coerceKeyPath'; +import { NOT_SET } from '../TrieUtils'; +import { get } from './get'; +import type { KeyPath } from '../../type-definitions/immutable'; + +type GetType = typeof get; +type GetTypeParameters = Parameters; +type CollectionType = GetTypeParameters[0]; +type Key = GetTypeParameters[1]; + +/** + * Returns the value at the provided key path starting at the provided + * collection, or notSetValue if the key path is not defined. + * + * A functional alternative to `collection.getIn(keypath)` which will also + * work with plain Objects and Arrays. + */ +export function getIn( + collection: CollectionType, + searchKeyPath: KeyPath, + notSetValue?: GetTypeParameters[2] +): ReturnType { + const keyPath = coerceKeyPath(searchKeyPath); + let i = 0; + while (i !== keyPath.length) { + // @ts-expect-error keyPath[i++] can not be undefined by design + collection = get(collection, keyPath[i++], NOT_SET); + if (collection === NOT_SET) { + return notSetValue; + } + } + return collection; +} diff --git a/src/functional/has.ts b/src/functional/has.ts new file mode 100644 index 0000000000..09a1620275 --- /dev/null +++ b/src/functional/has.ts @@ -0,0 +1,18 @@ +import { isImmutable } from '../predicates/isImmutable'; +import hasOwnProperty from '../utils/hasOwnProperty'; +import isDataStructure from '../utils/isDataStructure'; + +/** + * Returns true if the key is defined in the provided collection. + * + * A functional alternative to `collection.has(key)` which will also work with + * plain Objects and Arrays as an alternative for + * `collection.hasOwnProperty(key)`. + */ +export function has(collection: object, key: unknown): boolean { + return isImmutable(collection) + ? // @ts-expect-error key might be a number or symbol, which is not handled be Record key type + collection.has(key) + : // @ts-expect-error key might be anything else than PropertyKey, and will return false in that case but runtime is OK + isDataStructure(collection) && hasOwnProperty.call(collection, key); +} diff --git a/src/functional/hasIn.ts b/src/functional/hasIn.ts new file mode 100644 index 0000000000..30e6a0e781 --- /dev/null +++ b/src/functional/hasIn.ts @@ -0,0 +1,17 @@ +import { getIn } from './getIn'; +import { NOT_SET } from '../TrieUtils'; + +type GetInParameters = Parameters; + +/** + * Returns true if the key path is defined in the provided collection. + * + * A functional alternative to `collection.hasIn(keypath)` which will also + * work with plain Objects and Arrays. + */ +export function hasIn( + collection: GetInParameters[0], + keyPath: GetInParameters[1] +): boolean { + return getIn(collection, keyPath, NOT_SET) !== NOT_SET; +} diff --git a/src/functional/merge.js b/src/functional/merge.js new file mode 100644 index 0000000000..b2d231a0c9 --- /dev/null +++ b/src/functional/merge.js @@ -0,0 +1,99 @@ +import { isImmutable } from '../predicates/isImmutable'; +import { isIndexed } from '../predicates/isIndexed'; +import { isKeyed } from '../predicates/isKeyed'; +import { IndexedCollection, KeyedCollection } from '../Collection'; +import { Seq } from '../Seq'; +import hasOwnProperty from '../utils/hasOwnProperty'; +import isDataStructure from '../utils/isDataStructure'; +import shallowCopy from '../utils/shallowCopy'; + +export function merge(collection, ...sources) { + return mergeWithSources(collection, sources); +} + +export function mergeWith(merger, collection, ...sources) { + return mergeWithSources(collection, sources, merger); +} + +export function mergeDeep(collection, ...sources) { + return mergeDeepWithSources(collection, sources); +} + +export function mergeDeepWith(merger, collection, ...sources) { + return mergeDeepWithSources(collection, sources, merger); +} + +export function mergeDeepWithSources(collection, sources, merger) { + return mergeWithSources(collection, sources, deepMergerWith(merger)); +} + +export function mergeWithSources(collection, sources, merger) { + if (!isDataStructure(collection)) { + throw new TypeError( + 'Cannot merge into non-data-structure value: ' + collection + ); + } + if (isImmutable(collection)) { + return typeof merger === 'function' && collection.mergeWith + ? collection.mergeWith(merger, ...sources) + : collection.merge + ? collection.merge(...sources) + : collection.concat(...sources); + } + const isArray = Array.isArray(collection); + let merged = collection; + const Collection = isArray ? IndexedCollection : KeyedCollection; + const mergeItem = isArray + ? (value) => { + // Copy on write + if (merged === collection) { + merged = shallowCopy(merged); + } + merged.push(value); + } + : (value, key) => { + const hasVal = hasOwnProperty.call(merged, key); + const nextVal = + hasVal && merger ? merger(merged[key], value, key) : value; + if (!hasVal || nextVal !== merged[key]) { + // Copy on write + if (merged === collection) { + merged = shallowCopy(merged); + } + merged[key] = nextVal; + } + }; + for (let i = 0; i < sources.length; i++) { + Collection(sources[i]).forEach(mergeItem); + } + return merged; +} + +function deepMergerWith(merger) { + function deepMerger(oldValue, newValue, key) { + return isDataStructure(oldValue) && + isDataStructure(newValue) && + areMergeable(oldValue, newValue) + ? mergeWithSources(oldValue, [newValue], deepMerger) + : merger + ? merger(oldValue, newValue, key) + : newValue; + } + return deepMerger; +} + +/** + * It's unclear what the desired behavior is for merging two collections that + * fall into separate categories between keyed, indexed, or set-like, so we only + * consider them mergeable if they fall into the same category. + */ +function areMergeable(oldDataStructure, newDataStructure) { + const oldSeq = Seq(oldDataStructure); + const newSeq = Seq(newDataStructure); + // This logic assumes that a sequence can only fall into one of the three + // categories mentioned above (since there's no `isSetLike()` method). + return ( + isIndexed(oldSeq) === isIndexed(newSeq) && + isKeyed(oldSeq) === isKeyed(newSeq) + ); +} diff --git a/src/functional/remove.ts b/src/functional/remove.ts new file mode 100644 index 0000000000..970384dce6 --- /dev/null +++ b/src/functional/remove.ts @@ -0,0 +1,71 @@ +import type { Collection, Record } from '../../type-definitions/immutable'; +import { isImmutable } from '../predicates/isImmutable'; +import hasOwnProperty from '../utils/hasOwnProperty'; +import isDataStructure from '../utils/isDataStructure'; +import shallowCopy from '../utils/shallowCopy'; + +/** + * Returns a copy of the collection with the value at key removed. + * + * A functional alternative to `collection.remove(key)` which will also work + * with plain Objects and Arrays as an alternative for + * `delete collectionCopy[key]`. + */ +export function remove>( + collection: C, + key: K +): C; +export function remove< + TProps extends object, + C extends Record, + K extends keyof TProps, +>(collection: C, key: K): C; +export function remove>(collection: C, key: number): C; +export function remove(collection: C, key: K): C; +export function remove< + C extends { [key: PropertyKey]: unknown }, + K extends keyof C, +>(collection: C, key: K): C; +export function remove< + K, + C extends + | Collection + | Array + | { [key: PropertyKey]: unknown }, +>(collection: C, key: K): C; +export function remove( + collection: + | Collection + | Array + | { [key: PropertyKey]: unknown }, + key: K +) { + if (!isDataStructure(collection)) { + throw new TypeError( + 'Cannot update non-data-structure value: ' + collection + ); + } + if (isImmutable(collection)) { + // @ts-expect-error weird "remove" here, + if (!collection.remove) { + throw new TypeError( + 'Cannot update immutable value without .remove() method: ' + collection + ); + } + // @ts-expect-error weird "remove" here, + return collection.remove(key); + } + // @ts-expect-error assert that key is a string, a number or a symbol here + if (!hasOwnProperty.call(collection, key)) { + return collection; + } + const collectionCopy = shallowCopy(collection); + if (Array.isArray(collectionCopy)) { + // @ts-expect-error assert that key is a number here + collectionCopy.splice(key, 1); + } else { + // @ts-expect-error assert that key is a string, a number or a symbol here + delete collectionCopy[key]; + } + return collectionCopy; +} diff --git a/src/functional/removeIn.ts b/src/functional/removeIn.ts new file mode 100644 index 0000000000..70155a359a --- /dev/null +++ b/src/functional/removeIn.ts @@ -0,0 +1,18 @@ +import { updateIn, type PossibleCollection } from './updateIn'; +import { NOT_SET } from '../TrieUtils'; +import type { KeyPath } from '../../type-definitions/immutable'; + +/** + * Returns a copy of the collection with the value at the key path removed. + * + * A functional alternative to `collection.removeIn(keypath)` which will also + * work with plain Objects and Arrays. + */ +export function removeIn< + K extends PropertyKey, + V, + TProps extends object, + C extends PossibleCollection, +>(collection: C, keyPath: KeyPath): C { + return updateIn(collection, keyPath, () => NOT_SET); +} diff --git a/src/functional/set.ts b/src/functional/set.ts new file mode 100644 index 0000000000..2f1d41dd5b --- /dev/null +++ b/src/functional/set.ts @@ -0,0 +1,64 @@ +import type { Collection, Record } from '../../type-definitions/immutable'; +import { isImmutable } from '../predicates/isImmutable'; +import hasOwnProperty from '../utils/hasOwnProperty'; +import isDataStructure from '../utils/isDataStructure'; +import shallowCopy from '../utils/shallowCopy'; + +/** + * Returns a copy of the collection with the value at key set to the provided + * value. + * + * A functional alternative to `collection.set(key, value)` which will also + * work with plain Objects and Arrays as an alternative for + * `collectionCopy[key] = value`. + */ +export function set>( + collection: C, + key: K, + value: V +): C; +export function set< + TProps extends object, + C extends Record, + K extends keyof TProps, +>(record: C, key: K, value: TProps[K]): C; +export function set>( + collection: C, + key: number, + value: V +): C; +export function set(object: C, key: K, value: C[K]): C; +export function set( + collection: C, + key: string, + value: V +): C; +export function set | { [key: string]: V }>( + collection: C, + key: K | string, + value: V +): C { + if (!isDataStructure(collection)) { + throw new TypeError( + 'Cannot update non-data-structure value: ' + collection + ); + } + if (isImmutable(collection)) { + // @ts-expect-error weird "set" here, + if (!collection.set) { + throw new TypeError( + 'Cannot update immutable value without .set() method: ' + collection + ); + } + // @ts-expect-error weird "set" here, + return collection.set(key, value); + } + // @ts-expect-error mix of key and string here. Probably need a more fine type here + if (hasOwnProperty.call(collection, key) && value === collection[key]) { + return collection; + } + const collectionCopy = shallowCopy(collection); + // @ts-expect-error mix of key and string here. Probably need a more fine type here + collectionCopy[key] = value; + return collectionCopy; +} diff --git a/src/functional/setIn.ts b/src/functional/setIn.ts new file mode 100644 index 0000000000..f1590a03f1 --- /dev/null +++ b/src/functional/setIn.ts @@ -0,0 +1,19 @@ +import { updateIn, type PossibleCollection } from './updateIn'; +import { NOT_SET } from '../TrieUtils'; +import type { KeyPath } from '../../type-definitions/immutable'; + +/** + * Returns a copy of the collection with the value at the key path set to the + * provided value. + * + * A functional alternative to `collection.setIn(keypath)` which will also + * work with plain Objects and Arrays. + */ +export function setIn< + K extends PropertyKey, + V, + TProps extends object, + C extends PossibleCollection, +>(collection: C, keyPath: KeyPath, value: unknown): C { + return updateIn(collection, keyPath, NOT_SET, () => value); +} diff --git a/src/functional/update.ts b/src/functional/update.ts new file mode 100644 index 0000000000..b073b5a1c2 --- /dev/null +++ b/src/functional/update.ts @@ -0,0 +1,100 @@ +import type { Collection, Record } from '../../type-definitions/immutable'; +import { updateIn, type PossibleCollection } from './updateIn'; + +type UpdaterFunction = (value: V | undefined) => V | undefined; +type UpdaterFunctionWithNSV = (value: V | NSV) => V; + +/** + * Returns a copy of the collection with the value at key set to the result of + * providing the existing value to the updating function. + * + * A functional alternative to `collection.update(key, fn)` which will also + * work with plain Objects and Arrays as an alternative for + * `collectionCopy[key] = fn(collection[key])`. + */ +export function update>( + collection: C, + key: K, + updater: (value: V | undefined) => V | undefined +): C; +export function update, NSV>( + collection: C, + key: K, + notSetValue: NSV, + updater: (value: V | NSV) => V +): C; +export function update< + TProps extends object, + C extends Record, + K extends keyof TProps, +>(record: C, key: K, updater: (value: TProps[K]) => TProps[K]): C; +export function update< + TProps extends object, + C extends Record, + K extends keyof TProps, + NSV, +>( + record: C, + key: K, + notSetValue: NSV, + updater: (value: TProps[K] | NSV) => TProps[K] +): C; +export function update>( + collection: C, + key: number, + updater: UpdaterFunction +): C; +export function update, NSV>( + collection: C, + key: number, + notSetValue: NSV, + updater: (value: V | NSV) => V +): C; +export function update( + object: C, + key: K, + updater: (value: C[K]) => C[K] +): C; +export function update( + object: C, + key: K, + notSetValue: NSV, + updater: (value: C[K] | NSV) => C[K] +): C; +export function update( + collection: C, + key: K, + updater: (value: V) => V +): { [key: string]: V }; +export function update< + V, + C extends { [key: string]: V }, + K extends keyof C, + NSV, +>( + collection: C, + key: K, + notSetValue: NSV, + updater: (value: V | NSV) => V +): { [key: string]: V }; + +export function update< + K, + V, + TProps extends object, + C extends PossibleCollection, + NSV, +>( + collection: C, + key: K, + notSetValue: NSV | UpdaterFunction, + updater?: UpdaterFunctionWithNSV +) { + return updateIn( + // @ts-expect-error Index signature for type string is missing in type V[] + collection, + [key], + notSetValue, + updater + ); +} diff --git a/src/functional/updateIn.ts b/src/functional/updateIn.ts new file mode 100644 index 0000000000..8c3cf1c1cc --- /dev/null +++ b/src/functional/updateIn.ts @@ -0,0 +1,180 @@ +import { isImmutable } from '../predicates/isImmutable'; +import coerceKeyPath from '../utils/coerceKeyPath'; +import isDataStructure from '../utils/isDataStructure'; +import quoteString from '../utils/quoteString'; +import { NOT_SET } from '../TrieUtils'; +import { emptyMap } from '../Map'; +import { get } from './get'; +import { remove } from './remove'; +import { set } from './set'; +import type { + Collection, + KeyPath, + Record, + RetrievePath, +} from '../../type-definitions/immutable'; + +/** + * Returns a copy of the collection with the value at key path set to the + * result of providing the existing value to the updating function. + * + * A functional alternative to `collection.updateIn(keypath)` which will also + * work with plain Objects and Arrays. + */ + +export type PossibleCollection = + | Collection + | Record + | Array; + +type UpdaterFunction = ( + value: RetrievePath> | undefined +) => unknown | undefined; +type UpdaterFunctionWithNSV = ( + value: RetrievePath> | NSV +) => unknown; + +export function updateIn>( + collection: C, + keyPath: KeyPath, + updater: UpdaterFunction +): C; +export function updateIn, NSV>( + collection: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: UpdaterFunctionWithNSV +): C; +export function updateIn< + TProps extends object, + C extends Record, + K extends keyof TProps, +>(record: C, keyPath: KeyPath, updater: UpdaterFunction): C; +export function updateIn< + TProps extends object, + C extends Record, + K extends keyof TProps, + NSV, +>( + record: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: UpdaterFunctionWithNSV +): C; +export function updateIn>( + collection: C, + keyPath: KeyPath, + updater: UpdaterFunction +): Array; +export function updateIn, NSV>( + collection: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: UpdaterFunctionWithNSV +): Array; +export function updateIn( + object: C, + keyPath: KeyPath, + updater: UpdaterFunction +): C; +export function updateIn( + object: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: UpdaterFunctionWithNSV +): C; +export function updateIn( + collection: C, + keyPath: KeyPath, + updater: UpdaterFunction +): { [key: PropertyKey]: V }; +export function updateIn( + collection: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: UpdaterFunction +): { [key: PropertyKey]: V }; + +export function updateIn< + K, + V, + TProps extends object, + C extends PossibleCollection, + NSV, +>( + collection: C, + keyPath: KeyPath, + notSetValue: NSV | UpdaterFunction | undefined, + updater?: UpdaterFunctionWithNSV +): C { + if (!updater) { + // handle the fact that `notSetValue` is optional here, in that case `updater` is the updater function + // @ts-expect-error updater is a function here + updater = notSetValue as UpdaterFunction; + notSetValue = undefined; + } + const updatedValue = updateInDeeply( + isImmutable(collection), + // @ts-expect-error type issues with Record and mixed types + collection, + coerceKeyPath(keyPath), + 0, + notSetValue, + updater + ); + // @ts-expect-error mixed return type + return updatedValue === NOT_SET ? notSetValue : updatedValue; +} + +function updateInDeeply< + K, + TProps extends object, + C extends PossibleCollection, + NSV, +>( + inImmutable: boolean, + existing: C, + keyPath: Array, + i: number, + notSetValue: NSV | undefined, + updater: UpdaterFunctionWithNSV | UpdaterFunction +): C { + const wasNotSet = existing === NOT_SET; + if (i === keyPath.length) { + const existingValue = wasNotSet ? notSetValue : existing; + // @ts-expect-error mixed type with optional value + const newValue = updater(existingValue); + // @ts-expect-error mixed type + return newValue === existingValue ? existing : newValue; + } + if (!wasNotSet && !isDataStructure(existing)) { + throw new TypeError( + 'Cannot update within non-data-structure value in path [' + + Array.from(keyPath).slice(0, i).map(quoteString) + + ']: ' + + existing + ); + } + const key = keyPath[i]; + + const nextExisting = wasNotSet ? NOT_SET : get(existing, key, NOT_SET); + const nextUpdated = updateInDeeply( + nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting), + // @ts-expect-error mixed type + nextExisting, + keyPath, + i + 1, + notSetValue, + updater + ); + + return nextUpdated === nextExisting + ? existing + : nextUpdated === NOT_SET + ? remove(existing, key) + : set( + wasNotSet ? (inImmutable ? emptyMap() : {}) : existing, + key, + nextUpdated + ); +} diff --git a/src/is.js b/src/is.ts similarity index 80% rename from src/is.js rename to src/is.ts index 05d96ff6b9..f4430c52fd 100644 --- a/src/is.js +++ b/src/is.ts @@ -1,11 +1,4 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ +import { isValueObject } from './predicates/isValueObject'; /** * An extension of the "same-value" algorithm as [described for use by ES6 Map @@ -58,18 +51,20 @@ * assert( a.hashCode() === b.hashCode() ); * } * - * All Immutable collections implement `equals` and `hashCode`. - * + * All Immutable collections are Value Objects: they implement `equals()` + * and `hashCode()`. */ -export function is(valueA, valueB) { +export function is(valueA: unknown, valueB: unknown): boolean { if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { return true; } if (!valueA || !valueB) { return false; } - if (typeof valueA.valueOf === 'function' && - typeof valueB.valueOf === 'function') { + if ( + typeof valueA.valueOf === 'function' && + typeof valueB.valueOf === 'function' + ) { valueA = valueA.valueOf(); valueB = valueB.valueOf(); if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) { @@ -79,10 +74,9 @@ export function is(valueA, valueB) { return false; } } - if (typeof valueA.equals === 'function' && - typeof valueB.equals === 'function' && - valueA.equals(valueB)) { - return true; - } - return false; + return !!( + isValueObject(valueA) && + isValueObject(valueB) && + valueA.equals(valueB) + ); } diff --git a/src/methods/README.md b/src/methods/README.md new file mode 100644 index 0000000000..df2d26482f --- /dev/null +++ b/src/methods/README.md @@ -0,0 +1,5 @@ +These files represent common methods on Collection types, each will contain +references to "this" - expecting to be called as a prototypal method. + +They are separated into individual files to avoid circular dependencies when +possible, and to allow their use in multiple different Collections. diff --git a/src/methods/asImmutable.js b/src/methods/asImmutable.js new file mode 100644 index 0000000000..71ba0d2bf5 --- /dev/null +++ b/src/methods/asImmutable.js @@ -0,0 +1,3 @@ +export function asImmutable() { + return this.__ensureOwner(); +} diff --git a/src/methods/asMutable.js b/src/methods/asMutable.js new file mode 100644 index 0000000000..2e7abf576a --- /dev/null +++ b/src/methods/asMutable.js @@ -0,0 +1,5 @@ +import { OwnerID } from '../TrieUtils'; + +export function asMutable() { + return this.__ownerID ? this : this.__ensureOwner(new OwnerID()); +} diff --git a/src/methods/deleteIn.js b/src/methods/deleteIn.js new file mode 100644 index 0000000000..5a312ce8f9 --- /dev/null +++ b/src/methods/deleteIn.js @@ -0,0 +1,5 @@ +import { removeIn } from '../functional/removeIn'; + +export function deleteIn(keyPath) { + return removeIn(this, keyPath); +} diff --git a/src/methods/getIn.js b/src/methods/getIn.js new file mode 100644 index 0000000000..e202bae92c --- /dev/null +++ b/src/methods/getIn.js @@ -0,0 +1,5 @@ +import { getIn as _getIn } from '../functional/getIn'; + +export function getIn(searchKeyPath, notSetValue) { + return _getIn(this, searchKeyPath, notSetValue); +} diff --git a/src/methods/hasIn.js b/src/methods/hasIn.js new file mode 100644 index 0000000000..704dc5c80f --- /dev/null +++ b/src/methods/hasIn.js @@ -0,0 +1,5 @@ +import { hasIn as _hasIn } from '../functional/hasIn'; + +export function hasIn(searchKeyPath) { + return _hasIn(this, searchKeyPath); +} diff --git a/src/methods/merge.js b/src/methods/merge.js new file mode 100644 index 0000000000..427f7c466c --- /dev/null +++ b/src/methods/merge.js @@ -0,0 +1,51 @@ +import { KeyedCollection } from '../Collection'; +import { NOT_SET } from '../TrieUtils'; +import { update } from '../functional/update'; +import { isRecord } from '../predicates/isRecord'; + +export function merge(...iters) { + return mergeIntoKeyedWith(this, iters); +} + +export function mergeWith(merger, ...iters) { + if (typeof merger !== 'function') { + throw new TypeError('Invalid merger function: ' + merger); + } + return mergeIntoKeyedWith(this, iters, merger); +} + +function mergeIntoKeyedWith(collection, collections, merger) { + const iters = []; + for (let ii = 0; ii < collections.length; ii++) { + const collection = KeyedCollection(collections[ii]); + if (collection.size !== 0) { + iters.push(collection); + } + } + if (iters.length === 0) { + return collection; + } + if ( + collection.toSeq().size === 0 && + !collection.__ownerID && + iters.length === 1 + ) { + return isRecord(collection) + ? collection // Record is empty and will not be updated: return the same instance + : collection.constructor(iters[0]); + } + return collection.withMutations((collection) => { + const mergeIntoCollection = merger + ? (value, key) => { + update(collection, key, NOT_SET, (oldVal) => + oldVal === NOT_SET ? value : merger(oldVal, value, key) + ); + } + : (value, key) => { + collection.set(key, value); + }; + for (let ii = 0; ii < iters.length; ii++) { + iters[ii].forEach(mergeIntoCollection); + } + }); +} diff --git a/src/methods/mergeDeep.js b/src/methods/mergeDeep.js new file mode 100644 index 0000000000..e2238f664c --- /dev/null +++ b/src/methods/mergeDeep.js @@ -0,0 +1,9 @@ +import { mergeDeepWithSources } from '../functional/merge'; + +export function mergeDeep(...iters) { + return mergeDeepWithSources(this, iters); +} + +export function mergeDeepWith(merger, ...iters) { + return mergeDeepWithSources(this, iters, merger); +} diff --git a/src/methods/mergeDeepIn.js b/src/methods/mergeDeepIn.js new file mode 100644 index 0000000000..119369b7ba --- /dev/null +++ b/src/methods/mergeDeepIn.js @@ -0,0 +1,9 @@ +import { mergeDeepWithSources } from '../functional/merge'; +import { updateIn } from '../functional/updateIn'; +import { emptyMap } from '../Map'; + +export function mergeDeepIn(keyPath, ...iters) { + return updateIn(this, keyPath, emptyMap(), (m) => + mergeDeepWithSources(m, iters) + ); +} diff --git a/src/methods/mergeIn.js b/src/methods/mergeIn.js new file mode 100644 index 0000000000..9af239c4d0 --- /dev/null +++ b/src/methods/mergeIn.js @@ -0,0 +1,7 @@ +import { mergeWithSources } from '../functional/merge'; +import { updateIn } from '../functional/updateIn'; +import { emptyMap } from '../Map'; + +export function mergeIn(keyPath, ...iters) { + return updateIn(this, keyPath, emptyMap(), (m) => mergeWithSources(m, iters)); +} diff --git a/src/methods/setIn.js b/src/methods/setIn.js new file mode 100644 index 0000000000..3ea05b89d6 --- /dev/null +++ b/src/methods/setIn.js @@ -0,0 +1,5 @@ +import { setIn as _setIn } from '../functional/setIn'; + +export function setIn(keyPath, v) { + return _setIn(this, keyPath, v); +} diff --git a/src/methods/toObject.js b/src/methods/toObject.js new file mode 100644 index 0000000000..fb927f0e48 --- /dev/null +++ b/src/methods/toObject.js @@ -0,0 +1,10 @@ +import assertNotInfinite from '../utils/assertNotInfinite'; + +export function toObject() { + assertNotInfinite(this.size); + const object = {}; + this.__iterate((v, k) => { + object[k] = v; + }); + return object; +} diff --git a/src/methods/update.js b/src/methods/update.js new file mode 100644 index 0000000000..0d533f7037 --- /dev/null +++ b/src/methods/update.js @@ -0,0 +1,7 @@ +import { update as _update } from '../functional/update'; + +export function update(key, notSetValue, updater) { + return arguments.length === 1 + ? key(this) + : _update(this, key, notSetValue, updater); +} diff --git a/src/methods/updateIn.js b/src/methods/updateIn.js new file mode 100644 index 0000000000..8df1860868 --- /dev/null +++ b/src/methods/updateIn.js @@ -0,0 +1,5 @@ +import { updateIn as _updateIn } from '../functional/updateIn'; + +export function updateIn(keyPath, notSetValue, updater) { + return _updateIn(this, keyPath, notSetValue, updater); +} diff --git a/src/methods/wasAltered.js b/src/methods/wasAltered.js new file mode 100644 index 0000000000..165a3e3ab2 --- /dev/null +++ b/src/methods/wasAltered.js @@ -0,0 +1,3 @@ +export function wasAltered() { + return this.__altered; +} diff --git a/src/methods/withMutations.js b/src/methods/withMutations.js new file mode 100644 index 0000000000..59c5cc83dc --- /dev/null +++ b/src/methods/withMutations.js @@ -0,0 +1,5 @@ +export function withMutations(fn) { + const mutable = this.asMutable(); + fn(mutable); + return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this; +} diff --git a/src/predicates/isAssociative.ts b/src/predicates/isAssociative.ts new file mode 100644 index 0000000000..e174616f7b --- /dev/null +++ b/src/predicates/isAssociative.ts @@ -0,0 +1,25 @@ +import { isKeyed } from './isKeyed'; +import { isIndexed } from './isIndexed'; +import type { Collection } from '../../type-definitions/immutable'; + +/** + * True if `maybeAssociative` is either a Keyed or Indexed Collection. + * + * ```js + * import { isAssociative, Map, List, Stack, Set } from 'immutable'; + * + * isAssociative([]); // false + * isAssociative({}); // false + * isAssociative(Map()); // true + * isAssociative(List()); // true + * isAssociative(Stack()); // true + * isAssociative(Set()); // false + * ``` + */ +export function isAssociative( + maybeAssociative: unknown +): maybeAssociative is + | Collection.Keyed + | Collection.Indexed { + return isKeyed(maybeAssociative) || isIndexed(maybeAssociative); +} diff --git a/src/predicates/isCollection.ts b/src/predicates/isCollection.ts new file mode 100644 index 0000000000..738a4614e0 --- /dev/null +++ b/src/predicates/isCollection.ts @@ -0,0 +1,27 @@ +import type { Collection } from '../../type-definitions/immutable'; + +// Note: value is unchanged to not break immutable-devtools. +export const IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@'; + +/** + * True if `maybeCollection` is a Collection, or any of its subclasses. + * + * ```js + * import { isCollection, Map, List, Stack } from 'immutable'; + * + * isCollection([]); // false + * isCollection({}); // false + * isCollection(Map()); // true + * isCollection(List()); // true + * isCollection(Stack()); // true + * ``` + */ +export function isCollection( + maybeCollection: unknown +): maybeCollection is Collection { + return Boolean( + maybeCollection && + // @ts-expect-error: maybeCollection is typed as `{}`, need to change in 6.0 to `maybeCollection && typeof maybeCollection === 'object' && IS_COLLECTION_SYMBOL in maybeCollection` + maybeCollection[IS_COLLECTION_SYMBOL] + ); +} diff --git a/src/predicates/isImmutable.ts b/src/predicates/isImmutable.ts new file mode 100644 index 0000000000..d01bd03afb --- /dev/null +++ b/src/predicates/isImmutable.ts @@ -0,0 +1,24 @@ +import type { Collection, Record } from '../../type-definitions/immutable'; +import { isCollection } from './isCollection'; +import { isRecord } from './isRecord'; + +/** + * True if `maybeImmutable` is an Immutable Collection or Record. + * + * Note: Still returns true even if the collections is within a `withMutations()`. + * + * ```js + * import { isImmutable, Map, List, Stack } from 'immutable'; + * isImmutable([]); // false + * isImmutable({}); // false + * isImmutable(Map()); // true + * isImmutable(List()); // true + * isImmutable(Stack()); // true + * isImmutable(Map().asMutable()); // true + * ``` + */ +export function isImmutable( + maybeImmutable: unknown +): maybeImmutable is Collection | Record { + return isCollection(maybeImmutable) || isRecord(maybeImmutable); +} diff --git a/src/predicates/isIndexed.ts b/src/predicates/isIndexed.ts new file mode 100644 index 0000000000..3e20595af5 --- /dev/null +++ b/src/predicates/isIndexed.ts @@ -0,0 +1,27 @@ +import type { Collection } from '../../type-definitions/immutable'; + +export const IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@'; + +/** + * True if `maybeIndexed` is a Collection.Indexed, or any of its subclasses. + * + * ```js + * import { isIndexed, Map, List, Stack, Set } from 'immutable'; + * + * isIndexed([]); // false + * isIndexed({}); // false + * isIndexed(Map()); // false + * isIndexed(List()); // true + * isIndexed(Stack()); // true + * isIndexed(Set()); // false + * ``` + */ +export function isIndexed( + maybeIndexed: unknown +): maybeIndexed is Collection.Indexed { + return Boolean( + maybeIndexed && + // @ts-expect-error: maybeIndexed is typed as `{}`, need to change in 6.0 to `maybeIndexed && typeof maybeIndexed === 'object' && IS_INDEXED_SYMBOL in maybeIndexed` + maybeIndexed[IS_INDEXED_SYMBOL] + ); +} diff --git a/src/predicates/isKeyed.ts b/src/predicates/isKeyed.ts new file mode 100644 index 0000000000..35f7b7e9c8 --- /dev/null +++ b/src/predicates/isKeyed.ts @@ -0,0 +1,26 @@ +import type { Collection } from '../../type-definitions/immutable'; + +export const IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@'; + +/** + * True if `maybeKeyed` is a Collection.Keyed, or any of its subclasses. + * + * ```js + * import { isKeyed, Map, List, Stack } from 'immutable'; + * + * isKeyed([]); // false + * isKeyed({}); // false + * isKeyed(Map()); // true + * isKeyed(List()); // false + * isKeyed(Stack()); // false + * ``` + */ +export function isKeyed( + maybeKeyed: unknown +): maybeKeyed is Collection.Keyed { + return Boolean( + maybeKeyed && + // @ts-expect-error: maybeKeyed is typed as `{}`, need to change in 6.0 to `maybeKeyed && typeof maybeKeyed === 'object' && IS_KEYED_SYMBOL in maybeKeyed` + maybeKeyed[IS_KEYED_SYMBOL] + ); +} diff --git a/src/predicates/isList.ts b/src/predicates/isList.ts new file mode 100644 index 0000000000..080427eb2a --- /dev/null +++ b/src/predicates/isList.ts @@ -0,0 +1,14 @@ +import type { List } from '../../type-definitions/immutable'; + +export const IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@'; + +/** + * True if `maybeList` is a List. + */ +export function isList(maybeList: unknown): maybeList is List { + return Boolean( + maybeList && + // @ts-expect-error: maybeList is typed as `{}`, need to change in 6.0 to `maybeList && typeof maybeList === 'object' && IS_LIST_SYMBOL in maybeList` + maybeList[IS_LIST_SYMBOL] + ); +} diff --git a/src/predicates/isMap.ts b/src/predicates/isMap.ts new file mode 100644 index 0000000000..ef96c7e138 --- /dev/null +++ b/src/predicates/isMap.ts @@ -0,0 +1,16 @@ +import type { Map } from '../../type-definitions/immutable'; + +export const IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@'; + +/** + * True if `maybeMap` is a Map. + * + * Also true for OrderedMaps. + */ +export function isMap(maybeMap: unknown): maybeMap is Map { + return Boolean( + maybeMap && + // @ts-expect-error: maybeMap is typed as `{}`, need to change in 6.0 to `maybeMap && typeof maybeMap === 'object' && IS_MAP_SYMBOL in maybeMap` + maybeMap[IS_MAP_SYMBOL] + ); +} diff --git a/src/predicates/isOrdered.ts b/src/predicates/isOrdered.ts new file mode 100644 index 0000000000..2e20d415ff --- /dev/null +++ b/src/predicates/isOrdered.ts @@ -0,0 +1,31 @@ +import type { OrderedCollection } from '../../type-definitions/immutable'; + +export const IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@'; + +/** + * True if `maybeOrdered` is a Collection where iteration order is well + * defined. True for Collection.Indexed as well as OrderedMap and OrderedSet. + * + * ```js + * import { isOrdered, Map, OrderedMap, List, Set } from 'immutable'; + * + * isOrdered([]); // false + * isOrdered({}); // false + * isOrdered(Map()); // false + * isOrdered(OrderedMap()); // true + * isOrdered(List()); // true + * isOrdered(Set()); // false + * ``` + */ +export function isOrdered( + maybeOrdered: Iterable +): maybeOrdered is OrderedCollection; +export function isOrdered( + maybeOrdered: unknown +): maybeOrdered is OrderedCollection { + return Boolean( + maybeOrdered && + // @ts-expect-error: maybeOrdered is typed as `{}`, need to change in 6.0 to `maybeOrdered && typeof maybeOrdered === 'object' && IS_ORDERED_SYMBOL in maybeOrdered` + maybeOrdered[IS_ORDERED_SYMBOL] + ); +} diff --git a/src/predicates/isOrderedMap.ts b/src/predicates/isOrderedMap.ts new file mode 100644 index 0000000000..ac56e200b5 --- /dev/null +++ b/src/predicates/isOrderedMap.ts @@ -0,0 +1,12 @@ +import type { OrderedMap } from '../../type-definitions/immutable'; +import { isMap } from './isMap'; +import { isOrdered } from './isOrdered'; + +/** + * True if `maybeOrderedMap` is an OrderedMap. + */ +export function isOrderedMap( + maybeOrderedMap: unknown +): maybeOrderedMap is OrderedMap { + return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap); +} diff --git a/src/predicates/isOrderedSet.ts b/src/predicates/isOrderedSet.ts new file mode 100644 index 0000000000..8ac58beb96 --- /dev/null +++ b/src/predicates/isOrderedSet.ts @@ -0,0 +1,12 @@ +import { isSet } from './isSet'; +import { isOrdered } from './isOrdered'; +import type { OrderedSet } from '../../type-definitions/immutable'; + +/** + * True if `maybeOrderedSet` is an OrderedSet. + */ +export function isOrderedSet( + maybeOrderedSet: unknown +): maybeOrderedSet is OrderedSet { + return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet); +} diff --git a/src/predicates/isRecord.ts b/src/predicates/isRecord.ts new file mode 100644 index 0000000000..ff9b1cdde8 --- /dev/null +++ b/src/predicates/isRecord.ts @@ -0,0 +1,14 @@ +import type { Record } from '../../type-definitions/immutable'; + +export const IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@'; + +/** + * True if `maybeRecord` is a Record. + */ +export function isRecord(maybeRecord: unknown): maybeRecord is Record { + return Boolean( + maybeRecord && + // @ts-expect-error: maybeRecord is typed as `{}`, need to change in 6.0 to `maybeRecord && typeof maybeRecord === 'object' && IS_RECORD_SYMBOL in maybeRecord` + maybeRecord[IS_RECORD_SYMBOL] + ); +} diff --git a/src/predicates/isSeq.ts b/src/predicates/isSeq.ts new file mode 100644 index 0000000000..1b0f26f04a --- /dev/null +++ b/src/predicates/isSeq.ts @@ -0,0 +1,19 @@ +import type { Seq } from '../../type-definitions/immutable'; + +export const IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@'; + +/** + * True if `maybeSeq` is a Seq. + */ +export function isSeq( + maybeSeq: unknown +): maybeSeq is + | Seq.Indexed + | Seq.Keyed + | Seq.Set { + return Boolean( + maybeSeq && + // @ts-expect-error: maybeSeq is typed as `{}`, need to change in 6.0 to `maybeSeq && typeof maybeSeq === 'object' && MAYBE_SEQ_SYMBOL in maybeSeq` + maybeSeq[IS_SEQ_SYMBOL] + ); +} diff --git a/src/predicates/isSet.ts b/src/predicates/isSet.ts new file mode 100644 index 0000000000..a9a59fe71c --- /dev/null +++ b/src/predicates/isSet.ts @@ -0,0 +1,16 @@ +import type { Set } from '../../type-definitions/immutable'; + +export const IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@'; + +/** + * True if `maybeSet` is a Set. + * + * Also true for OrderedSets. + */ +export function isSet(maybeSet: unknown): maybeSet is Set { + return Boolean( + maybeSet && + // @ts-expect-error: maybeSet is typed as `{}`, need to change in 6.0 to `maybeSeq && typeof maybeSet === 'object' && MAYBE_SET_SYMBOL in maybeSet` + maybeSet[IS_SET_SYMBOL] + ); +} diff --git a/src/predicates/isStack.ts b/src/predicates/isStack.ts new file mode 100644 index 0000000000..b62768f88e --- /dev/null +++ b/src/predicates/isStack.ts @@ -0,0 +1,14 @@ +import type { Stack } from '../../type-definitions/immutable'; + +export const IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@'; + +/** + * True if `maybeStack` is a Stack. + */ +export function isStack(maybeStack: unknown): maybeStack is Stack { + return Boolean( + maybeStack && + // @ts-expect-error: maybeStack is typed as `{}`, need to change in 6.0 to `maybeStack && typeof maybeStack === 'object' && MAYBE_STACK_SYMBOL in maybeStack` + maybeStack[IS_STACK_SYMBOL] + ); +} diff --git a/src/predicates/isValueObject.ts b/src/predicates/isValueObject.ts new file mode 100644 index 0000000000..f603b517ea --- /dev/null +++ b/src/predicates/isValueObject.ts @@ -0,0 +1,18 @@ +import type { ValueObject } from '../../type-definitions/immutable'; + +/** + * True if `maybeValue` is a JavaScript Object which has *both* `equals()` + * and `hashCode()` methods. + * + * Any two instances of *value objects* can be compared for value equality with + * `Immutable.is()` and can be used as keys in a `Map` or members in a `Set`. + */ +export function isValueObject(maybeValue: unknown): maybeValue is ValueObject { + return Boolean( + maybeValue && + // @ts-expect-error: maybeValue is typed as `{}` + typeof maybeValue.equals === 'function' && + // @ts-expect-error: maybeValue is typed as `{}` + typeof maybeValue.hashCode === 'function' + ); +} diff --git a/src/toJS.js b/src/toJS.js new file mode 100644 index 0000000000..2d820416c8 --- /dev/null +++ b/src/toJS.js @@ -0,0 +1,28 @@ +import { Seq } from './Seq'; +import { isCollection } from './predicates/isCollection'; +import { isKeyed } from './predicates/isKeyed'; +import isDataStructure from './utils/isDataStructure'; + +export function toJS(value) { + if (!value || typeof value !== 'object') { + return value; + } + if (!isCollection(value)) { + if (!isDataStructure(value)) { + return value; + } + value = Seq(value); + } + if (isKeyed(value)) { + const result = {}; + value.__iterate((v, k) => { + result[k] = toJS(v); + }); + return result; + } + const result = []; + value.__iterate((v) => { + result.push(toJS(v)); + }); + return result; +} diff --git a/src/utils/arrCopy.ts b/src/utils/arrCopy.ts new file mode 100644 index 0000000000..e6cc653f98 --- /dev/null +++ b/src/utils/arrCopy.ts @@ -0,0 +1,12 @@ +// http://jsperf.com/copy-array-inline + +export default function arrCopy(arr: Array, offset?: number): Array { + offset = offset || 0; + const len = Math.max(0, arr.length - offset); + const newArr: Array = new Array(len); + for (let ii = 0; ii < len; ii++) { + // @ts-expect-error We may want to guard for undefined values with `if (arr[ii + offset] !== undefined`, but ths should not happen by design + newArr[ii] = arr[ii + offset]; + } + return newArr; +} diff --git a/src/utils/assertNotInfinite.js b/src/utils/assertNotInfinite.js deleted file mode 100644 index aace777ba1..0000000000 --- a/src/utils/assertNotInfinite.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import invariant from './invariant' - -export default function assertNotInfinite(size) { - invariant( - size !== Infinity, - 'Cannot perform this action with an infinite size.' - ); -} diff --git a/src/utils/assertNotInfinite.ts b/src/utils/assertNotInfinite.ts new file mode 100644 index 0000000000..52abc8fc4c --- /dev/null +++ b/src/utils/assertNotInfinite.ts @@ -0,0 +1,8 @@ +import invariant from './invariant'; + +export default function assertNotInfinite(size: number): void { + invariant( + size !== Infinity, + 'Cannot perform this action with an infinite size.' + ); +} diff --git a/src/utils/coerceKeyPath.ts b/src/utils/coerceKeyPath.ts new file mode 100644 index 0000000000..843981f0ea --- /dev/null +++ b/src/utils/coerceKeyPath.ts @@ -0,0 +1,15 @@ +import type { KeyPath } from '../../type-definitions/immutable'; +import { isOrdered } from '../predicates/isOrdered'; +import isArrayLike from './isArrayLike'; + +export default function coerceKeyPath(keyPath: KeyPath): ArrayLike { + if (isArrayLike(keyPath) && typeof keyPath !== 'string') { + return keyPath; + } + if (isOrdered(keyPath)) { + return keyPath.toArray(); + } + throw new TypeError( + 'Invalid keyPath: expected Ordered Collection or Array: ' + keyPath + ); +} diff --git a/src/utils/createClass.js b/src/utils/createClass.js deleted file mode 100644 index 8f59cf42b4..0000000000 --- a/src/utils/createClass.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -export default function createClass(ctor, superClass) { - if (superClass) { - ctor.prototype = Object.create(superClass.prototype); - } - ctor.prototype.constructor = ctor; -} diff --git a/src/utils/deepEqual.js b/src/utils/deepEqual.js deleted file mode 100644 index cc2074206d..0000000000 --- a/src/utils/deepEqual.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { is } from '../is' -import { NOT_SET } from '../TrieUtils' -import { isIterable, isKeyed, isIndexed, isAssociative, isOrdered } from '../Iterable' - -export default function deepEqual(a, b) { - if (a === b) { - return true; - } - - if ( - !isIterable(b) || - a.size !== undefined && b.size !== undefined && a.size !== b.size || - a.__hash !== undefined && b.__hash !== undefined && a.__hash !== b.__hash || - isKeyed(a) !== isKeyed(b) || - isIndexed(a) !== isIndexed(b) || - isOrdered(a) !== isOrdered(b) - ) { - return false; - } - - if (a.size === 0 && b.size === 0) { - return true; - } - - var notAssociative = !isAssociative(a); - - if (isOrdered(a)) { - var entries = a.entries(); - return b.every((v, k) => { - var entry = entries.next().value; - return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); - }) && entries.next().done; - } - - var flipped = false; - - if (a.size === undefined) { - if (b.size === undefined) { - if (typeof a.cacheResult === 'function') { - a.cacheResult(); - } - } else { - flipped = true; - var _ = a; - a = b; - b = _; - } - } - - var allEqual = true; - var bSize = b.__iterate((v, k) => { - if (notAssociative ? !a.has(v) : - flipped ? !is(v, a.get(k, NOT_SET)) : !is(a.get(k, NOT_SET), v)) { - allEqual = false; - return false; - } - }); - - return allEqual && a.size === bSize; -} diff --git a/src/utils/deepEqual.ts b/src/utils/deepEqual.ts new file mode 100644 index 0000000000..c76d62c840 --- /dev/null +++ b/src/utils/deepEqual.ts @@ -0,0 +1,97 @@ +import { is } from '../is'; +import { NOT_SET } from '../TrieUtils'; +import { isCollection } from '../predicates/isCollection'; +import { isKeyed } from '../predicates/isKeyed'; +import { isIndexed } from '../predicates/isIndexed'; +import { isAssociative } from '../predicates/isAssociative'; +import { isOrdered } from '../predicates/isOrdered'; +import type { Collection } from '../../type-definitions/immutable'; +import type { Repeat } from '../Repeat'; +import type { Range } from '../Range'; + +export default function deepEqual( + a: Range | Repeat | Collection, + b: unknown +): boolean { + if (a === b) { + return true; + } + + if ( + !isCollection(b) || + // @ts-expect-error size should exists on Collection + (a.size !== undefined && b.size !== undefined && a.size !== b.size) || + // @ts-expect-error __hash exists on Collection + (a.__hash !== undefined && + // @ts-expect-error __hash exists on Collection + b.__hash !== undefined && + // @ts-expect-error __hash exists on Collection + a.__hash !== b.__hash) || + isKeyed(a) !== isKeyed(b) || + isIndexed(a) !== isIndexed(b) || + // @ts-expect-error Range extends Collection, which implements [Symbol.iterator], so it is valid + isOrdered(a) !== isOrdered(b) + ) { + return false; + } + + // @ts-expect-error size should exists on Collection + if (a.size === 0 && b.size === 0) { + return true; + } + + const notAssociative = !isAssociative(a); + + // @ts-expect-error Range extends Collection, which implements [Symbol.iterator], so it is valid + if (isOrdered(a)) { + const entries = a.entries(); + // @ts-expect-error need to cast as boolean + return ( + b.every((v, k) => { + const entry = entries.next().value; + return entry && is(entry[1], v) && (notAssociative || is(entry[0], k)); + }) && entries.next().done + ); + } + + let flipped = false; + + if (a.size === undefined) { + // @ts-expect-error size should exists on Collection + if (b.size === undefined) { + if (typeof a.cacheResult === 'function') { + a.cacheResult(); + } + } else { + flipped = true; + const _ = a; + a = b; + b = _; + } + } + + let allEqual = true; + const bSize: number = + // @ts-expect-error b is Range | Repeat | Collection as it may have been flipped, and __iterate is valid + b.__iterate((v, k) => { + if ( + notAssociative + ? // @ts-expect-error has exists on Collection + !a.has(v) + : flipped + ? // @ts-expect-error type of `get` does not "catch" the version with `notSetValue` + !is(v, a.get(k, NOT_SET)) + : // @ts-expect-error type of `get` does not "catch" the version with `notSetValue` + !is(a.get(k, NOT_SET), v) + ) { + allEqual = false; + return false; + } + }); + + return ( + allEqual && + // @ts-expect-error size should exists on Collection + a.size === bSize + ); +} diff --git a/src/utils/forceIterator.js b/src/utils/forceIterator.js deleted file mode 100644 index 845aa06a07..0000000000 --- a/src/utils/forceIterator.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -import { Iterable } from '../Iterable' -import { getIterator } from '../Iterator' -import isArrayLike from './isArrayLike' - -export default function forceIterator(keyPath) { - var iter = getIterator(keyPath); - if (!iter) { - // Array might not be iterable in this environment, so we need a fallback - // to our wrapped type. - if (!isArrayLike(keyPath)) { - throw new TypeError('Expected iterable or array-like: ' + keyPath); - } - iter = getIterator(Iterable(keyPath)); - } - return iter; -} diff --git a/src/utils/hasOwnProperty.ts b/src/utils/hasOwnProperty.ts new file mode 100644 index 0000000000..cb5ba22368 --- /dev/null +++ b/src/utils/hasOwnProperty.ts @@ -0,0 +1 @@ +export default Object.prototype.hasOwnProperty; diff --git a/src/utils/invariant.js b/src/utils/invariant.js deleted file mode 100644 index 867c8ae786..0000000000 --- a/src/utils/invariant.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -export default function invariant(condition, error) { - if (!condition) throw new Error(error); -} diff --git a/src/utils/invariant.ts b/src/utils/invariant.ts new file mode 100644 index 0000000000..958e6c977b --- /dev/null +++ b/src/utils/invariant.ts @@ -0,0 +1,6 @@ +export default function invariant( + condition: unknown, + error: string +): asserts condition { + if (!condition) throw new Error(error); +} diff --git a/src/utils/isArrayLike.js b/src/utils/isArrayLike.js deleted file mode 100644 index 9283c72fb0..0000000000 --- a/src/utils/isArrayLike.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -export default function isArrayLike(value) { - return value && typeof value.length === 'number'; -} diff --git a/src/utils/isArrayLike.ts b/src/utils/isArrayLike.ts new file mode 100644 index 0000000000..82659d6c54 --- /dev/null +++ b/src/utils/isArrayLike.ts @@ -0,0 +1,25 @@ +export default function isArrayLike( + value: unknown +): value is ArrayLike { + if (Array.isArray(value) || typeof value === 'string') { + return true; + } + + // @ts-expect-error "Type 'unknown' is not assignable to type 'boolean'" : convert to Boolean + return ( + value && + typeof value === 'object' && + // @ts-expect-error check that `'length' in value &&` + Number.isInteger(value.length) && + // @ts-expect-error check that `'length' in value &&` + value.length >= 0 && + // @ts-expect-error check that `'length' in value &&` + (value.length === 0 + ? // Only {length: 0} is considered Array-like. + Object.keys(value).length === 1 + : // An object is only Array-like if it has a property where the last value + // in the array-like may be found (which could be undefined). + // @ts-expect-error check that `'length' in value &&` + value.hasOwnProperty(value.length - 1)) + ); +} diff --git a/src/utils/isDataStructure.ts b/src/utils/isDataStructure.ts new file mode 100644 index 0000000000..e71c55bb7d --- /dev/null +++ b/src/utils/isDataStructure.ts @@ -0,0 +1,20 @@ +import type { Collection, Record } from '../../type-definitions/immutable'; +import { isImmutable } from '../predicates/isImmutable'; +import isPlainObj from './isPlainObj'; + +/** + * Returns true if the value is a potentially-persistent data structure, either + * provided by Immutable.js or a plain Array or Object. + */ +export default function isDataStructure( + value: unknown +): value is + | Collection + | Record + | Array + | object { + return ( + typeof value === 'object' && + (isImmutable(value) || Array.isArray(value) || isPlainObj(value)) + ); +} diff --git a/src/utils/isPlainObj.ts b/src/utils/isPlainObj.ts new file mode 100644 index 0000000000..07e73e208a --- /dev/null +++ b/src/utils/isPlainObj.ts @@ -0,0 +1,26 @@ +const toString = Object.prototype.toString; + +export default function isPlainObject(value: unknown): value is object { + // The base prototype's toString deals with Argument objects and native namespaces like Math + if ( + !value || + typeof value !== 'object' || + toString.call(value) !== '[object Object]' + ) { + return false; + } + + const proto = Object.getPrototypeOf(value); + if (proto === null) { + return true; + } + + // Iteratively going up the prototype chain is needed for cross-realm environments (differing contexts, iframes, etc) + let parentProto = proto; + let nextProto = Object.getPrototypeOf(proto); + while (nextProto !== null) { + parentProto = nextProto; + nextProto = Object.getPrototypeOf(parentProto); + } + return parentProto === proto; +} diff --git a/src/utils/mixin.js b/src/utils/mixin.js deleted file mode 100644 index cff365086d..0000000000 --- a/src/utils/mixin.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -/** - * Contributes additional methods to a constructor - */ -export default function mixin(ctor, methods) { - var keyCopier = key => { ctor.prototype[key] = methods[key]; }; - Object.keys(methods).forEach(keyCopier); - Object.getOwnPropertySymbols && - Object.getOwnPropertySymbols(methods).forEach(keyCopier); - return ctor; -} diff --git a/src/utils/mixin.ts b/src/utils/mixin.ts new file mode 100644 index 0000000000..3d4cee5fc6 --- /dev/null +++ b/src/utils/mixin.ts @@ -0,0 +1,20 @@ +type Constructor = new (...args: unknown[]) => T; + +/** + * Contributes additional methods to a constructor + */ +export default function mixin( + ctor: C, + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type + methods: Record +): C { + const keyCopier = (key: string | symbol): void => { + // @ts-expect-error how to handle symbol ? + ctor.prototype[key] = methods[key]; + }; + Object.keys(methods).forEach(keyCopier); + // eslint-disable-next-line @typescript-eslint/no-unused-expressions -- TODO enable eslint here + Object.getOwnPropertySymbols && + Object.getOwnPropertySymbols(methods).forEach(keyCopier); + return ctor; +} diff --git a/src/utils/quoteString.ts b/src/utils/quoteString.ts new file mode 100644 index 0000000000..8d9b825a38 --- /dev/null +++ b/src/utils/quoteString.ts @@ -0,0 +1,11 @@ +/** + * Converts a value to a string, adding quotes if a string was provided. + */ +export default function quoteString(value: unknown): string { + try { + return typeof value === 'string' ? JSON.stringify(value) : String(value); + // eslint-disable-next-line @typescript-eslint/no-unused-vars + } catch (_ignoreError) { + return JSON.stringify(value); + } +} diff --git a/src/utils/shallowCopy.ts b/src/utils/shallowCopy.ts new file mode 100644 index 0000000000..37aad28015 --- /dev/null +++ b/src/utils/shallowCopy.ts @@ -0,0 +1,19 @@ +import arrCopy from './arrCopy'; +import hasOwnProperty from './hasOwnProperty'; + +export default function shallowCopy(from: Array): Array; +export default function shallowCopy(from: O): O; +export default function shallowCopy( + from: Array | O +): Array | O { + if (Array.isArray(from)) { + return arrCopy(from); + } + const to: Partial = {}; + for (const key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } + return to as O; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..b0fa1baad1 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + /* Base Options: */ + "esModuleInterop": true, + "skipLibCheck": true, + "target": "es2022", + "allowJs": true, + "resolveJsonModule": true, + "moduleDetection": "force", + "isolatedModules": true, + "verbatimModuleSyntax": true, + /* Strictness */ + "strict": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + /* If NOT transpiling with TypeScript: */ + "module": "ESNext", + "moduleResolution": "bundler", + "noEmit": true, + /* If your code runs in the DOM: */ + "lib": ["es2022", "dom", "dom.iterable"] + } +} diff --git a/tsconfig.src.json b/tsconfig.src.json new file mode 100644 index 0000000000..ae550d9ff2 --- /dev/null +++ b/tsconfig.src.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/Immutable.js"] +} diff --git a/tstyche.config.json b/tstyche.config.json new file mode 100644 index 0000000000..903317e015 --- /dev/null +++ b/tstyche.config.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://tstyche.org/schemas/config.json", + "testFileMatch": [ + "type-definitions/ts-tests/*.ts" + ] +} diff --git a/type-definitions/Immutable.d.ts b/type-definitions/Immutable.d.ts deleted file mode 100644 index 29d48af16d..0000000000 --- a/type-definitions/Immutable.d.ts +++ /dev/null @@ -1,3086 +0,0 @@ -/** - * Copyright (c) 2014-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -/** - * Immutable data encourages pure functions (data-in, data-out) and lends itself - * to much simpler application development and enabling techniques from - * functional programming such as lazy evaluation. - * - * While designed to bring these powerful functional concepts to JavaScript, it - * presents an Object-Oriented API familiar to Javascript engineers and closely - * mirroring that of Array, Map, and Set. It is easy and efficient to convert to - * and from plain Javascript types. - * - * Note: all examples are presented in [ES6][]. To run in all browsers, they - * need to be translated to ES3. For example: - * - * // ES6 - * foo.map(x => x * x); - * // ES3 - * foo.map(function (x) { return x * x; }); - * - * [ES6]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla - */ - -declare module Immutable { - - /** - * Deeply converts plain JS objects and arrays to Immutable Maps and Lists. - * - * If a `reviver` is optionally provided, it will be called with every - * collection as a Seq (beginning with the most nested collections - * and proceeding to the top-level collection itself), along with the key - * refering to each collection and the parent JS object provided as `this`. - * For the top level, object, the key will be `""`. This `reviver` is expected - * to return a new Immutable Iterable, allowing for custom conversions from - * deep JS objects. - * - * This example converts JSON to List and OrderedMap: - * - * Immutable.fromJS({a: {b: [10, 20, 30]}, c: 40}, function (key, value) { - * var isIndexed = Immutable.Iterable.isIndexed(value); - * return isIndexed ? value.toList() : value.toOrderedMap(); - * }); - * - * // true, "b", {b: [10, 20, 30]} - * // false, "a", {a: {b: [10, 20, 30]}, c: 40} - * // false, "", {"": {a: {b: [10, 20, 30]}, c: 40}} - * - * If `reviver` is not provided, the default behavior will convert Arrays into - * Lists and Objects into Maps. - * - * `reviver` acts similarly to the [same parameter in `JSON.parse`][1]. - * - * `Immutable.fromJS` is conservative in its conversion. It will only convert - * arrays which pass `Array.isArray` to Lists, and only raw objects (no custom - * prototype) to Map. - * - * Keep in mind, when using JS objects to construct Immutable Maps, that - * JavaScript Object properties are always strings, even if written in a - * quote-less shorthand, while Immutable Maps accept keys of any type. - * - * ```js - * var obj = { 1: "one" }; - * Object.keys(obj); // [ "1" ] - * obj["1"]; // "one" - * obj[1]; // "one" - * - * var map = Map(obj); - * map.get("1"); // "one" - * map.get(1); // undefined - * ``` - * - * Property access for JavaScript Objects first converts the key to a string, - * but since Immutable Map keys can be of any type the argument to `get()` is - * not altered. - * - * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter - * "Using the reviver parameter" - */ - export function fromJS( - json: any, - reviver?: (k: any, v: Iterable) => any - ): any; - - - /** - * Value equality check with semantics similar to `Object.is`, but treats - * Immutable `Iterable`s as values, equal if the second `Iterable` includes - * equivalent values. - * - * It's used throughout Immutable when checking for equality, including `Map` - * key equality and `Set` membership. - * - * var map1 = Immutable.Map({a:1, b:1, c:1}); - * var map2 = Immutable.Map({a:1, b:1, c:1}); - * assert(map1 !== map2); - * assert(Object.is(map1, map2) === false); - * assert(Immutable.is(map1, map2) === true); - * - * Note: Unlike `Object.is`, `Immutable.is` assumes `0` and `-0` are the same - * value, matching the behavior of ES6 Map key equality. - */ - export function is(first: any, second: any): boolean; - - - /** - * The `hash()` function is an important part of how Immutable determines if - * two values are equivalent and is used to determine how to store those - * values. Provided with any value, `hash()` will return a 31-bit integer. - * - * When designing Objects which may be equal, it's important than when a - * `.equals()` method returns true, that both values `.hashCode()` method - * return the same value. `hash()` may be used to produce those values. - * - * Note that `hash()` attempts to balance between speed and avoiding - * collisions, however it makes no attempt to produce secure hashes. - */ - export function hash(value: any): number; - - - /** - * Lists are ordered indexed dense collections, much like a JavaScript - * Array. - * - * Lists are immutable and fully persistent with O(log32 N) gets and sets, - * and O(1) push and pop. - * - * Lists implement Deque, with efficient addition and removal from both the - * end (`push`, `pop`) and beginning (`unshift`, `shift`). - * - * Unlike a JavaScript Array, there is no distinction between an - * "unset" index and an index set to `undefined`. `List#forEach` visits all - * indices from 0 to size, regardless of whether they were explicitly defined. - */ - export module List { - - /** - * True if the provided value is a List - * - * ```js - * List.isList([]); // false - * List.isList(List([])); // true - * ``` - */ - function isList(maybeList: any): maybeList is List; - - /** - * Creates a new List containing `values`. - * - * ```js - * List.of(1, 2, 3, 4).toJS(); - * // [ 1, 2, 3, 4 ] - * - * List.of({x:1}, 2, [3], 4).toJS(); - * // [ { x: 1 }, 2, [ 3 ], 4 ] - * ``` - */ - function of(...values: T[]): List; - } - - /** - * Create a new immutable List containing the values of the provided - * iterable-like. - * - * ```js - * List().toJS(); // [] - * - * const plainArray = [1, 2, 3, 4]; - * const listFromPlainArray = List(plainArray); - * - * const plainSet = new Set([1, 2, 3, 4]); - * const listFromPlainSet = List(plainSet); - * - * const iterableArray = plainArray[Symbol.iterator](); - * const listFromIterableArray = List(iterableArray); - * - * listFromPlainArray.toJS(); // [ 1, 2, 3, 4 ] - * listFromPlainSet.toJS(); // [ 1, 2, 3, 4 ] - * listFromIterableArray.toJS(); // [ 1, 2, 3, 4 ] - * - * Immutable.is(listFromPlainArray, listFromIterableSet); // true - * Immutable.is(listFromPlainSet, listFromIterableSet) // true - * Immutable.is(listFromPlainSet, listFromPlainArray) // true - * ``` - */ - export function List(): List; - export function List(): List; - export function List(iterable: ESIterable): List; - - export interface List extends Collection.Indexed { - - // Persistent changes - - /** - * Returns a new List which includes `value` at `index`. If `index` already - * exists in this List, it will be replaced. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.set(-1, "value")` sets the last item in the List. - * - * If `index` larger than `size`, the returned List's `size` will be large - * enough to include the `index`. - * - * ```js - * const originalList = List([0]); - * originalList.set(1, 1).toJS(); // [ 0, 1 ] - * originalList.set(0, 'overwritten').toJS(); // [ 'overwritten' ] - * - * List().set(50000, 'value').size; - * //50001 - * ``` - */ - set(index: number, value: T): List; - - /** - * Returns a new List which excludes this `index` and with a size 1 less - * than this List. Values at indices above `index` are shifted down by 1 to - * fill the position. - * - * This is synonymous with `list.splice(index, 1)`. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.delete(-1)` deletes the last item in the List. - * - * Note: `delete` cannot be safely used in IE8 - * - * ```js - * List([0, 1, 2, 3, 4]).delete(0).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - * - * @alias remove - */ - delete(index: number): List; - remove(index: number): List; - - /** - * Returns a new List with `value` at `index` with a size 1 more than this - * List. Values at indices above `index` are shifted over by 1. - * - * This is synonymous with `list.splice(index, 0, value)`. - * - * ```js - * List([0, 1, 2, 3, 4]).insert(6, 5).toJS(); - * // [ 0, 1, 2, 3, 4, 5 ] - * ``` - */ - insert(index: number, value: T): List; - - /** - * Returns a new List with 0 size and no values. - * - * ```js - * List([1, 2, 3, 4]).clear().toJS(); - * // [] - * ``` - */ - clear(): List; - - /** - * Returns a new List with the provided `values` appended, starting at this - * List's `size`. - * - * ```js - * List([1, 2, 3, 4]).push(5).toJS(); - * // [ 1, 2, 3, 4, 5 ] - * ``` - */ - push(...values: T[]): List; - - /** - * Returns a new List with a size ones less than this List, excluding - * the last index in this List. - * - * Note: this differs from `Array#pop` because it returns a new - * List rather than the removed value. Use `last()` to get the last value - * in this List. - * ```js - * List([1, 2, 3, 4]).pop().toJS(); - * // [ 1, 2, 3 ] - * ``` - */ - pop(): List; - - /** - * Returns a new List with the provided `values` prepended, shifting other - * values ahead to higher indices. - * - * ```js - * List([ 2, 3, 4]).unshift(1).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - */ - unshift(...values: T[]): List; - - /** - * Returns a new List with a size ones less than this List, excluding - * the first index in this List, shifting all other values to a lower index. - * - * Note: this differs from `Array#shift` because it returns a new - * List rather than the removed value. Use `first()` to get the first - * value in this List. - * - * ```js - * List([ 0, 1, 2, 3, 4]).shift(0).toJS(); - * // [ 1, 2, 3, 4 ] - * ``` - */ - shift(): List; - - /** - * Returns a new List with an updated value at `index` with the return - * value of calling `updater` with the existing value, or `notSetValue` if - * `index` was not set. If called with a single argument, `updater` is - * called with the List itself. - * - * `index` may be a negative number, which indexes back from the end of the - * List. `v.update(-1)` updates the last item in the List. - * - * @see `Map#update` - */ - update(updater: (value: List) => List): List; - update(index: number, updater: (value: T) => T): List; - update(index: number, notSetValue: T, updater: (value: T) => T): List; - - /** - * @see `Map#merge` - */ - merge(...iterables: Iterable.Indexed[]): List; - merge(...iterables: Array[]): List; - - /** - * @see `Map#mergeWith` - */ - mergeWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Iterable.Indexed[] - ): List; - mergeWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Array[] - ): List; - - /** - * @see `Map#mergeDeep` - */ - mergeDeep(...iterables: Iterable.Indexed[]): List; - mergeDeep(...iterables: Array[]): List; - - /** - * @see `Map#mergeDeepWith` - */ - mergeDeepWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Iterable.Indexed[] - ): List; - mergeDeepWith( - merger: (previous: T, next: T, key: number) => T, - ...iterables: Array[] - ): List; - - /** - * Returns a new List with size `size`. If `size` is less than this - * List's size, the new List will exclude values at the higher indices. - * If `size` is greater than this List's size, the new List will have - * undefined values for the newly available indices. - * - * When building a new List and the final size is known up front, `setSize` - * used in conjunction with `withMutations` may result in the more - * performant construction. - */ - setSize(size: number): List; - - - // Deep persistent changes - - /** - * Returns a new List having set `value` at this `keyPath`. If any keys in - * `keyPath` do not exist, a new immutable Map will be created at that key. - * - * Index numbers are used as keys to determine the path to follow in - * the List. - * - * ```js - * Immutable.fromJS([0, 1, 2, [3, 4]]).setIn([3, 0], -3).toJS(); - * // [ 0, 1, 2, [ -3, 4 ] ] - * ``` - */ - setIn(keyPath: Array, value: any): List; - setIn(keyPath: Iterable, value: any): List; - - /** - * Returns a new List having removed the value at this `keyPath`. If any - * keys in `keyPath` do not exist, no change will occur. - * - * ```js - * Immutable.fromJS([0, 1, 2, [3, 4]]).deleteIn([3, 1]).toJS(); - * // [ 0, 1, 2, [ 3 ] ] - * ``` - * @alias removeIn - */ - deleteIn(keyPath: Array): List; - deleteIn(keyPath: Iterable): List; - removeIn(keyPath: Array): List; - removeIn(keyPath: Iterable): List; - - /** - * @see `Map#updateIn` - */ - updateIn( - keyPath: Array, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Array, - notSetValue: any, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Iterable, - updater: (value: any) => any - ): List; - updateIn( - keyPath: Iterable, - notSetValue: any, - updater: (value: any) => any - ): List; - - /** - * @see `Map#mergeIn` - */ - mergeIn(keyPath: Array | Iterable, ...iterables: Array): List; - - /** - * @see `Map#mergeDeepIn` - */ - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): List; - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set`, `push`, `pop`, `shift`, `unshift` and - * `merge` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: List) => any): List; - - /** - * @see `Map#asMutable` - */ - asMutable(): List; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): List; - - // Sequence algorithms - - /** - * Returns a new List with values passed through a - * `mapper` function. - * - * List([1,2]).map(x => 10 * x) - * // List [ 10, 20 ] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): List; - } - - - /** - * Immutable Map is an unordered Iterable.Keyed of (key, value) pairs with - * `O(log32 N)` gets and `O(log32 N)` persistent sets. - * - * Iteration order of a Map is undefined, however is stable. Multiple - * iterations of the same Map will iterate in the same order. - * - * Map's keys can be of any type, and use `Immutable.is` to determine key - * equality. This allows the use of any value (including NaN) as a key. - * - * Because `Immutable.is` returns equality based on value semantics, and - * Immutable collections are treated as values, any Immutable collection may - * be used as a key. - * - * Map().set(List.of(1), 'listofone').get(List.of(1)); - * // 'listofone' - * - * Any JavaScript object may be used as a key, however strict identity is used - * to evaluate key equality. Two similar looking objects will represent two - * different keys. - * - * Implemented by a hash-array mapped trie. - */ - export module Map { - - /** - * True if the provided value is a Map - * - * ```js - * Map.isMap({}); // false - * Map.isMap(Immutable.Map()); // true - * ``` - */ - function isMap(maybeMap: any): maybeMap is Map; - - /** - * Creates a new Map from alternating keys and values - * - * ```js - * Map.of( - * 'key', 'value', - * 'numerical value', 3, - * 0, 'numerical key' - * ).toJS(); - * // { '0': 'numerical key', key: 'value', 'numerical value': 3 } - * ``` - * - * @deprecated Use Map([ [ 'k', 'v' ] ]) or Map({ k: 'v' }) - */ - function of(...keyValues: any[]): Map; - } - - /** - * Creates a new Immutable Map. - * - * Created with the same key value pairs as the provided Iterable.Keyed or - * JavaScript Object or expects an Iterable of [K, V] tuple entries. - * - * var newMap = Map({key: "value"}); - * var newMap = Map([["key", "value"]]); - * - * Keep in mind, when using JS objects to construct Immutable Maps, that - * JavaScript Object properties are always strings, even if written in a - * quote-less shorthand, while Immutable Maps accept keys of any type. - * - * ```js - * var obj = { 1: "one" }; - * Object.keys(obj); // [ "1" ] - * obj["1"]; // "one" - * obj[1]; // "one" - * - * var map = Map(obj); - * map.get("1"); // "one" - * map.get(1); // undefined - * ``` - * - * Property access for JavaScript Objects first converts the key to a string, - * but since Immutable Map keys can be of any type the argument to `get()` is - * not altered. - */ - export function Map(): Map; - export function Map(): Map; - export function Map(iterable: ESIterable<[K, V]>): Map; - export function Map(iterable: ESIterable>): Map; - export function Map(obj: {[key: string]: V}): Map; - - export interface Map extends Collection.Keyed { - - // Persistent changes - - /** - * Returns a new Map also containing the new key, value pair. If an equivalent - * key already exists in this Map, it will be replaced. - * - * ```js - * const originalMap = Immutable.Map(); - * const newerMap = originalMap.set('key', 'value'); - * const newestMap = newerMap.set('key', 'newer value'); - * originalMap.toJS(); // {} - * newerMap.toJS(); // { key: 'value' } - * newestMap.toJS(); // { key: 'newer value' } - * ``` - */ - set(key: K, value: V): Map; - - /** - * Returns a new Map which excludes this `key`. - * - * Note: `delete` cannot be safely used in IE8, but is provided to mirror - * the ES6 collection API. - * - * ```js - * Immutable.Map({ - * key: 'value', - * otherKey: 'other value' - * }).delete('otherKey').toJS(); - * // { key: 'value' } - * ``` - * - * @alias remove - */ - delete(key: K): Map; - remove(key: K): Map; - - /** - * Returns a new Map which excludes the provided `keys`. - * - * var names = Immutable.Map({ a: "Aaron", b: "Barry", c: "Connor" }); - * names.deleteAll(['a', 'c']); // { b: "Barry" } - * - * @alias removeAll - */ - deleteAll(keys: Array | ESIterable): Map; - removeAll(keys: Array | ESIterable): Map; - - /** - * Returns a new Map containing no keys or values. - * - * ```js - * Immutable.Map({ key: 'value' }).clear().toJS(); - * // {} - * ``` - */ - clear(): Map; - - /** - * Returns a new Map having updated the value at this `key` with the return - * value of calling `updater` with the existing value, or `notSetValue` if - * the key was not set. If called with only a single argument, `updater` is - * called with the Map itself. - * - * Equivalent to: `map.set(key, updater(map.get(key)))`. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * const newMap = originalMap.update('key', value => { - * return value + value; - * }); - * newMap.toJS(); // { key: 'valuevalue' } - * - * When a `notSetValue` is provided, it is provided to the `updater` - * function when the value at the key does not exist in the Map. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * let newMap = originalMap.update('noKey', 'no value', value => { - * return value + value; - * }); - * newMap.toJS(); // { key: 'value', noKey: 'no valueno value' } - * - * However, if the `updater` function returns the same value it was called - * with, then no change will occur. This is still true if `notSetValue` - * is provided. - * - * var data1 = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data2 = data1.update('key', 100, val => val); - * assert(data2 === data1); - * - * If no key is provided, then the `updater` function return value is - * returned as well. - * - * const originalMap = Immutable.Map({ - * key: 'value' - * }); - * - * const result = originalMap.update(map => { - * return map.get('key'); - * }); - * result; // 'value' - * - */ - update(key: K, updater: (value: V) => V): Map; - update(key: K, notSetValue: V, updater: (value: V) => V): Map; - update(updater: (value: Map) => R): R; - - /** - * Returns a new Map resulting from merging the provided Iterables - * (or JS objects) into this Map. In other words, this takes each entry of - * each iterable and sets it on this Map. - * - * If any of the values provided to `merge` are not Iterable (would return - * false for `Immutable.Iterable.isIterable`) then they are deeply converted - * via `Immutable.fromJS` before being merged. However, if the value is an - * Iterable but includes non-iterable JS objects or arrays, those nested - * values will be preserved. - * - * var x = Immutable.Map({a: 10, b: 20, c: 30}); - * var y = Immutable.Map({b: 40, a: 50, d: 60}); - * x.merge(y) // { a: 50, b: 40, c: 30, d: 60 } - * y.merge(x) // { b: 20, a: 10, d: 60, c: 30 } - * - */ - merge(...iterables: Iterable[]): Map; - merge(...iterables: {[key: string]: V}[]): Map; - - /** - * Like `merge()`, `mergeWith()` returns a new Map resulting from merging - * the provided Iterables (or JS objects) into this Map, but uses the - * `merger` function for dealing with conflicts. - * - * var x = Immutable.Map({a: 10, b: 20, c: 30}); - * var y = Immutable.Map({b: 40, a: 50, d: 60}); - * x.mergeWith((prev, next) => prev / next, y) // { a: 0.2, b: 0.5, c: 30, d: 60 } - * y.mergeWith((prev, next) => prev / next, x) // { b: 2, a: 5, d: 60, c: 30 } - * - */ - mergeWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: Iterable[] - ): Map; - mergeWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: {[key: string]: V}[] - ): Map; - - /** - * Like `merge()`, but when two Iterables conflict, it merges them as well, - * recursing deeply through the nested data. - * - * var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } }); - * var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } }); - * x.mergeDeep(y) // {a: { x: 2, y: 10 }, b: { x: 20, y: 5 }, c: { z: 3 } } - * - */ - mergeDeep(...iterables: Iterable[]): Map; - mergeDeep(...iterables: {[key: string]: V}[]): Map; - - /** - * Like `mergeDeep()`, but when two non-Iterables conflict, it uses the - * `merger` function to determine the resulting value. - * - * var x = Immutable.fromJS({a: { x: 10, y: 10 }, b: { x: 20, y: 50 } }); - * var y = Immutable.fromJS({a: { x: 2 }, b: { y: 5 }, c: { z: 3 } }); - * x.mergeDeepWith((prev, next) => prev / next, y) - * // {a: { x: 5, y: 10 }, b: { x: 20, y: 10 }, c: { z: 3 } } - * - */ - mergeDeepWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: Iterable[] - ): Map; - mergeDeepWith( - merger: (previous: V, next: V, key: K) => V, - ...iterables: {[key: string]: V}[] - ): Map; - - - // Deep persistent changes - - /** - * Returns a new Map having set `value` at this `keyPath`. If any keys in - * `keyPath` do not exist, a new immutable Map will be created at that key. - * - * ```js - * const originalMap = Immutable.fromJS({ - * subObject: { - * subKey: 'subvalue', - * subSubObject: { - * subSubKey: 'subSubValue' - * } - * } - * }); - - * const newMap = originalMap.setIn(['subObject', 'subKey'], 'ha ha!'); - * newMap.toJS(); - * // {subObject:{subKey:'ha ha!', subSubObject:{subSubKey:'subSubValue'}}} - * - * const newerMap = originalMap.setIn( - * ['subObject', 'subSubObject', 'subSubKey'], - * 'ha ha ha!' - * ); - * newerMap.toJS(); - * // {subObject:{subKey:'subvalue', subSubObject:{subSubKey:'ha ha ha!'}}} - * ``` - */ - setIn(keyPath: Array, value: any): Map; - setIn(KeyPath: Iterable, value: any): Map; - - /** - * Returns a new Map having removed the value at this `keyPath`. If any keys - * in `keyPath` do not exist, no change will occur. - * - * @alias removeIn - */ - deleteIn(keyPath: Array): Map; - deleteIn(keyPath: Iterable): Map; - removeIn(keyPath: Array): Map; - removeIn(keyPath: Iterable): Map; - - /** - * Returns a new Map having applied the `updater` to the entry found at the - * keyPath. - * - * If any keys in `keyPath` do not exist, new Immutable `Map`s will - * be created at those keys. If the `keyPath` does not already contain a - * value, the `updater` function will be called with `notSetValue`, if - * provided, otherwise `undefined`. - * - * var data = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data = data.updateIn(['a', 'b', 'c'], val => val * 2); - * // { a: { b: { c: 20 } } } - * - * If the `updater` function returns the same value it was called with, then - * no change will occur. This is still true if `notSetValue` is provided. - * - * var data1 = Immutable.fromJS({ a: { b: { c: 10 } } }); - * data2 = data1.updateIn(['x', 'y', 'z'], 100, val => val); - * assert(data2 === data1); - * - */ - updateIn( - keyPath: Array, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Array, - notSetValue: any, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Iterable, - updater: (value: any) => any - ): Map; - updateIn( - keyPath: Iterable, - notSetValue: any, - updater: (value: any) => any - ): Map; - - /** - * A combination of `updateIn` and `merge`, returning a new Map, but - * performing the merge at a point arrived at by following the keyPath. - * In other words, these two lines are equivalent: - * - * x.updateIn(['a', 'b', 'c'], abc => abc.merge(y)); - * x.mergeIn(['a', 'b', 'c'], y); - * - */ - mergeIn(keyPath: Array | Iterable, ...iterables: Array): Map; - - /** - * A combination of `updateIn` and `mergeDeep`, returning a new Map, but - * performing the deep merge at a point arrived at by following the keyPath. - * In other words, these two lines are equivalent: - * - * x.updateIn(['a', 'b', 'c'], abc => abc.mergeDeep(y)); - * x.mergeDeepIn(['a', 'b', 'c'], y); - * - */ - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): Map; - - // Transient changes - - /** - * Every time you call one of the above functions, a new immutable Map is - * created. If a pure function calls a number of these to produce a final - * return value, then a penalty on performance and memory has been paid by - * creating all of the intermediate immutable Maps. - * - * If you need to apply a series of mutations to produce a new immutable - * Map, `withMutations()` creates a temporary mutable copy of the Map which - * can apply mutations in a highly performant manner. In fact, this is - * exactly how complex mutations like `merge` are done. - * - * As an example, this results in the creation of 2, not 4, new Maps: - * - * var map1 = Immutable.Map(); - * var map2 = map1.withMutations(map => { - * map.set('a', 1).set('b', 2).set('c', 3); - * }); - * assert(map1.size === 0); - * assert(map2.size === 3); - * - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` and `merge` may be used mutatively. - * - */ - withMutations(mutator: (mutable: Map) => any): Map; - - /** - * Another way to avoid creation of intermediate Immutable maps is to create - * a mutable copy of this collection. Mutable copies *always* return `this`, - * and thus shouldn't be used for equality. Your function should never return - * a mutable copy of a collection, only use it internally to create a new - * collection. If possible, use `withMutations` as it provides an easier to - * use API. - * - * Note: if the collection is already mutable, `asMutable` returns itself. - * - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` and `merge` may be used mutatively. - */ - asMutable(): Map; - - /** - * The yin to `asMutable`'s yang. Because it applies to mutable collections, - * this operation is *mutable* and returns itself. Once performed, the mutable - * copy has become immutable and can be safely returned from a function. - */ - asImmutable(): Map; - - // Sequence algorithms - - /** - * Returns a new Map with values passed through a - * `mapper` function. - * - * Map({ a: 1, b: 2 }).map(x => 10 * x) - * // Map { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Map; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Map; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Map; - } - - - /** - * A type of Map that has the additional guarantee that the iteration order of - * entries will be the order in which they were set(). - * - * The iteration behavior of OrderedMap is the same as native ES6 Map and - * JavaScript Object. - * - * Note that `OrderedMap` are more expensive than non-ordered `Map` and may - * consume more memory. `OrderedMap#set` is amortized O(log32 N), but not - * stable. - */ - - export module OrderedMap { - - /** - * True if the provided value is an OrderedMap. - */ - function isOrderedMap(maybeOrderedMap: any): maybeOrderedMap is OrderedMap; - } - - /** - * Creates a new Immutable OrderedMap. - * - * Created with the same key value pairs as the provided Iterable.Keyed or - * JavaScript Object or expects an Iterable of [K, V] tuple entries. - * - * The iteration order of key-value pairs provided to this constructor will - * be preserved in the OrderedMap. - * - * var newOrderedMap = OrderedMap({key: "value"}); - * var newOrderedMap = OrderedMap([["key", "value"]]); - * - */ - export function OrderedMap(): OrderedMap; - export function OrderedMap(): OrderedMap; - export function OrderedMap(iterable: ESIterable<[K, V]>): OrderedMap; - export function OrderedMap(iterable: ESIterable>): OrderedMap; - export function OrderedMap(obj: {[key: string]: V}): OrderedMap; - - export interface OrderedMap extends Map { - - // Sequence algorithms - - /** - * Returns a new OrderedMap with values passed through a - * `mapper` function. - * - * OrderedMap({ a: 1, b: 2 }).map(x => 10 * x) - * // OrderedMap { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): OrderedMap; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): OrderedMap; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): OrderedMap; - } - - - /** - * A Collection of unique values with `O(log32 N)` adds and has. - * - * When iterating a Set, the entries will be (value, value) pairs. Iteration - * order of a Set is undefined, however is stable. Multiple iterations of the - * same Set will iterate in the same order. - * - * Set values, like Map keys, may be of any type. Equality is determined using - * `Immutable.is`, enabling Sets to uniquely include other Immutable - * collections, custom value types, and NaN. - */ - export module Set { - - /** - * True if the provided value is a Set - */ - function isSet(maybeSet: any): maybeSet is Set; - - /** - * Creates a new Set containing `values`. - */ - function of(...values: T[]): Set; - - /** - * `Set.fromKeys()` creates a new immutable Set containing the keys from - * this Iterable or JavaScript Object. - */ - function fromKeys(iter: Iterable): Set; - function fromKeys(obj: {[key: string]: any}): Set; - } - - /** - * Create a new immutable Set containing the values of the provided - * iterable-like. - */ - export function Set(): Set; - export function Set(): Set; - export function Set(iterable: ESIterable): Set; - - export interface Set extends Collection.Set { - - // Persistent changes - - /** - * Returns a new Set which also includes this value. - */ - add(value: T): Set; - - /** - * Returns a new Set which excludes this value. - * - * Note: `delete` cannot be safely used in IE8 - * @alias remove - */ - delete(value: T): Set; - remove(value: T): Set; - - /** - * Returns a new Set containing no values. - */ - clear(): Set; - - /** - * Returns a Set including any value from `iterables` that does not already - * exist in this Set. - * @alias merge - */ - union(...iterables: Iterable[]): Set; - union(...iterables: Array[]): Set; - merge(...iterables: Iterable[]): Set; - merge(...iterables: Array[]): Set; - - - /** - * Returns a Set which has removed any values not also contained - * within `iterables`. - */ - intersect(...iterables: Iterable[]): Set; - intersect(...iterables: Array[]): Set; - - /** - * Returns a Set excluding any values contained within `iterables`. - */ - subtract(...iterables: Iterable[]): Set; - subtract(...iterables: Array[]): Set; - - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `add` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: Set) => any): Set; - - /** - * @see `Map#asMutable` - */ - asMutable(): Set; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): Set; - - // Sequence algorithms - - /** - * Returns a new Set with values passed through a - * `mapper` function. - * - * Set([1,2]).map(x => 10 * x) - * // Set [10,20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Set; - } - - - /** - * A type of Set that has the additional guarantee that the iteration order of - * values will be the order in which they were `add`ed. - * - * The iteration behavior of OrderedSet is the same as native ES6 Set. - * - * Note that `OrderedSet` are more expensive than non-ordered `Set` and may - * consume more memory. `OrderedSet#add` is amortized O(log32 N), but not - * stable. - */ - export module OrderedSet { - - /** - * True if the provided value is an OrderedSet. - */ - function isOrderedSet(maybeOrderedSet: any): boolean; - - /** - * Creates a new OrderedSet containing `values`. - */ - function of(...values: T[]): OrderedSet; - - /** - * `OrderedSet.fromKeys()` creates a new immutable OrderedSet containing - * the keys from this Iterable or JavaScript Object. - */ - function fromKeys(iter: Iterable): OrderedSet; - function fromKeys(obj: {[key: string]: any}): OrderedSet; - } - - /** - * Create a new immutable OrderedSet containing the values of the provided - * iterable-like. - */ - export function OrderedSet(): OrderedSet; - export function OrderedSet(): OrderedSet; - export function OrderedSet(iterable: ESIterable): OrderedSet; - - export interface OrderedSet extends Set { - - // Sequence algorithms - - /** - * Returns a new Set with values passed through a - * `mapper` function. - * - * OrderedSet([1,2]).map(x => 10 * x) - * // Set [10,20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): OrderedSet; - - /** - * Returns an OrderedSet of the same type "zipped" with the provided - * iterables. - * - * @see IndexedIterator.zip - * - * Like `zipWith`, but using the default `zipper`: creating an `Array`. - * - * var a = OrderedSet.of(1, 2, 3); - * var b = OrderedSet.of(4, 5, 6); - * var c = a.zip(b); // OrderedSet [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] - * - */ - zip(...iterables: Array>): OrderedSet; - - /** - * Returns an OrderedSet of the same type "zipped" with the provided - * iterables by using a custom `zipper` function. - * - * @see IndexedIterator.zipWith - */ - zipWith( - zipper: (value: T, otherValue: U) => Z, - otherIterable: Iterable - ): OrderedSet; - zipWith( - zipper: (value: T, otherValue: U, thirdValue: V) => Z, - otherIterable: Iterable, - thirdIterable: Iterable - ): OrderedSet; - zipWith( - zipper: (...any: Array) => Z, - ...iterables: Array> - ): OrderedSet; - - } - - - /** - * Stacks are indexed collections which support very efficient O(1) addition - * and removal from the front using `unshift(v)` and `shift()`. - * - * For familiarity, Stack also provides `push(v)`, `pop()`, and `peek()`, but - * be aware that they also operate on the front of the list, unlike List or - * a JavaScript Array. - * - * Note: `reverse()` or any inherent reverse traversal (`reduceRight`, - * `lastIndexOf`, etc.) is not efficient with a Stack. - * - * Stack is implemented with a Single-Linked List. - */ - export module Stack { - - /** - * True if the provided value is a Stack - */ - function isStack(maybeStack: any): maybeStack is Stack; - - /** - * Creates a new Stack containing `values`. - */ - function of(...values: T[]): Stack; - } - - /** - * Create a new immutable Stack containing the values of the provided - * iterable-like. - * - * The iteration order of the provided iterable is preserved in the - * resulting `Stack`. - */ - export function Stack(): Stack; - export function Stack(): Stack; - export function Stack(iterable: ESIterable): Stack; - - export interface Stack extends Collection.Indexed { - - // Reading values - - /** - * Alias for `Stack.first()`. - */ - peek(): T | undefined; - - - // Persistent changes - - /** - * Returns a new Stack with 0 size and no values. - */ - clear(): Stack; - - /** - * Returns a new Stack with the provided `values` prepended, shifting other - * values ahead to higher indices. - * - * This is very efficient for Stack. - */ - unshift(...values: T[]): Stack; - - /** - * Like `Stack#unshift`, but accepts a iterable rather than varargs. - */ - unshiftAll(iter: Iterable): Stack; - unshiftAll(iter: Array): Stack; - - /** - * Returns a new Stack with a size ones less than this Stack, excluding - * the first item in this Stack, shifting all other values to a lower index. - * - * Note: this differs from `Array#shift` because it returns a new - * Stack rather than the removed value. Use `first()` or `peek()` to get the - * first value in this Stack. - */ - shift(): Stack; - - /** - * Alias for `Stack#unshift` and is not equivalent to `List#push`. - */ - push(...values: T[]): Stack; - - /** - * Alias for `Stack#unshiftAll`. - */ - pushAll(iter: Iterable): Stack; - pushAll(iter: Array): Stack; - - /** - * Alias for `Stack#shift` and is not equivalent to `List#pop`. - */ - pop(): Stack; - - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set`, `push`, and `pop` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: Stack) => any): Stack; - - /** - * @see `Map#asMutable` - */ - asMutable(): Stack; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): Stack; - - // Sequence algorithms - - /** - * Returns a new Stack with values passed through a - * `mapper` function. - * - * Stack([1,2]).map(x => 10 * x) - * // Stack [10,20] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Stack; - } - - - /** - * Returns a Seq.Indexed of numbers from `start` (inclusive) to `end` - * (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to - * infinity. When `start` is equal to `end`, returns empty range. - * - * Range() // [0,1,2,3,...] - * Range(10) // [10,11,12,13,...] - * Range(10,15) // [10,11,12,13,14] - * Range(10,30,5) // [10,15,20,25] - * Range(30,10,5) // [30,25,20,15] - * Range(30,30,5) // [] - * - */ - export function Range(start?: number, end?: number, step?: number): Seq.Indexed; - - - /** - * Returns a Seq.Indexed of `value` repeated `times` times. When `times` is - * not defined, returns an infinite `Seq` of `value`. - * - * Repeat('foo') // ['foo','foo','foo',...] - * Repeat('bar',4) // ['bar','bar','bar','bar'] - * - */ - export function Repeat(value: T, times?: number): Seq.Indexed; - - - /** - * Creates a new Class which produces Record instances. A record is similar to - * a JS object, but enforce a specific set of allowed string keys, and have - * default values. - * - * var ABRecord = Record({a:1, b:2}) - * var myRecord = new ABRecord({b:3}) - * - * Records always have a value for the keys they define. `remove`ing a key - * from a record simply resets it to the default value for that key. - * - * myRecord.size // 2 - * myRecord.get('a') // 1 - * myRecord.get('b') // 3 - * myRecordWithoutB = myRecord.remove('b') - * myRecordWithoutB.get('b') // 2 - * myRecordWithoutB.size // 2 - * - * Values provided to the constructor not found in the Record type will - * be ignored. For example, in this case, ABRecord is provided a key "x" even - * though only "a" and "b" have been defined. The value for "x" will be - * ignored for this record. - * - * var myRecord = new ABRecord({b:3, x:10}) - * myRecord.get('x') // undefined - * - * Because Records have a known set of string keys, property get access works - * as expected, however property sets will throw an Error. - * - * Note: IE8 does not support property access. Only use `get()` when - * supporting IE8. - * - * myRecord.b // 3 - * myRecord.b = 5 // throws Error - * - * Record Classes can be extended as well, allowing for custom methods on your - * Record. This is not a common pattern in functional environments, but is in - * many JS programs. - * - * class ABRecord extends Record({a:1,b:2}) { - * getAB() { - * return this.a + this.b; - * } - * } - * - * var myRecord = new ABRecord({b: 3}) - * myRecord.getAB() // 4 - * - */ - export module Record { - - /** - * Records allow passing a second parameter to supply a descriptive name - * that appears when converting a Record to a string or in any error - * messages. A descriptive name for any record can be accessed by using this - * method. If one was not provided, the string "Record" is returned. - * - * ```js - * var Person = Record({ - * name: null - * }, 'Person') - * - * var me = Person({ name: 'My Name' }) - * me.toString() // "Person { "name": "My Name" }" - * Record.getDescriptiveName(me) // "Person" - * ``` - */ - export function getDescriptiveName(record: Instance): string; - - export interface Class { - (values?: Partial | ESIterable<[string, any]>): Instance & Readonly; - new (values?: Partial | ESIterable<[string, any]>): Instance & Readonly; - } - - export interface Instance { - size: number; - - // Reading values - - has(key: string): boolean; - get(key: K): T[K]; - - // Value equality - - equals(other: any): boolean; - hashCode(): number; - - // Persistent changes - - set(key: K, value: T[K]): this; - update(key: K, updater: (value: T[K]) => T[K]): this; - merge(...iterables: Array | ESIterable<[string, any]>>): this; - mergeDeep(...iterables: Array | ESIterable<[string, any]>>): this; - - /** - * @alias remove - */ - delete(key: K): this; - remove(key: K): this; - clear(): this; - - // Deep persistent changes - - setIn(keyPath: Array | Iterable, value: any): this; - updateIn(keyPath: Array | Iterable, updater: (value: any) => any): this; - mergeIn(keyPath: Array | Iterable, ...iterables: Array): this; - mergeDeepIn(keyPath: Array | Iterable, ...iterables: Array): this; - - /** - * @alias removeIn - */ - deleteIn(keyPath: Array | Iterable): this; - removeIn(keyPath: Array | Iterable): this; - - // Conversion to JavaScript types - - /** - * Deeply converts this Record to equivalent JS. - * - * @alias toJSON - */ - toJS(): any; - - /** - * Shallowly converts this Record to equivalent JS. - */ - toObject(): T; - - // Transient changes - - /** - * Note: Not all methods can be used on a mutable collection or within - * `withMutations`! Only `set` may be used mutatively. - * - * @see `Map#withMutations` - */ - withMutations(mutator: (mutable: this) => any): this; - - /** - * @see `Map#asMutable` - */ - asMutable(): this; - - /** - * @see `Map#asImmutable` - */ - asImmutable(): this; - - // Sequence algorithms - - [Symbol.iterator](): Iterator<[keyof T, T[keyof T]]>; - } - } - - export function Record(defaultValues: T, name?: string): Record.Class; - - - /** - * Represents a sequence of values, but may not be backed by a concrete data - * structure. - * - * **Seq is immutable** — Once a Seq is created, it cannot be - * changed, appended to, rearranged or otherwise modified. Instead, any - * mutative method called on a `Seq` will return a new `Seq`. - * - * **Seq is lazy** — Seq does as little work as necessary to respond to any - * method call. Values are often created during iteration, including implicit - * iteration when reducing or converting to a concrete data structure such as - * a `List` or JavaScript `Array`. - * - * For example, the following performs no work, because the resulting - * Seq's values are never iterated: - * - * var oddSquares = Immutable.Seq.of(1,2,3,4,5,6,7,8) - * .filter(x => x % 2).map(x => x * x); - * - * Once the Seq is used, it performs only the work necessary. In this - * example, no intermediate data structures are ever created, filter is only - * called three times, and map is only called once: - * - * console.log(oddSquares.get(1)); // 9 - * - * Seq allows for the efficient chaining of operations, - * allowing for the expression of logic that can otherwise be very tedious: - * - * Immutable.Seq({a:1, b:1, c:1}) - * .flip().map(key => key.toUpperCase()).flip().toObject(); - * // Map { A: 1, B: 1, C: 1 } - * - * As well as expressing logic that would otherwise be memory or time limited: - * - * Immutable.Range(1, Infinity) - * .skip(1000) - * .map(n => -n) - * .filter(n => n % 2 === 0) - * .take(2) - * .reduce((r, n) => r * n, 1); - * // 1006008 - * - * Seq is often used to provide a rich collection API to JavaScript Object. - * - * Immutable.Seq({ x: 0, y: 1, z: 2 }).map(v => v * 2).toObject(); - * // { x: 0, y: 2, z: 4 } - */ - - export module Seq { - /** - * True if `maybeSeq` is a Seq, it is not backed by a concrete - * structure such as Map, List, or Set. - */ - function isSeq(maybeSeq: any): maybeSeq is Seq.Indexed | Seq.Keyed; - - /** - * Returns a Seq of the values provided. Alias for `Seq.Indexed.of()`. - */ - function of(...values: T[]): Seq.Indexed; - - - /** - * `Seq` which represents key-value pairs. - */ - export module Keyed {} - - /** - * Always returns a Seq.Keyed, if input is not keyed, expects an - * iterable of [K, V] tuples. - */ - export function Keyed(): Seq.Keyed; - export function Keyed(): Seq.Keyed; - export function Keyed(iterable: ESIterable<[K, V]>): Seq.Keyed; - export function Keyed(obj: {[key: string]: V}): Seq.Keyed; - - export interface Keyed extends Seq, Iterable.Keyed { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Keyed with values passed through a - * `mapper` function. - * - * Indexed([1, 2]).map(x => 10 * x) - * // Indexed [10, 20] - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Seq.Keyed; - - /** - * @see Iterable.Keyed.mapKeys - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Seq.Keyed; - - /** - * @see Iterable.Keyed.mapEntries - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Seq.Keyed; - } - - - /** - * `Seq` which represents an ordered indexed list of values. - */ - module Indexed { - - /** - * Provides an Seq.Indexed of the values provided. - */ - function of(...values: T[]): Seq.Indexed; - } - - /** - * Always returns Seq.Indexed, discarding associated keys and - * supplying incrementing indices. - */ - export function Indexed(): Seq.Indexed; - export function Indexed(): Seq.Indexed; - export function Indexed(iterable: ESIterable): Seq.Indexed; - - export interface Indexed extends Seq, Iterable.Indexed { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Indexed with values passed through a - * `mapper` function. - * - * Seq.Indexed({a: 1, b: 2}).map(x => 10 * x) - * // Seq.Indexed {a: 10, b: 20} - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Seq.Indexed; - } - - - /** - * `Seq` which represents a set of values. - * - * Because `Seq` are often lazy, `Seq.Set` does not provide the same guarantee - * of value uniqueness as the concrete `Set`. - */ - export module Set { - - /** - * Returns a Seq.Set of the provided values - */ - function of(...values: T[]): Seq.Set; - } - - /** - * Always returns a Seq.Set, discarding associated indices or keys. - */ - export function Set(): Seq.Set; - export function Set(): Seq.Set; - export function Set(iterable: ESIterable): Seq.Set; - - export interface Set extends Seq, Iterable.Set { - - /** - * Returns itself - */ - toSeq(): this - - /** - * Returns a new Seq.Set with values passed through a - * `mapper` function. - * - * Seq.Set([1, 2]).map(x => 10 * x) - * // Seq.Set [10, 20] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Seq.Set; - } - - } - - /** - * Creates a Seq. - * - * Returns a particular kind of `Seq` based on the input. - * - * * If a `Seq`, that same `Seq`. - * * If an `Iterable`, a `Seq` of the same kind (Keyed, Indexed, or Set). - * * If an Array-like, an `Seq.Indexed`. - * * If an Object with an Iterator, an `Seq.Indexed`. - * * If an Iterator, an `Seq.Indexed`. - * * If an Object, a `Seq.Keyed`. - * - */ - export function Seq(): Seq; - export function Seq(): Seq; - export function Seq>(seq: S): S; - export function Seq(iterable: Iterable.Keyed): Seq.Keyed; - export function Seq(iterable: Iterable.Indexed): Seq.Indexed; - export function Seq(iterable: Iterable.Set): Seq.Set; - export function Seq(iterable: ESIterable): Seq.Indexed; - export function Seq(obj: {[key: string]: V}): Seq.Keyed; - - export interface Seq extends Iterable { - - /** - * Some Seqs can describe their size lazily. When this is the case, - * size will be an integer. Otherwise it will be undefined. - * - * For example, Seqs returned from `map()` or `reverse()` - * preserve the size of the original `Seq` while `filter()` does not. - * - * Note: `Range`, `Repeat` and `Seq`s made from `Array`s and `Object`s will - * always have a size. - */ - size: number/*?*/; - - - // Force evaluation - - /** - * Because Sequences are lazy and designed to be chained together, they do - * not cache their results. For example, this map function is called a total - * of 6 times, as each `join` iterates the Seq of three values. - * - * var squares = Seq.of(1,2,3).map(x => x * x); - * squares.join() + squares.join(); - * - * If you know a `Seq` will be used multiple times, it may be more - * efficient to first cache it in memory. Here, the map function is called - * only 3 times. - * - * var squares = Seq.of(1,2,3).map(x => x * x).cacheResult(); - * squares.join() + squares.join(); - * - * Use this method judiciously, as it must fully evaluate a Seq which can be - * a burden on memory and possibly performance. - * - * Note: after calling `cacheResult`, a Seq will always have a `size`. - */ - cacheResult(): this; - - // Sequence algorithms - - /** - * Returns a new Seq with values passed through a - * `mapper` function. - * - * Seq({a: 1, b: 2}).map(x => 10 * x) - * // Set {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Seq; - } - - /** - * The `Iterable` is a set of (key, value) entries which can be iterated, and - * is the base class for all collections in `immutable`, allowing them to - * make use of all the Iterable methods (such as `map` and `filter`). - * - * Note: An iterable is always iterated in the same order, however that order - * may not always be well defined, as is the case for the `Map` and `Set`. - */ - export module Iterable { - /** - * True if `maybeIterable` is an Iterable, or any of its subclasses. - * - * ```js - * Iterable.isIterable([]); // false - * Iterable.isIterable({}); // false - * Iterable.isIterable(Immutable.Map()); // true - * Iterable.isIterable(Immutable.List()); // true - * Iterable.isIterable(Immutable.Stack()); // true - * ``` - */ - function isIterable(maybeIterable: any): maybeIterable is Iterable; - - /** - * True if `maybeKeyed` is an Iterable.Keyed, or any of its subclasses. - */ - function isKeyed(maybeKeyed: any): maybeKeyed is Iterable.Keyed; - - /** - * True if `maybeIndexed` is a Iterable.Indexed, or any of its subclasses. - */ - function isIndexed(maybeIndexed: any): maybeIndexed is Iterable.Indexed; - - /** - * True if `maybeAssociative` is either a keyed or indexed Iterable. - */ - function isAssociative(maybeAssociative: any): maybeAssociative is Iterable.Keyed | Iterable.Indexed; - - /** - * True if `maybeOrdered` is an Iterable where iteration order is well - * defined. True for Iterable.Indexed as well as OrderedMap and OrderedSet. - */ - function isOrdered(maybeOrdered: any): boolean; - - - /** - * Keyed Iterables have discrete keys tied to each value. - * - * When iterating `Iterable.Keyed`, each iteration will yield a `[K, V]` - * tuple, in other words, `Iterable#entries` is the default iterator for - * Keyed Iterables. - */ - export module Keyed {} - - /** - * Creates an Iterable.Keyed - * - * Similar to `Iterable()`, however it expects iterable-likes of [K, V] - * tuples if not constructed from a Iterable.Keyed or JS Object. - */ - export function Keyed(iterable: ESIterable<[K, V]>): Iterable.Keyed; - export function Keyed(obj: {[key: string]: V}): Iterable.Keyed; - - export interface Keyed extends Iterable { - - /** - * Returns Seq.Keyed. - * @override - */ - toSeq(): Seq.Keyed; - - - // Sequence functions - - /** - * Returns a new Iterable.Keyed of the same type where the keys and values - * have been flipped. - * - * Seq({ a: 'z', b: 'y' }).flip() // { z: 'a', y: 'b' } - * - */ - flip(): this; - - /** - * Returns a new Iterable.Keyed with values passed through a - * `mapper` function. - * - * Iterable.Keyed({a: 1, b: 2}).map(x => 10 * x) - * // Iterable.Keyed {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Iterable.Keyed; - - /** - * Returns a new Iterable.Keyed of the same type with keys passed through - * a `mapper` function. - * - * Seq({ a: 1, b: 2 }) - * .mapKeys(x => x.toUpperCase()) - * // Seq { A: 1, B: 2 } - * - */ - mapKeys( - mapper: (key: K, value: V, iter: this) => M, - context?: any - ): Iterable.Keyed; - - /** - * Returns a new Iterable.Keyed of the same type with entries - * ([key, value] tuples) passed through a `mapper` function. - * - * Seq({ a: 1, b: 2 }) - * .mapEntries(([k, v]) => [k.toUpperCase(), v * 2]) - * // Seq { A: 2, B: 4 } - * - */ - mapEntries( - mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], - context?: any - ): Iterable.Keyed; - - [Symbol.iterator](): Iterator<[K, V]>; - } - - - /** - * Indexed Iterables have incrementing numeric keys. They exhibit - * slightly different behavior than `Iterable.Keyed` for some methods in order - * to better mirror the behavior of JavaScript's `Array`, and add methods - * which do not make sense on non-indexed Iterables such as `indexOf`. - * - * Unlike JavaScript arrays, `Iterable.Indexed`s are always dense. "Unset" - * indices and `undefined` indices are indistinguishable, and all indices from - * 0 to `size` are visited when iterated. - * - * All Iterable.Indexed methods return re-indexed Iterables. In other words, - * indices always start at 0 and increment until size. If you wish to - * preserve indices, using them as keys, convert to a Iterable.Keyed by - * calling `toKeyedSeq`. - */ - export module Indexed {} - - /** - * Creates a new Iterable.Indexed. - */ - export function Indexed(iterable: ESIterable): Iterable.Indexed; - - export interface Indexed extends Iterable { - - // Reading values - - /** - * Returns the value associated with the provided index, or notSetValue if - * the index is beyond the bounds of the Iterable. - * - * `index` may be a negative number, which indexes back from the end of the - * Iterable. `s.get(-1)` gets the last item in the Iterable. - */ - get(index: number, notSetValue?: T): T | undefined; - - - // Conversion to Seq - - /** - * Returns Seq.Indexed. - * @override - */ - toSeq(): Seq.Indexed; - - /** - * If this is an iterable of [key, value] entry tuples, it will return a - * Seq.Keyed of those entries. - */ - fromEntrySeq(): Seq.Keyed; - - - // Combination - - /** - * Returns an Iterable of the same type with `separator` between each item - * in this Iterable. - */ - interpose(separator: T): this; - - /** - * Returns an Iterable of the same type with the provided `iterables` - * interleaved into this iterable. - * - * The resulting Iterable includes the first item from each, then the - * second from each, etc. - * - * I.Seq.of(1,2,3).interleave(I.Seq.of('A','B','C')) - * // Seq [ 1, 'A', 2, 'B', 3, 'C' ] - * - * The shortest Iterable stops interleave. - * - * I.Seq.of(1,2,3).interleave( - * I.Seq.of('A','B'), - * I.Seq.of('X','Y','Z') - * ) - * // Seq [ 1, 'A', 'X', 2, 'B', 'Y' ] - */ - interleave(...iterables: Array>): this; - - /** - * Splice returns a new indexed Iterable by replacing a region of this - * Iterable with new values. If values are not provided, it only skips the - * region to be removed. - * - * `index` may be a negative number, which indexes back from the end of the - * Iterable. `s.splice(-2)` splices after the second to last item. - * - * Seq(['a','b','c','d']).splice(1, 2, 'q', 'r', 's') - * // Seq ['a', 'q', 'r', 's', 'd'] - * - */ - splice( - index: number, - removeNum: number, - ...values: T[] - ): this; - - /** - * Returns an Iterable of the same type "zipped" with the provided - * iterables. - * - * Like `zipWith`, but using the default `zipper`: creating an `Array`. - * - * var a = Seq.of(1, 2, 3); - * var b = Seq.of(4, 5, 6); - * var c = a.zip(b); // Seq [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] - * - */ - zip(...iterables: Array>): Iterable.Indexed; - - /** - * Returns an Iterable of the same type "zipped" with the provided - * iterables by using a custom `zipper` function. - * - * var a = Seq.of(1, 2, 3); - * var b = Seq.of(4, 5, 6); - * var c = a.zipWith((a, b) => a + b, b); // Seq [ 5, 7, 9 ] - * - */ - zipWith( - zipper: (value: T, otherValue: U) => Z, - otherIterable: Iterable - ): Iterable.Indexed; - zipWith( - zipper: (value: T, otherValue: U, thirdValue: V) => Z, - otherIterable: Iterable, - thirdIterable: Iterable - ): Iterable.Indexed; - zipWith( - zipper: (...any: Array) => Z, - ...iterables: Array> - ): Iterable.Indexed; - - - // Search for value - - /** - * Returns the first index at which a given value can be found in the - * Iterable, or -1 if it is not present. - */ - indexOf(searchValue: T): number; - - /** - * Returns the last index at which a given value can be found in the - * Iterable, or -1 if it is not present. - */ - lastIndexOf(searchValue: T): number; - - /** - * Returns the first index in the Iterable where a value satisfies the - * provided predicate function. Otherwise -1 is returned. - */ - findIndex( - predicate: (value: T, index: number, iter: this) => boolean, - context?: any - ): number; - - /** - * Returns the last index in the Iterable where a value satisfies the - * provided predicate function. Otherwise -1 is returned. - */ - findLastIndex( - predicate: (value: T, index: number, iter: this) => boolean, - context?: any - ): number; - - // Sequence algorithms - - /** - * Returns a new Iterable.Indexed with values passed through a - * `mapper` function. - * - * Iterable.Indexed([1,2]).map(x => 10 * x) - * // Iterable.Indexed [1,2] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Iterable.Indexed; - - [Symbol.iterator](): Iterator; - } - - - /** - * Set Iterables only represent values. They have no associated keys or - * indices. Duplicate values are possible in Seq.Sets, however the - * concrete `Set` does not allow duplicate values. - * - * Iterable methods on Iterable.Set such as `map` and `forEach` will provide - * the value as both the first and second arguments to the provided function. - * - * var seq = Seq.Set.of('A', 'B', 'C'); - * assert.equal(seq.every((v, k) => v === k), true); - * - */ - export module Set {} - - /** - * Similar to `Iterable()`, but always returns a Iterable.Set. - */ - export function Set(iterable: ESIterable): Iterable.Set; - - export interface Set extends Iterable { - - /** - * Returns Seq.Set. - * @override - */ - toSeq(): Seq.Set; - - // Sequence algorithms - - /** - * Returns a new Iterable.Set with values passed through a - * `mapper` function. - * - * Iterable.Set([1,2]).map(x => 10 * x) - * // Iterable.Set [1,2] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Iterable.Set; - - [Symbol.iterator](): Iterator; - } - - } - - /** - * Creates an Iterable. - * - * The type of Iterable created is based on the input. - * - * * If an `Iterable`, that same `Iterable`. - * * If an Array-like, an `Iterable.Indexed`. - * * If an Object with an Iterator, an `Iterable.Indexed`. - * * If an Iterator, an `Iterable.Indexed`. - * * If an Object, an `Iterable.Keyed`. - * - * This methods forces the conversion of Objects and Strings to Iterables. - * If you want to ensure that a Iterable of one item is returned, use - * `Seq.of`. - */ - export function Iterable>(iterable: I): I; - export function Iterable(iterable: ESIterable): Iterable.Indexed; - export function Iterable(obj: {[key: string]: V}): Iterable.Keyed; - - export interface Iterable { - - // Value equality - - /** - * True if this and the other Iterable have value equality, as defined - * by `Immutable.is()`. - * - * Note: This is equivalent to `Immutable.is(this, other)`, but provided to - * allow for chained expressions. - */ - equals(other: any): boolean; - - /** - * Computes and returns the hashed identity for this Iterable. - * - * The `hashCode` of an Iterable is used to determine potential equality, - * and is used when adding this to a `Set` or as a key in a `Map`, enabling - * lookup via a different instance. - * - * var a = List.of(1, 2, 3); - * var b = List.of(1, 2, 3); - * assert(a !== b); // different instances - * var set = Set.of(a); - * assert(set.has(b) === true); - * - * If two values have the same `hashCode`, they are [not guaranteed - * to be equal][Hash Collision]. If two values have different `hashCode`s, - * they must not be equal. - * - * [Hash Collision]: http://en.wikipedia.org/wiki/Collision_(computer_science) - */ - hashCode(): number; - - - // Reading values - - /** - * Returns the value associated with the provided key, or notSetValue if - * the Iterable does not contain this key. - * - * Note: it is possible a key may be associated with an `undefined` value, - * so if `notSetValue` is not provided and this method returns `undefined`, - * that does not guarantee the key was not found. - */ - get(key: K, notSetValue?: V): V | undefined; - - /** - * True if a key exists within this `Iterable`, using `Immutable.is` to determine equality - */ - has(key: K): boolean; - - /** - * True if a value exists within this `Iterable`, using `Immutable.is` to determine equality - * @alias contains - */ - includes(value: V): boolean; - contains(value: V): boolean; - - /** - * The first value in the Iterable. - */ - first(): V | undefined; - - /** - * The last value in the Iterable. - */ - last(): V | undefined; - - - // Reading deep values - - /** - * Returns the value found by following a path of keys or indices through - * nested Iterables. - */ - getIn(searchKeyPath: Array, notSetValue?: any): any; - getIn(searchKeyPath: Iterable, notSetValue?: any): any; - - /** - * True if the result of following a path of keys or indices through nested - * Iterables results in a set value. - */ - hasIn(searchKeyPath: Array): boolean; - hasIn(searchKeyPath: Iterable): boolean; - - - // Conversion to JavaScript types - - /** - * Deeply converts this Iterable to equivalent JS. - * - * `Iterable.Indexeds`, and `Iterable.Sets` become Arrays, while - * `Iterable.Keyeds` become Objects. - * - * @alias toJSON - */ - toJS(): any; - - /** - * Shallowly converts this iterable to an Array, discarding keys. - */ - toArray(): Array; - - /** - * Shallowly converts this Iterable to an Object. - * - * Throws if keys are not strings. - */ - toObject(): { [key: string]: V }; - - - // Conversion to Collections - - /** - * Converts this Iterable to a Map, Throws if keys are not hashable. - * - * Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided - * for convenience and to allow for chained expressions. - */ - toMap(): Map; - - /** - * Converts this Iterable to a Map, maintaining the order of iteration. - * - * Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but - * provided for convenience and to allow for chained expressions. - */ - toOrderedMap(): OrderedMap; - - /** - * Converts this Iterable to a Set, discarding keys. Throws if values - * are not hashable. - * - * Note: This is equivalent to `Set(this)`, but provided to allow for - * chained expressions. - */ - toSet(): Set; - - /** - * Converts this Iterable to a Set, maintaining the order of iteration and - * discarding keys. - * - * Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided - * for convenience and to allow for chained expressions. - */ - toOrderedSet(): OrderedSet; - - /** - * Converts this Iterable to a List, discarding keys. - * - * Note: This is equivalent to `List(this)`, but provided to allow - * for chained expressions. - */ - toList(): List; - - /** - * Converts this Iterable to a Stack, discarding keys. Throws if values - * are not hashable. - * - * Note: This is equivalent to `Stack(this)`, but provided to allow for - * chained expressions. - */ - toStack(): Stack; - - - // Conversion to Seq - - /** - * Converts this Iterable to a Seq of the same kind (indexed, - * keyed, or set). - */ - toSeq(): Seq; - - /** - * Returns a Seq.Keyed from this Iterable where indices are treated as keys. - * - * This is useful if you want to operate on an - * Iterable.Indexed and preserve the [index, value] pairs. - * - * The returned Seq will have identical iteration order as - * this Iterable. - * - * Example: - * - * var indexedSeq = Immutable.Seq.of('A', 'B', 'C'); - * indexedSeq.filter(v => v === 'B').toString() // Seq [ 'B' ] - * var keyedSeq = indexedSeq.toKeyedSeq(); - * keyedSeq.filter(v => v === 'B').toString() // Seq { 1: 'B' } - * - */ - toKeyedSeq(): Seq.Keyed; - - /** - * Returns an Seq.Indexed of the values of this Iterable, discarding keys. - */ - toIndexedSeq(): Seq.Indexed; - - /** - * Returns a Seq.Set of the values of this Iterable, discarding keys. - */ - toSetSeq(): Seq.Set; - - - // Iterators - - /** - * An iterator of this `Iterable`'s keys. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `keySeq` instead, if this is what you want. - */ - keys(): Iterator; - - /** - * An iterator of this `Iterable`'s values. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `valueSeq` instead, if this is what you want. - */ - values(): Iterator; - - /** - * An iterator of this `Iterable`'s entries as `[key, value]` tuples. - * - * Note: this will return an ES6 iterator which does not support Immutable JS sequence algorithms. Use `entrySeq` instead, if this is what you want. - */ - entries(): Iterator<[K, V]>; - - - // Iterables (Seq) - - /** - * Returns a new Seq.Indexed of the keys of this Iterable, - * discarding values. - */ - keySeq(): Seq.Indexed; - - /** - * Returns an Seq.Indexed of the values of this Iterable, discarding keys. - */ - valueSeq(): Seq.Indexed; - - /** - * Returns a new Seq.Indexed of [key, value] tuples. - */ - entrySeq(): Seq.Indexed<[K, V]>; - - - // Sequence algorithms - - /** - * Returns a new Iterable of the same type with values passed through a - * `mapper` function. - * - * Seq({ a: 1, b: 2 }).map(x => 10 * x) - * // Seq { a: 10, b: 20 } - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Iterable; - - /** - * Returns a new Iterable of the same type with only the entries for which - * the `predicate` function returns true. - * - * Seq({a:1,b:2,c:3,d:4}).filter(x => x % 2 === 0) - * // Seq { b: 2, d: 4 } - * - */ - filter( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type with only the entries for which - * the `predicate` function returns false. - * - * Seq({a:1,b:2,c:3,d:4}).filterNot(x => x % 2 === 0) - * // Seq { a: 1, c: 3 } - * - */ - filterNot( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type in reverse order. - */ - reverse(): this; - - /** - * Returns a new Iterable of the same type which includes the same entries, - * stably sorted by using a `comparator`. - * - * If a `comparator` is not provided, a default comparator uses `<` and `>`. - * - * `comparator(valueA, valueB)`: - * - * * Returns `0` if the elements should not be swapped. - * * Returns `-1` (or any negative number) if `valueA` comes before `valueB` - * * Returns `1` (or any positive number) if `valueA` comes after `valueB` - * * Is pure, i.e. it must always return the same value for the same pair - * of values. - * - * When sorting collections which have no defined order, their ordered - * equivalents will be returned. e.g. `map.sort()` returns OrderedMap. - * - * ```js - * Seq({c: 3, a: 1, b: 2}).sort((a, b) => { - * if (a < b) { return -1; } - * if (a > b) { return 1; } - * if (a === b) { return 0; } - * }).toJS(); - * // { a: 1, b: 2, c: 3 } - * ``` - */ - sort(comparator?: (valueA: V, valueB: V) => number): this; - - /** - * Like `sort`, but also accepts a `comparatorValueMapper` which allows for - * sorting by more sophisticated means: - * - * hitters.sortBy(hitter => hitter.avgHits); - * - */ - sortBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): this; - - /** - * Returns a `Iterable.Keyed` of `Iterable.Keyeds`, grouped by the return - * value of the `grouper` function. - * - * Note: This is always an eager operation. - * - * Immutable.fromJS([{v: 0}, {v: 1}, {v: 1}, {v: 0}, {v: 1}]) - * .groupBy(x => x.get('v')) - * // Map {0: [{v: 0},{v: 0}], 1: [{v: 1},{v: 1},{v: 1}]} - */ - groupBy( - grouper: (value: V, key: K, iter: this) => G, - context?: any - ): /*Map*/Seq.Keyed>; - - - // Side effects - - /** - * The `sideEffect` is executed for every entry in the Iterable. - * - * Unlike `Array#forEach`, if any call of `sideEffect` returns - * `false`, the iteration will stop. Returns the number of entries iterated - * (including the last iteration which returned false). - */ - forEach( - sideEffect: (value: V, key: K, iter: this) => any, - context?: any - ): number; - - - // Creating subsets - - /** - * Returns a new Iterable of the same type representing a portion of this - * Iterable from start up to but not including end. - * - * If begin is negative, it is offset from the end of the Iterable. e.g. - * `slice(-2)` returns a Iterable of the last two entries. If it is not - * provided the new Iterable will begin at the beginning of this Iterable. - * - * If end is negative, it is offset from the end of the Iterable. e.g. - * `slice(0, -1)` returns an Iterable of everything but the last entry. If - * it is not provided, the new Iterable will continue through the end of - * this Iterable. - * - * If the requested slice is equivalent to the current Iterable, then it - * will return itself. - */ - slice(begin?: number, end?: number): this; - - /** - * Returns a new Iterable of the same type containing all entries except - * the first. - */ - rest(): this; - - /** - * Returns a new Iterable of the same type containing all entries except - * the last. - */ - butLast(): this; - - /** - * Returns a new Iterable of the same type which excludes the first `amount` - * entries from this Iterable. - */ - skip(amount: number): this; - - /** - * Returns a new Iterable of the same type which excludes the last `amount` - * entries from this Iterable. - */ - skipLast(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes entries starting - * from when `predicate` first returns false. - * - * Seq.of('dog','frog','cat','hat','god') - * .skipWhile(x => x.match(/g/)) - * // Seq [ 'cat', 'hat', 'god' ] - * - */ - skipWhile( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes entries starting - * from when `predicate` first returns true. - * - * Seq.of('dog','frog','cat','hat','god') - * .skipUntil(x => x.match(/hat/)) - * // Seq [ 'hat', 'god' ] - * - */ - skipUntil( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes the first `amount` - * entries from this Iterable. - */ - take(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes the last `amount` - * entries from this Iterable. - */ - takeLast(amount: number): this; - - /** - * Returns a new Iterable of the same type which includes entries from this - * Iterable as long as the `predicate` returns true. - * - * Seq.of('dog','frog','cat','hat','god') - * .takeWhile(x => x.match(/o/)) - * // Seq [ 'dog', 'frog' ] - * - */ - takeWhile( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - /** - * Returns a new Iterable of the same type which includes entries from this - * Iterable as long as the `predicate` returns false. - * - * Seq.of('dog','frog','cat','hat','god').takeUntil(x => x.match(/at/)) - * // ['dog', 'frog'] - * - */ - takeUntil( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): this; - - - // Combination - - /** - * Returns a new Iterable of the same type with other values and - * iterable-like concatenated to this one. - * - * For Seqs, all entries will be present in - * the resulting iterable, even if they have the same key. - */ - concat(...valuesOrIterables: any[]): Iterable; - - /** - * Flattens nested Iterables. - * - * Will deeply flatten the Iterable by default, returning an Iterable of the - * same type, but a `depth` can be provided in the form of a number or - * boolean (where true means to shallowly flatten one level). A depth of 0 - * (or shallow: false) will deeply flatten. - * - * Flattens only others Iterable, not Arrays or Objects. - * - * Note: `flatten(true)` operates on Iterable> and - * returns Iterable - */ - flatten(depth?: number): Iterable; - flatten(shallow?: boolean): Iterable; - - /** - * Flat-maps the Iterable, returning an Iterable of the same type. - * - * Similar to `iter.map(...).flatten(true)`. - */ - flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable, - context?: any - ): Iterable; - - // Reducing a value - - /** - * Reduces the Iterable to a value by calling the `reducer` for every entry - * in the Iterable and passing along the reduced value. - * - * If `initialReduction` is not provided, the first item in the - * Iterable will be used. - * - * @see `Array#reduce`. - */ - reduce( - reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: any - ): R; - - /** - * Reduces the Iterable in reverse (from the right side). - * - * Note: Similar to this.reverse().reduce(), and provided for parity - * with `Array#reduceRight`. - */ - reduceRight( - reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: any - ): R; - - /** - * True if `predicate` returns true for all entries in the Iterable. - */ - every( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): boolean; - - /** - * True if `predicate` returns true for any entry in the Iterable. - */ - some( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): boolean; - - /** - * Joins values together as a string, inserting a separator between each. - * The default separator is `","`. - */ - join(separator?: string): string; - - /** - * Returns true if this Iterable includes no values. - * - * For some lazy `Seq`, `isEmpty` might need to iterate to determine - * emptiness. At most one iteration will occur. - */ - isEmpty(): boolean; - - /** - * Returns the size of this Iterable. - * - * Regardless of if this Iterable can describe its size lazily (some Seqs - * cannot), this method will always return the correct size. E.g. it - * evaluates a lazy `Seq` if necessary. - * - * If `predicate` is provided, then this returns the count of entries in the - * Iterable for which the `predicate` returns true. - */ - count(): number; - count( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): number; - - /** - * Returns a `Seq.Keyed` of counts, grouped by the return value of - * the `grouper` function. - * - * Note: This is not a lazy operation. - */ - countBy( - grouper: (value: V, key: K, iter: this) => G, - context?: any - ): Map; - - - // Search for value - - /** - * Returns the first value for which the `predicate` returns true. - */ - find( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): V | undefined; - - /** - * Returns the last value for which the `predicate` returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLast( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): V | undefined; - - /** - * Returns the first [key, value] entry for which the `predicate` returns true. - */ - findEntry( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): [K, V] | undefined; - - /** - * Returns the last [key, value] entry for which the `predicate` - * returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLastEntry( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any, - notSetValue?: V - ): [K, V] | undefined; - - /** - * Returns the key for which the `predicate` returns true. - */ - findKey( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): K | undefined; - - /** - * Returns the last key for which the `predicate` returns true. - * - * Note: `predicate` will be called for each entry in reverse. - */ - findLastKey( - predicate: (value: V, key: K, iter: this) => boolean, - context?: any - ): K | undefined; - - /** - * Returns the key associated with the search value, or undefined. - */ - keyOf(searchValue: V): K | undefined; - - /** - * Returns the last key associated with the search value, or undefined. - */ - lastKeyOf(searchValue: V): K | undefined; - - /** - * Returns the maximum value in this collection. If any values are - * comparatively equivalent, the first one found will be returned. - * - * The `comparator` is used in the same way as `Iterable#sort`. If it is not - * provided, the default comparator is `>`. - * - * When two values are considered equivalent, the first encountered will be - * returned. Otherwise, `max` will operate independent of the order of input - * as long as the comparator is commutative. The default comparator `>` is - * commutative *only* when types do not differ. - * - * If `comparator` returns 0 and either value is NaN, undefined, or null, - * that value will be returned. - */ - max(comparator?: (valueA: V, valueB: V) => number): V | undefined; - - /** - * Like `max`, but also accepts a `comparatorValueMapper` which allows for - * comparing by more sophisticated means: - * - * hitters.maxBy(hitter => hitter.avgHits); - * - */ - maxBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): V | undefined; - - /** - * Returns the minimum value in this collection. If any values are - * comparatively equivalent, the first one found will be returned. - * - * The `comparator` is used in the same way as `Iterable#sort`. If it is not - * provided, the default comparator is `<`. - * - * When two values are considered equivalent, the first encountered will be - * returned. Otherwise, `min` will operate independent of the order of input - * as long as the comparator is commutative. The default comparator `<` is - * commutative *only* when types do not differ. - * - * If `comparator` returns 0 and either value is NaN, undefined, or null, - * that value will be returned. - */ - min(comparator?: (valueA: V, valueB: V) => number): V | undefined; - - /** - * Like `min`, but also accepts a `comparatorValueMapper` which allows for - * comparing by more sophisticated means: - * - * hitters.minBy(hitter => hitter.avgHits); - * - */ - minBy( - comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number - ): V | undefined; - - - // Comparison - - /** - * True if `iter` includes every value in this Iterable. - */ - isSubset(iter: Iterable): boolean; - isSubset(iter: Array): boolean; - - /** - * True if this Iterable includes every value in `iter`. - */ - isSuperset(iter: Iterable): boolean; - isSuperset(iter: Array): boolean; - - - /** - * Note: this is here as a convenience to work around an issue with - * TypeScript https://github.com/Microsoft/TypeScript/issues/285, but - * Iterable does not define `size`, instead `Seq` defines `size` as - * nullable number, and `Collection` defines `size` as always a number. - * - * @ignore - */ - size: number; - } - - - /** - * Collection is the abstract base class for concrete data structures. It - * cannot be constructed directly. - * - * Implementations should extend one of the subclasses, `Collection.Keyed`, - * `Collection.Indexed`, or `Collection.Set`. - */ - export module Collection { - - - /** - * `Collection` which represents key-value pairs. - */ - export module Keyed {} - - export interface Keyed extends Collection, Iterable.Keyed { - - /** - * Returns Seq.Keyed. - * @override - */ - toSeq(): Seq.Keyed; - - // Sequence algorithms - - /** - * Returns a new Collection.Keyed with values passed through a - * `mapper` function. - * - * Collection.Keyed({a: 1, b: 2}).map(x => 10 * x) - * // Collection.Keyed {a: 10, b: 20} - * - */ - map( - mapper: (value: V, key: K, iter: this) => M, - context?: any - ): Collection.Keyed; - } - - - /** - * `Collection` which represents ordered indexed values. - */ - export module Indexed {} - - export interface Indexed extends Collection, Iterable.Indexed { - - /** - * Returns Seq.Indexed. - * @override - */ - toSeq(): Seq.Indexed; - - // Sequence algorithms - - /** - * Returns a new Collection.Indexed with values passed through a - * `mapper` function. - * - * Collection.Indexed([1,2]).map(x => 10 * x) - * // Collection.Indexed [1,2] - * - */ - map( - mapper: (value: T, key: number, iter: this) => M, - context?: any - ): Collection.Indexed; - } - - - /** - * `Collection` which represents values, unassociated with keys or indices. - * - * `Collection.Set` implementations should guarantee value uniqueness. - */ - export module Set {} - - export interface Set extends Collection, Iterable.Set { - - /** - * Returns Seq.Set. - * @override - */ - toSeq(): Seq.Set; - - // Sequence algorithms - - /** - * Returns a new Collection.Set with values passed through a - * `mapper` function. - * - * Collection.Set([1,2]).map(x => 10 * x) - * // Collection.Set [1,2] - * - */ - map( - mapper: (value: T, key: T, iter: this) => M, - context?: any - ): Collection.Set; - } - - } - - export interface Collection extends Iterable { - - /** - * All collections maintain their current `size` as an integer. - */ - size: number; - } - - - /** - * ES6 Iterator. - * - * This is not part of the Immutable library, but a common interface used by - * many types in ES6 JavaScript. - * - * @ignore - */ - interface ESIterable { - [Symbol.iterator](): Iterator; - } - -} - -declare module "immutable" { - export = Immutable -} diff --git a/type-definitions/flow-tests/.flowconfig b/type-definitions/flow-tests/.flowconfig new file mode 100644 index 0000000000..8bacb74638 --- /dev/null +++ b/type-definitions/flow-tests/.flowconfig @@ -0,0 +1,9 @@ +[include] +../../ + +[options] +module.name_mapper='^immutable$' -> '../../type-definitions/immutable.js.flow' + +[ignore] +💩 Only interested in testing these files directly in this repo. +.*/node_modules/.* diff --git a/type-definitions/tests/covariance.js b/type-definitions/flow-tests/covariance.js similarity index 65% rename from type-definitions/tests/covariance.js rename to type-definitions/flow-tests/covariance.js index 3c7a8a9527..6f325f4bae 100644 --- a/type-definitions/tests/covariance.js +++ b/type-definitions/flow-tests/covariance.js @@ -1,58 +1,55 @@ -/* - * @flow - */ - -import { - List, - Map, - Set, - Stack, - OrderedMap, - OrderedSet, -} from '../../'; - -class A { x: number; } -class B extends A { y: string; } -class C { z: string; } +//@flow + +import { List, Map, Set, Stack, OrderedMap, OrderedSet } from 'immutable'; + +class A { + x: number; +} +class B extends A { + y: string; +} +class C { + z: string; +} // List covariance declare var listOfB: List; var listOfA: List = listOfB; listOfA = List([new B()]); -// $ExpectError +// $FlowExpectedError[incompatible-type-arg] var listOfC: List = listOfB; // Map covariance declare var mapOfB: Map; var mapOfA: Map = mapOfB; -mapOfA = Map({b: new B()}); -// $ExpectError +mapOfA = Map({ b: new B() }); +// $FlowExpectedError[incompatible-type-arg] var mapOfC: Map = mapOfB; // Set covariance declare var setOfB: Set; var setOfA: Set = setOfB; setOfA = Set([new B()]); -// $ExpectError +// $FlowExpectedError[incompatible-type-arg] var setOfC: Set = setOfB; // Stack covariance declare var stackOfB: Stack; var stackOfA: Stack = stackOfB; stackOfA = Stack([new B()]); -// $ExpectError +// $FlowExpectedError[incompatible-type-arg] var stackOfC: Stack = stackOfB; // OrderedMap covariance declare var orderedMapOfB: OrderedMap; var orderedMapOfA: OrderedMap = orderedMapOfB; -orderedMapOfA = OrderedMap({b: new B()}); -// $ExpectError +orderedMapOfA = OrderedMap({ b: new B() }); +// $FlowExpectedError[incompatible-type-arg] var orderedMapOfC: OrderedMap = orderedMapOfB; // OrderedSet covariance declare var orderedSetOfB: OrderedSet; var orderedSetOfA: OrderedSet = orderedSetOfB; orderedSetOfA = OrderedSet([new B()]); -// $ExpectError +// $FlowExpectedError[incompatible-type-arg] var orderedSetOfC: OrderedSet = orderedSetOfB; diff --git a/type-definitions/flow-tests/es6-collections.js b/type-definitions/flow-tests/es6-collections.js new file mode 100644 index 0000000000..a763d6bf75 --- /dev/null +++ b/type-definitions/flow-tests/es6-collections.js @@ -0,0 +1,15 @@ +// @flow + +import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable'; + +// Immutable.js collections +var mapImmutable: ImmutableMap = ImmutableMap(); +var setImmutable: ImmutableSet = ImmutableSet(); +var deleteResultImmutable: ImmutableMap = mapImmutable.delete( + 'foo' +); + +// ES6 collections +var mapES6: Map = new Map(); +var setES6: Set = new Set(); +var deleteResultES6: boolean = mapES6.delete('foo'); diff --git a/type-definitions/flow-tests/immutable-flow.js b/type-definitions/flow-tests/immutable-flow.js new file mode 100644 index 0000000000..c203962052 --- /dev/null +++ b/type-definitions/flow-tests/immutable-flow.js @@ -0,0 +1,1341 @@ +// @flow +// Some tests look like they are repeated in order to avoid false positives. +// Flow might not complain about an instance of (what it thinks is) T to be assigned to T + +import Immutable, { + List, + Map, + Stack, + Set, + Seq, + Range, + Repeat, + Record, + OrderedMap, + OrderedSet, + get, + getIn, + has, + hasIn, + merge, + mergeDeep, + mergeWith, + mergeDeepWith, + remove, + removeIn, + set, + setIn, + update, + updateIn, +} from 'immutable'; +import * as Immutable2 from 'immutable'; + +import type { + KeyedCollection, + IndexedCollection, + SetCollection, + KeyedSeq, + IndexedSeq, + SetSeq, + RecordFactory, + RecordOf, +} from 'immutable'; + +/** + * Although this looks like dead code, importing `Immutable` and + * `Immutable2` tests: + * + * 1. that default import works -- `import Immutable, {...} from 'immutable' + * 2. that importing everything works -- `import * as X from 'immutable'` + * 3. that individual imports are supported + */ +const ImmutableList = Immutable.List; +const ImmutableMap = Immutable.Map; +const ImmutableStack = Immutable.Stack; +const ImmutableSet = Immutable.Set; +const ImmutableKeyedCollection: KeyedCollection< + *, + * +> = Immutable.Collection.Keyed(); +const ImmutableRange = Immutable.Range; +const ImmutableRepeat = Immutable.Repeat; +const ImmutableIndexedSeq: IndexedSeq<*> = Immutable.Seq.Indexed(); + +const Immutable2List = Immutable2.List; +const Immutable2Map = Immutable2.Map; +const Immutable2Stack = Immutable2.Stack; +const Immutable2Set = Immutable2.Set; +const Immutable2KeyedCollection: Immutable2.KeyedCollection< + *, + * +> = Immutable2.Collection.Keyed(); +const Immutable2Range = Immutable2.Range; +const Immutable2Repeat = Immutable2.Repeat; +const Immutable2IndexedSeq: Immutable2.IndexedSeq<*> = Immutable2.Seq.Indexed(); + +var defaultExport: List<*> = Immutable.List(); +var moduleExport: List<*> = Immutable2.List(); + +var numberList: List = List(); +var numberOrStringList: List = List(); +var nullableNumberList: List = List(); +var stringToNumber: Map = Map(); +var orderedStringToNumber: OrderedMap = OrderedMap(); +var orderedStringToString: OrderedMap = OrderedMap(); +var orderedStringToNumberOrString: OrderedMap< + string, + string | number +> = OrderedMap(); +var orderedNumberToString: OrderedMap = OrderedMap(); +var orderedNumberToNumber: OrderedMap = OrderedMap(); +var stringToNumberOrString: Map = Map(); +var numberToString: Map = Map(); +var stringOrNumberToNumberOrString: Map< + string | number, + string | number +> = Map(); +var anyMap: Map = Map(); +var numberSet: Set = Set(); +var orderedStringSet: OrderedSet = OrderedSet(); +var orderedNumberSet: OrderedSet = OrderedSet(); +var orderedNumberOrStringSet: OrderedSet = OrderedSet(); +var numberOrStringSet: Set = Set(); +var stringSet: Set = Set(); +var numberStack: Stack = Stack(); +var numberOrStringStack: Stack = Stack(); +var number: number = 0; +var stringToNumberCollection: KeyedCollection = stringToNumber; +var numberToStringCollection: KeyedCollection = numberToString; +var partitions: [List, List]; + +numberList = List([1, 2]); +var numberListSize: number = numberList.size; +numberOrStringList = List(['a', 1]); +// $FlowExpectedError[incompatible-call] +numberList = List(['a', 'b']); + +numberList = List.of(1, 2); +numberOrStringList = List.of('a', 1); +// $FlowExpectedError[incompatible-call] +numberList = List.of('a', 1); + +numberList = List().set(0, 0); +numberOrStringList = List.of(0).set(1, 'a'); +// $FlowExpectedError[incompatible-call] +numberList = List().set(0, 'a'); + +numberList = List.of(1, 2, 3); +// $FlowExpectedError[incompatible-type] +var item: number = numberList.get(4); +var nullableItem: ?number = numberList.get(4); +var itemOrDefault: number = numberList.get(4, 10); + +// $FlowExpectedError[incompatible-type] +var item: number = numberList.first(); +// $FlowExpectedError[incompatible-type] +var func: () => number = () => numberList.first(); + +// $FlowExpectedError[incompatible-type] +var item: number = numberList.last(); +// $FlowExpectedError[incompatible-type] +var func: () => number = () => numberList.last(); + +numberList = List().insert(0, 0); +numberOrStringList = List.of(0).insert(1, 'a'); +// $FlowExpectedError[incompatible-call] +numberList = List().insert(0, 'a'); + +numberList = List().push(1, 1); +numberOrStringList = List().push(1, 'a'); +// $FlowExpectedError[incompatible-call] +numberList = List().push(0, 'a'); + +numberList = List().unshift(1, 1); +numberOrStringList = List().unshift(1, 'a'); +// $FlowExpectedError[incompatible-call] +numberList = List().unshift(0, 'a'); + +numberList = List.of(1).delete(0); +// $FlowExpectedError[incompatible-call] +numberList = List.of('a').delete(0); + +numberList = List.of(1).remove(0); +// $FlowExpectedError[incompatible-call] +numberList = List.of('a').remove(0); + +numberList = List.of(1).clear(); +// $FlowExpectedError[incompatible-call] +numberList = List.of('a').clear(); + +numberList = List.of(1).pop(); +// $FlowExpectedError[incompatible-call] +numberList = List.of('a').pop(); + +numberList = List.of(1).shift(); +// $FlowExpectedError[incompatible-call] +numberList = List.of('a').shift(); + +numberList = List.of('a').update((value) => List.of(1)); +// $FlowExpectedError[incompatible-call] +numberList = List.of(1).update((value) => List.of('a')); + +numberOrStringList = List.of('a').update(0, (value) => 1); +// $FlowExpectedError[incompatible-call] +numberList = List.of(1).update(0, (value) => 'a'); + +numberOrStringList = List.of(1).update(1, 0, (value) => 'a'); +// $FlowExpectedError[incompatible-call] +numberList = List.of(1).update(1, 0, (value) => 'a'); + +numberList = List.of(1).merge(List.of(2)); +numberOrStringList = List.of('a').merge(List.of(1)); +// $FlowExpectedError[incompatible-call] +numberList = List.of('a').merge(List.of(1)); + +// Functional API + +numberList = merge(List([1]), List([2])); +numberOrStringList = merge>(List(['a']), List([1])); +// $FlowExpectedError[incompatible-call] +numberList = merge(List(['a']), List([1])); + +nullableNumberList = List.of(1).setSize(2); + +// $FlowExpectedError[incompatible-type] setIn [] replaces the top-most value. number ~> List +numberList = List([1]).setIn([], 0); +{ + const x: number = List([1]).setIn([], 0); +} +// $FlowExpectedError[incompatible-call] "a" is not a valid key for List. +numberList = List([1]).setIn(['a'], 0); +// $FlowExpectedError[incompatible-type-arg] "a" is not a valid value for List of number. +numberList = List([1]).setIn([0], 'a'); +numberList = List([1]).setIn([0], 0); + +// $FlowExpectedError[incompatible-call] "a" is not a valid key for List. +List([List([List([1])])]).setIn([0, 0, 'a'], 'a'); +// $FlowExpectedError[incompatible-call] "a" is not a valid value for List of number. +List([List([List([1])])]).setIn([0, 0, 0], 'a'); +List([List([List([1])])]).setIn([0, 0, 0], 123); + +// $FlowExpectedError[incompatible-type] deleteIn [] replaces the top-most value. void ~> List +numberList = List([1]).deleteIn([]); +{ + const x: void = List([1]).deleteIn([]); +} +// $FlowExpectedError[incompatible-type] +numberList = List([1]).removeIn([]); +// $FlowExpectedError[incompatible-call] "a" is not a valid key for List. +numberList = List([1]).deleteIn(['a']); +// $FlowExpectedError[incompatible-call] +numberList = List([1]).removeIn(['a']); +numberList = List([1]).deleteIn([0]); +numberList = List([1]).removeIn([0]); + +// Functional API + +// $FlowExpectedError[incompatible-type] deleteIn [] replaces the top-most value. void ~> List +numberList = removeIn(List([1]), []); +{ + const x: void = removeIn(List([1]), []); +} +// $FlowExpectedError[incompatible-call] "a" is not a valid key for List. +numberList = removeIn(List([1]), ['a']); +numberList = removeIn(List([1]), [0]); + +// $FlowExpectedError[incompatible-type] updateIn [] replaces the top-most value. number ~> List +numberList = List([1]).updateIn([], () => 123); +{ + const x: number = List([1]).updateIn([], () => 123); +} +// $FlowExpectedError[incompatible-call] - 'a' is not a number +numberList = List([1]).updateIn([0], (val) => 'a'); +// $FlowExpectedError[incompatible-call] +numberList = List([1]).updateIn([0], 0, (val) => 'a'); +// $FlowExpectedError[incompatible-call] - 'a' in an invalid argument +numberList = List([1]).updateIn([0], 'a'); +// $FlowExpectedError[incompatible-call] +numberList = List([1]).updateIn([0], 0, 'a'); +numberList = List([1]).updateIn([0], (val) => val + 1); +numberList = List([1]).updateIn([0], 0, (val) => val + 1); + +numberList = List.of(1).mergeIn([], []); +numberList = List.of(1).mergeDeepIn([], []); + +numberList = List.of(1).withMutations((mutable) => mutable); + +numberList = List.of(1).asMutable(); +numberList = List.of(1).asImmutable(); + +numberList = List.of(1).map((value, index, iter) => 1); +// $FlowExpectedError[incompatible-call] +numberList = List.of(1).map((value, index, iter) => 'a'); + +numberList = List.of(1).flatMap((value, index, iter) => [1]); +// $FlowExpectedError[incompatible-call] +numberList = List.of(1).flatMap((value, index, iter) => ['a']); + +numberList = List.of(1).flatten(); + +// Specific type for filter(Boolean) which removes nullability. +numberList = nullableNumberList.filter(Boolean); + +partitions = List([1,2,3]).partition(value => value % 2); + +/* Map */ + +stringToNumber = Map(); +let stringToNumberSize: number = stringToNumber.size; +stringToNumberOrString = Map(); +numberToString = Map(); + +stringToNumber = Map({ a: 1 }); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 'a' }); + +stringToNumber = Map([['a', 1]]); +stringToNumber = Map(List([['a', 1]])); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map([['a', 'b']]); +// $FlowExpectedError[incompatible-call] -- this is actually a Map +stringToNumber = Map(List([['a', 'a']])); +// $FlowFixMe[incompatible-call] - This is Iterable>, ideally it could be interpreted as Iterable<[string, string]> +stringToNumber = Map(List([List(['a', 'a'])])); + +stringOrNumberToNumberOrString = Map({ a: 'a' }).set('b', 1).set(2, 'c'); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map({ a: 0 }).set('b', ''); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map().set(1, ''); + +// Functional API + +stringToNumber = set(set(Map({ a: 0 }), 'b', 1), 'c', 2); +// $FlowExpectedError[incompatible-call] - Functional API currently requires arguments to have the same value types. +stringOrNumberToNumberOrString = set(set(Map({ a: 'a' }), 'b', 1), 2, 'c'); +// $FlowExpectedError[incompatible-call] +stringToNumber = set(Map({ a: 0 }), 'b', ''); +// $FlowExpectedError[incompatible-call] +stringToNumber = set(Map(), 1, ''); + +stringToNumber = Map({ a: 0 }).delete('a'); +stringToNumber = Map({ a: 0 }).remove('a'); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 0 }).delete(1); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 0 }).remove(1); + +stringToNumber = Map({ a: 0 }).deleteAll(['a']); +stringToNumber = Map({ a: 0 }).removeAll(['a']); +// $FlowExpectedError[prop-missing] +stringToNumber = Map({ a: 0 }).deleteAll(1); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 0 }).deleteAll([1]); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 0 }).removeAll([1]); + +stringToNumber = Map({ a: 0 }).clear(); + +stringToNumber = Map({ a: 1 }).update((value) => Map({ a: 1 })); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 1 }).update((value) => Map({ '1': 'a' })); + +stringToNumberOrString = Map({ a: 1 }).update('a', (value) => 'a'); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map({ a: 1 }).update('a', (value) => 'a'); + +stringToNumberOrString = Map({ a: 1 }).update('a', 'b', (value) => 'a'); +// $FlowExpectedError[incompatible-type-arg] +// $FlowExpectedError[incompatible-call] +stringToNumber = Map({ a: 1 }).update('a', 'b', (value) => 'a'); +// $FlowExpectedError[incompatible-type-arg] +stringToNumberOrString = Map({ a: 1 }).merge({ a: { a: '1' } }); +// $FlowExpectedError[incompatible-type-arg] +stringToNumberOrString = Map({ a: 1 }).update('a', 'b', (value) => { + a: '1'; +}); + +stringToNumber = Map({ a: 1 }).merge(Map({ a: 1 })); +stringToNumberOrString = Map({ a: 1 }).merge({ a: 'b' }); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 1 }).merge({ a: 'b' }); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map({ a: 1 }).merge([[1, 'a']]); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 1 }).merge(numberToString); + +// Functional API +stringToNumber = merge(Map({ a: 1 }), Map({ a: 1 })); +// $FlowExpectedError[incompatible-call] - Functional API currently requires arguments to have the same value types. +stringToNumberOrString = merge(Map({ a: 1 }), { a: 'b' }); +// $FlowExpectedError[incompatible-call] +stringToNumber = merge(Map({ a: 1 }), { a: 'b' }); +// $FlowExpectedError[incompatible-call] +stringToNumber = merge(Map({ a: 1 }), [[1, 'a']]); +// $FlowExpectedError[incompatible-call] +stringToNumber = merge(Map({ a: 1 }), numberToString); + +stringToNumber = Map({ a: 1 }).mergeWith((previous, next, key) => 1, { + a: 2, + b: 2, +}); +stringToNumber = Map({ a: 1 }).mergeWith( + // $FlowExpectedError[incompatible-call] + (previous, next, key) => previous + next, + // $FlowExpectedError[incompatible-type-arg] + { a: '2', b: '2' } +); +stringToNumberOrString = Map({ a: 1 }).mergeWith( + (previous, next, key) => previous + next, + { a: '2', b: '2' } +); +// $FlowExpectedError[incompatible-call] - the array [1] is not a valid argument +stringToNumber = Map({ a: 1 }).mergeWith((previous, next, key) => 1, [1]); + +stringToNumberOrString = Map({ a: 1 }).mergeDeep({ a: 'b' }); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 1 }).mergeDeep({ a: 'b' }); + +stringToNumber = Map({ a: 1 }).mergeDeepWith((previous, next, key) => 1, { + a: 2, + b: 2, +}); +stringToNumber = Map({ a: 1 }).mergeDeepWith( + (previous, next, key) => 1, + // $FlowExpectedError[incompatible-type-arg] + { a: '2', b: '2' } +); +stringToNumberOrString = Map({ a: 1 }).mergeDeepWith( + (previous, next, key) => 1, + { a: '2', b: '2' } +); +// $FlowExpectedError[incompatible-call] - the array [1] is not a valid argument +stringToNumber = Map({ a: 1 }).mergeDeepWith((previous, next, key) => 1, [1]); + +// KeyedSeq can merge into Map +var stringToStringSeq: KeyedSeq = Seq({ b: 'B' }); +stringToNumberOrString = Map({ a: 1 }).merge(stringToStringSeq); + +// $FlowExpectedError[incompatible-type] +stringToNumber = Map({ a: 1 }).setIn([], 0); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 1 }).setIn(['a'], 'a'); +stringToNumber = Map({ a: 1 }).setIn(['a'], 0); + +// $FlowExpectedError[incompatible-type] +stringToNumber = Map({ a: 1 }).deleteIn([]); +// $FlowExpectedError[incompatible-type] +stringToNumber = Map({ a: 1 }).removeIn([]); +stringToNumber = Map({ a: 1 }).deleteIn(['a']); +stringToNumber = Map({ a: 1 }).removeIn(['a']); + +// $FlowExpectedError[incompatible-type] +Map({ a: 1 }).updateIn([], (v) => v + 1); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map({ a: 1 }).updateIn(['a'], (v) => 'a'); +stringToNumber = Map({ a: 1 }).updateIn(['a'], (v) => v + 1); +stringToNumber = Map({ a: 1 }).updateIn(['a'], 0, (v) => v + 1); + +Map({ x: Map({ y: Map({ z: 1 }) }) }).updateIn(['x', 'y', 'z'], (v) => v + 1); +Map({ x: Map({ y: Map({ z: 1 }) }) }).updateIn( + ['x', 'y', 'z'], + 0, + (v) => v + 1 +); + +// $FlowExpectedError[incompatible-call] +Map({ x: Map({ y: Map({ z: 1 }) }) }).updateIn(['x', 'y', 1], (v) => v + 1); +// $FlowExpectedError[incompatible-call] +Map({ x: Map({ y: Map({ z: 1 }) }) }).updateIn(['x', 'y', 'z'], (v) => 'a'); + +stringToNumber = Map({ a: 1 }).mergeIn([], []); +stringToNumber = Map({ a: 1 }).mergeDeepIn([], []); + +anyMap = Map({ a: {} }).mergeIn(['a'], Map({ b: 2 })); +anyMap = Map({ a: {} }).mergeDeepIn(['a'], Map({ b: 2 })); +anyMap = Map({ a: {} }).mergeIn(['a'], List([1, 2])); +anyMap = Map({ a: {} }).mergeDeepIn(['a'], List([1, 2])); +anyMap = Map({ a: {} }).mergeIn(['a'], { b: 2 }); +anyMap = Map({ a: {} }).mergeDeepIn(['a'], { b: 2 }); +// $FlowExpectedError[incompatible-call]: not iterable / object +anyMap = Map({ a: {} }).mergeIn(['a'], 1); +// $FlowExpectedError[incompatible-call]: not iterable / object +anyMap = Map({ a: {} }).mergeDeepIn(['a'], 1); +// $FlowExpectedError[incompatible-type-arg]: bad key type +stringToNumber = Map({ a: {} }).mergeIn([1], { b: 2 }); +// $FlowExpectedError[incompatible-type-arg]: bad key type +stringToNumber = Map({ a: {} }).mergeDeepIn([1], { b: 2 }); + +stringToNumber = Map({ a: 1 }).withMutations((mutable) => mutable); + +stringToNumber = Map({ a: 1 }).asMutable(); +stringToNumber = Map({ a: 1 }).asImmutable(); + +stringToNumber = Map({ a: 1 }).map((value, index, iter) => 1); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map({ a: 1 }).map((value, index, iter) => 'a'); + +stringToNumber = Map({ a: 1 }).flatMap((value, index, iter) => [['b', 1]]); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map({ a: 1 }).flatMap((value, index, iter) => [['a', 'a']]); +// $FlowExpectedError[incompatible-call] +stringToNumber = Map({ a: 1 }).flatMap((value, index, iter) => Map({ a: 'a' })); + +numberToString = Map({ a: 1 }).flip(); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 1 }).flip(); + +numberToString = Map({ a: 'a' }).mapKeys((key, value, iter) => 1); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = Map({ a: 1 }).mapKeys((key, value, iter) => 1); + +anyMap = Map({ a: 1 }).flatten(); + +var stringToNullableNumber = Map({ a: 1, b: null }); +// $FlowExpectedError[incompatible-type-arg] +stringToNumber = stringToNullableNumber; +// Specific type for filter(Boolean) which removes nullability. +stringToNumber = stringToNullableNumber.filter(Boolean); + +[anyMap, ] = Map({ "a": 1, "b": 2}).partition((key, index, iter) => key % 2) + +/* OrderedMap */ + +orderedStringToNumber = Map({ a: 1 }).toOrderedMap(); +// $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap +orderedStringToNumber = Map({ a: 'b' }).toOrderedMap(); +orderedStringToString = Map({ a: 'b' }).toOrderedMap(); + +orderedStringToNumber = OrderedMap({ a: 1 }); +// $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap({ a: '1' }); +orderedStringToString = OrderedMap({ a: '1' }); + +orderedStringToNumber = OrderedMap(Map({ a: 1 })); +// $FlowExpectedError[incompatible-type-arg] - it's actually an OrderedMap +orderedStringToNumber = OrderedMap(Map({ a: '1' })); + +orderedStringToNumber = OrderedMap(); + +orderedStringToNumber = OrderedMap().set('b', 2); +// $FlowExpectedError[incompatible-call] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap().set('b', '2'); +orderedStringToString = OrderedMap().set('b', '2'); + +orderedStringToNumber = OrderedMap({ a: 1 }).delete('a'); +orderedStringToNumber = OrderedMap({ a: 1 }).remove('a'); +orderedStringToNumber = OrderedMap({ a: 1 }).clear(); + +orderedStringToNumber = OrderedMap({ a: 1 }).update(() => OrderedMap({ b: 1 })); +/** + * TODO: the following is valid but I question if it should be valid: + * + * ``` + * const x: OrderedMap = OrderedMap({'a': 1}) + * .update(() => OrderedMap({'b': '1'})) + * ``` + * + * In the above example, `update` is changing an OrderedMap to an OrderedMap + * This seems inconsistent with the typescript signature of + * + * ``` + * update(updater: (value: Map) => Map): Map + * ``` + */ +orderedStringToNumber = OrderedMap({ a: 1 }).update(() => + // $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap + OrderedMap({ b: '1' }) +); +orderedStringToString = OrderedMap({ a: 1 }).update(() => + OrderedMap({ b: '1' }) +); + +orderedStringToNumber = OrderedMap({ a: 1 }).update('a', (value) => value + 1); +/** + * TODO: is the below the intended functionality? The typescript signature looks like + * + * ``` + * update(key: K, updater: (value: V) => V): Map; + * ``` + * + * so it seems like in this case the updater should only be able to return numbers. + * This comment applies to all of the update / merge functions in Map and OrderedMap + */ +// $FlowExpectedError[incompatible-call] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap({ a: 1 }).update('a', () => 'b'); +orderedStringToNumberOrString = OrderedMap({ a: 1 }).update('a', () => 'b'); + +orderedStringToNumber = OrderedMap({ a: 1 }).update( + 'a', + 0, + (value) => value + 1 +); +// $FlowExpectedError[incompatible-call] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap({ a: 1 }).update('a', 0, () => 'b'); +orderedStringToNumberOrString = OrderedMap({ a: 1 }).update('a', 0, () => 'b'); + +orderedStringToNumber = OrderedMap({ a: 1 }).merge({ b: 2 }); +// $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap({ a: 1 }).merge({ b: '2' }); +orderedStringToNumberOrString = OrderedMap({ a: 1 }).merge({ b: '2' }); + +orderedStringToNumber = OrderedMap({ a: 1 }).mergeWith( + (prev, next) => next, + { a: 2, b: 3 } +); +orderedStringToNumber = OrderedMap({ a: 1 }).mergeWith( + // $FlowExpectedError[incompatible-call] + (prev, next) => next, + // $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap + { a: '2', b: '3' } +); +orderedStringToNumberOrString = OrderedMap({ a: 1 }).mergeWith( + (prev, next) => next, + { a: '2', b: '3' } +); +// $FlowExpectedError[incompatible-call] - the array [1] is not a valid argument +orderedStringToNumber = OrderedMap({ a: 1 }).mergeWith((prev, next) => next, [ + 1, +]); + +orderedStringToNumber = OrderedMap({ a: 1 }).mergeDeep({ a: 2 }); +// $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap({ a: 1 }).mergeDeep({ a: '2' }); +orderedStringToNumberOrString = OrderedMap({ a: 1 }).mergeDeep({ a: '2' }); + +orderedStringToNumber = OrderedMap({ a: 1 }).mergeDeepWith( + (prev, next) => next, + { a: 2, b: 3 } +); +orderedStringToNumber = OrderedMap({ a: 1 }).mergeDeepWith( + (prev, next) => next, + // $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap + { a: '2', b: '3' } +); +orderedStringToNumberOrString = OrderedMap({ a: 1 }).mergeDeepWith( + (prev, next) => next, + { a: '2', b: '3' } +); +orderedStringToNumber = OrderedMap({ a: 1 }).mergeDeepWith( + (prev, next) => next, + // $FlowExpectedError[incompatible-call] - the array [1] is an invalid argument + [1] +); + +// $FlowExpectedError[incompatible-type] +orderedStringToNumber = OrderedMap({ a: 1 }).setIn([], 3); +// $FlowExpectedError[incompatible-type-arg] +orderedStringToNumber = OrderedMap({ a: 1 }).setIn([1], 3); +orderedStringToNumber = OrderedMap({ a: 1 }).setIn(['a'], 3); +// $FlowExpectedError[incompatible-type] +orderedStringToNumber = OrderedMap({ a: 1 }).deleteIn([]); +// $FlowExpectedError[incompatible-type] +orderedStringToNumber = OrderedMap({ a: 1 }).removeIn([]); +// $FlowExpectedError[incompatible-type-arg] +orderedStringToNumber = OrderedMap({ a: 1 }).deleteIn([1]); +// $FlowExpectedError[incompatible-type-arg] +orderedStringToNumber = OrderedMap({ a: 1 }).removeIn([1]); +orderedStringToNumber = OrderedMap({ a: 1 }).deleteIn(['b']); +orderedStringToNumber = OrderedMap({ a: 1 }).removeIn(['b']); + +// $FlowExpectedError[incompatible-type] +orderedStringToNumber = OrderedMap({ a: 1 }).updateIn([], (v) => v + 1); +// $FlowExpectedError[incompatible-type-arg] +orderedStringToNumber = OrderedMap({ a: 1 }).updateIn([1], (v) => v + 1); +// $FlowExpectedError[incompatible-call] +orderedStringToNumber = OrderedMap({ a: 1 }).updateIn(['a'], (v) => 'a'); +orderedStringToNumber = OrderedMap({ a: 1 }).updateIn(['a'], (v) => v + 1); +orderedStringToNumber = OrderedMap({ a: 1 }).updateIn(['a'], 0, (v) => v + 1); + +// $FlowExpectedError[incompatible-call] +OrderedMap({ x: OrderedMap({ y: 1 }) }).updateIn(['x', 1], (v) => v + 1); +// $FlowExpectedError[incompatible-call] +OrderedMap({ x: OrderedMap({ y: 1 }) }).updateIn(['x', 'y'], (v) => 'a'); +OrderedMap({ x: OrderedMap({ y: 1 }) }).updateIn(['x', 'y'], (v) => v + 1); +OrderedMap({ x: OrderedMap({ y: 1 }) }).updateIn(['x', 'y'], 0, (v) => v + 1); + +orderedStringToNumber = OrderedMap({ a: 1 }).mergeIn([], { b: 2 }); +orderedStringToNumber = OrderedMap({ a: 1 }).mergeDeepIn([], { b: 2 }); +orderedStringToNumber = OrderedMap({ a: 1 }).withMutations((mutable) => + mutable.set('b', 2) +); +orderedStringToNumber = OrderedMap({ a: 1 }).asMutable(); +orderedStringToNumber = OrderedMap({ a: 1 }).asImmutable(); + +orderedStringToNumber = OrderedMap({ a: 1 }).map((v) => v + 1); +// $FlowExpectedError[incompatible-call] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap({ a: 1 }).map(() => 'a'); +orderedStringToString = OrderedMap({ a: 1 }).map(() => 'a'); + +orderedStringToNumber = OrderedMap({ a: 1 }).flatMap((v, k) => + OrderedMap({ [k]: v + 1 }) +); +orderedStringToNumber = OrderedMap({ a: 1 }).flatMap((v, k) => + // $FlowExpectedError[incompatible-call] - string "a" is not a number + OrderedMap({ [k]: 'a' }) +); + +// $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap({ a: 1 }).flip(); +orderedNumberToString = OrderedMap({ a: 1 }).flip(); + +orderedStringToNumber = OrderedMap({ a: 1 }).mapKeys((x) => x); +// $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedMap +orderedStringToNumber = OrderedMap({ a: 1 }).mapKeys((x) => 1); +orderedNumberToNumber = OrderedMap({ a: 1 }).mapKeys((x) => 1); + +orderedStringToNumber = OrderedMap({ a: 1 }).flatten(); +orderedStringToNumber = OrderedMap({ a: 1 }).flatten(1); +orderedStringToNumber = OrderedMap({ a: 1 }).flatten(true); +// $FlowExpectedError[incompatible-call] - 'a' is an invalid argument +orderedStringToNumber = OrderedMap({ a: 1 }).flatten('a'); + +/* Set */ + +numberSet = Set(); +numberOrStringSet = Set(); +stringSet = Set(); + +numberSet = Set([1, 2, 3]); +// $FlowExpectedError[incompatible-call] +numberSet = Set(['a', 'b']); + +numberSet = Set.of(1, 2); +// $FlowExpectedError[incompatible-call] +numberSet = Set.of('a', 'b'); + +numberSet = Set.fromKeys(Map().set(1, '')); +stringSet = Set.fromKeys({ a: '' }); +// $FlowExpectedError[incompatible-type-arg] +numberSet = Set.fromKeys(Map({ a: 1 })); +// $FlowExpectedError[incompatible-type-arg] +numberSet = Set.fromKeys({ a: 1 }); + +numberOrStringSet = Set([1]).add('a'); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).add('s'); + +numberSet = Set([1]).delete(1); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).delete('a'); +// $FlowExpectedError[incompatible-call] +numberSet = Set(['a']).delete('a'); + +numberSet = Set([1]).remove(1); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).remove('a'); +// $FlowExpectedError[incompatible-call] +numberSet = Set(['a']).remove('a'); + +numberSet = Set([1]).clear(); +// $FlowExpectedError[incompatible-call] +numberSet = Set(['a']).clear(); + +numberOrStringSet = Set(['a']).union([1]); +numberOrStringSet = Set(['a']).union(Set([1])); +numberSet = Set([1]).union([1]); +numberSet = Set([1]).union(Set([1])); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).union(['a']); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).union(Set(['a'])); + +numberOrStringSet = Set(['a']).merge([1]); +numberOrStringSet = Set(['a']).merge(Set([1])); +numberSet = Set([1]).merge([1]); +numberSet = Set([1]).merge(Set([1])); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).merge(['a']); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).merge(Set(['a'])); + +numberSet = Set([1]).intersect(Set([1])); +numberSet = Set([1]).intersect([1]); +numberSet = Set([1]).intersect(Set(['a'])); +numberSet = Set([1]).intersect(['a']); + +numberSet = Set([1]).subtract(Set([1])); +numberSet = Set([1]).subtract([1]); +numberSet = Set([1]).subtract(Set(['a'])); +numberSet = Set([1]).subtract(['a']); + +numberSet = Set([1]).withMutations((mutable) => mutable); +// $FlowExpectedError[incompatible-call] +stringSet = Set([1]).withMutations((mutable) => mutable); + +numberSet = Set([1]).asMutable(); +// $FlowExpectedError[incompatible-call] +stringSet = Set([1]).asMutable(); + +numberSet = Set([1]).asImmutable(); +// $FlowExpectedError[incompatible-call] +stringSet = Set([1]).asImmutable(); + +stringSet = Set([1]).map((value, index, iter) => 'a'); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).map((value, index, iter) => 'a'); + +stringSet = Set([1]).flatMap((value, index, iter) => ['a']); +// $FlowExpectedError[incompatible-call] +numberSet = Set([1]).flatMap((value, index, iter) => ['a']); + +numberSet = Set([1]).flatten(); + +/* OrderedSet */ + +orderedStringSet = Set(['a']).toOrderedSet(); +// $FlowExpectedError[incompatible-call] - this is actually an OrderedSet +orderedStringSet = Set([1]).toOrderedSet(); +orderedNumberSet = Set([1]).toOrderedSet(); + +orderedStringSet = OrderedSet(['a']); +// $FlowExpectedError[incompatible-call] - this is actually an OrderedSet +orderedStringSet = OrderedSet([1]); +orderedNumberSet = OrderedSet([1]); + +orderedStringSet = OrderedSet(List.of('a')); +// $FlowExpectedError[incompatible-call] - this is actually an OrderedSet +orderedStringSet = OrderedSet(List.of(1)); +orderedNumberSet = OrderedSet(List.of(1)); + +orderedStringSet = OrderedSet.of('a', 'b', 'c'); +// $FlowExpectedError[incompatible-call] - this is actually an OrderedSet +orderedStringSet = OrderedSet.of(1); +orderedNumberSet = OrderedSet.of(1); + +orderedStringSet = OrderedSet.fromKeys(Map({ a: 1 })); +// $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedSet +orderedNumberSet = OrderedSet.fromKeys(Map({ a: 1 })); + +orderedStringSet = OrderedSet.fromKeys({ a: 1 }); +// $FlowExpectedError[incompatible-type-arg] - this is actually an OrderedSet +orderedNumberSet = OrderedSet.fromKeys({ a: 1 }); + +orderedStringSet = OrderedSet(); + +orderedStringSet = OrderedSet.of('a').add('b'); +/** + * TODO: in typescript definitions, add looks like + * + * ``` + * add(value: T): Set + * ``` + * + * so we shouldn't be able to add a number to a set of strings + */ +// $FlowExpectedError[incompatible-call] - this is actually an OrderedSet +orderedStringSet = OrderedSet('a').add(1); +orderedNumberOrStringSet = OrderedSet('a').add(1); + +orderedStringSet = OrderedSet.of('a').delete('a'); +// $FlowExpectedError[incompatible-call] - 1 is an invalid arg +orderedStringSet = OrderedSet.of('a').delete(1); + +orderedStringSet = OrderedSet.of('a').remove('a'); +// $FlowExpectedError[incompatible-call] - 1 is an invalid arg +orderedStringSet = OrderedSet.of('a').remove(1); + +orderedStringSet = OrderedSet.of('a').clear(); + +orderedStringSet = OrderedSet.of('a').union(OrderedSet.of('b')); +/** + * TODO: typescript def looks like + * + * ``` + * union(...iterables: Array[]): Set + * ``` + * + * so we shouldn't be able to merge strings and numbers + */ +// $FlowExpectedError[incompatible-call] - this is actually an OrderedSet +orderedStringSet = OrderedSet.of('a').union(OrderedSet.of(1)); +orderedNumberOrStringSet = OrderedSet.of('a').union(OrderedSet.of(1)); + +orderedStringSet = OrderedSet.of('a').merge(OrderedSet.of('b')); +/** + * TODO: typescript def looks like + * + * ``` + * merge(...iterables: Array[]): Set + * ``` + * + * so we shouldn't be able to merge strings and numbers + */ +// $FlowExpectedError[incompatible-call] - this is actually an OrderedSet +orderedStringSet = OrderedSet.of('a').merge(OrderedSet.of(1)); +orderedNumberOrStringSet = OrderedSet.of('a').merge(OrderedSet.of(1)); + +orderedStringSet = OrderedSet.of('a', 'b').intersect(OrderedSet.of('a')); +/** + * TODO: typescript def looks like + * + * ``` + * intersect(...iterables: Array[]): Set + * ``` + * + * so we shouldn't be able to intersect strings and numbers + */ +orderedStringSet = OrderedSet.of('a', 'b').intersect(OrderedSet.of(1)); + +orderedStringSet = OrderedSet.of('a', 'b').subtract(OrderedSet.of('a')); +/** + * TODO: typescript def looks like + * + * ``` + * subtract(...iterables: Array[]): Set + * ``` + * + * so we shouldn't be able to intersect strings and numbers + */ +orderedStringSet = OrderedSet.of('a', 'b').subtract(OrderedSet.of(1)); + +orderedStringSet = OrderedSet().withMutations((mutable) => mutable.add('a')); +orderedStringSet = OrderedSet.of('a').asMutable(); +orderedStringSet = OrderedSet.of('a').asImmutable(); + +orderedStringSet = OrderedSet.of('a', 'b').map((m) => m); +// $FlowExpectedError[incompatible-call] - this is an OrderedSet +orderedStringSet = OrderedSet.of('a', 'b').map(() => 1); +orderedNumberSet = OrderedSet.of('a', 'b').map(() => 1); + +orderedStringSet = OrderedSet.of('a', 'b').flatMap((m) => [m]); +// $FlowExpectedError[incompatible-call] - this is an OrderedSet +orderedStringSet = OrderedSet.of('a', 'b').flatMap((m) => [1]); +orderedNumberSet = OrderedSet.of('a', 'b').flatMap((m) => [1]); + +orderedStringSet = OrderedSet.of('a', 'b').flatten(1); +orderedStringSet = OrderedSet.of('a', 'b').flatten(false); +// $FlowExpectedError[incompatible-call] - invalid arg for flatten +orderedStringSet = OrderedSet.of('a', 'b').flatten('a'); + +/* Stack */ + +numberStack = Stack([1, 2]); +let numberStackSize: number = numberStack.size; +numberOrStringStack = Stack(['a', 1]); +// $FlowExpectedError[incompatible-call] +numberStack = Stack(['a', 'b']); + +numberStack = Stack.of(1, 2); +numberOrStringStack = Stack.of('a', 1); +// $FlowExpectedError[incompatible-call] +numberStack = Stack.of('a', 1); + +number = Stack([1]).peek(); +// $FlowExpectedError[incompatible-type] +number = Stack(['a']).peek(); + +numberStack = Stack([1]).unshift(1); +numberOrStringStack = Stack([1]).unshift('a'); +// $FlowExpectedError[incompatible-call] +numberStack = Stack([1]).unshift('a'); + +numberStack = Stack([1]).unshiftAll([1]); +numberOrStringStack = Stack([1]).unshiftAll(['a']); +// $FlowExpectedError[incompatible-call] +numberStack = Stack([1]).unshiftAll(['a']); + +numberStack = Stack.of(1).shift(); +// $FlowExpectedError[incompatible-call] +numberStack = Stack.of('a').shift(); + +numberStack = Stack().push(1); +numberOrStringStack = Stack([1]).push('a'); +// $FlowExpectedError[incompatible-call] +numberStack = Stack().push('a'); + +numberStack = Stack().pushAll([1]); +numberOrStringStack = Stack([1]).pushAll(['a']); +// $FlowExpectedError[incompatible-call] +numberStack = Stack().push(['a']); + +numberStack = Stack.of(1).pop(); +// $FlowExpectedError[incompatible-call] +numberStack = Stack.of('a').pop(); + +numberStack = Stack([1]).withMutations((mutable) => mutable); +// $FlowExpectedError[incompatible-call] +numberStack = Stack(['a']).withMutations((mutable) => mutable); + +numberStack = Stack([1]).asMutable(); +// $FlowExpectedError[incompatible-call] +numberStack = Stack(['a']).asMutable(); + +numberStack = Stack([1]).asImmutable(); +// $FlowExpectedError[incompatible-call] +numberStack = Stack(['a']).asImmutable(); + +numberStack = Stack([1]).map((value, index, iter) => 1); +// $FlowExpectedError[incompatible-call] +numberStack = Stack([1]).map((value, index, iter) => 'a'); + +numberStack = Stack([1]).flatMap((value, index, iter) => [1]); +// $FlowExpectedError[incompatible-call] +numberStack = Stack([1]).flatMap((value, index, iter) => ['a']); + +numberStack = Stack([1]).flatten(); +numberStack = Stack(['a']).flatten(); + +/* Range & Repeat */ + +// `{}` provide namespaces +{ + const numberSequence: IndexedSeq = Range(0, 0, 0); +} +{ + const numberSequence: IndexedSeq = Repeat(1, 5); +} + +{ + const stringSequence: IndexedSeq = Repeat('a', 5); +} +{ + // $FlowExpectedError[incompatible-call] + const stringSequence: IndexedSeq = Repeat(0, 1); +} +{ + // $FlowExpectedError[incompatible-type-arg] + const stringSequence: IndexedSeq = Range(0, 0, 0); +} + +/* Seq */ + +let numberSeq = Seq([1, 2, 3]); +// $FlowExpectedError[incompatible-type] +let numberSeqSize: number = numberSeq.size; +let maybeNumberSeqSize: ?number = numberSeq.size; + +/* Record */ + +type PersonRecordFields = { age: number, name: string }; +type PersonRecord = RecordOf; +const makePersonRecord: RecordFactory = Record({ + age: 900, + name: 'Yoda', +}); + +const personRecordInstance: PersonRecord = makePersonRecord({ age: 25 }); + +{ + // $FlowExpectedError[incompatible-type] + const age: string = personRecordInstance.get('age'); +} +{ + // $FlowExpectedError[incompatible-type] + const age: string = personRecordInstance.age; +} +{ + const age: number = personRecordInstance.get('age'); +} +{ + const age: number = personRecordInstance.age; +} + +// $FlowExpectedError[incompatible-call] +personRecordInstance.set('invalid', 25); +personRecordInstance.set('name', '25'); +personRecordInstance.set('age', 33); + +// FixMe: The first should be FlowExpectedError[incompatible-call], and the second two should be correct, +// however all three produce a hard to understand error because there is a bug +// with Flow's $Call utility type. +// set(personRecordInstance, 'invalid', 25) +// set(personRecordInstance, 'name', '25') +// set(personRecordInstance, 'age', 33) + +// Create a Map from a non-prototype "plain" Object +let someObj = Object.create(null); +someObj.x = 1; +someObj.y = 2; +let mapOfSomeObj: Map = Map(someObj); +// $FlowExpectedError[incompatible-call] - someObj is string -> number +let mapOfSomeObjMistake: Map = Map(someObj); + +// getIn() type + +// Deep nested +const deepData1: List> = List([Map([['apple', 'sauce']])]); +const deepNestedString1 = deepData1.getIn([0, 'apple']); +{ + // $FlowExpectedError[incompatible-type] string is not a number + const fail: ?number = deepNestedString1; +} +{ + // $FlowExpectedError[incompatible-type] getIn can return undefined + const fail: string = deepNestedString1; +} +{ + const success: ?string = deepNestedString1; +} + +const listOfListOfNumber: List> = List([List([1, 2, 3])]); +const nestedNum = listOfListOfNumber.getIn([0, 1]); +{ + // $FlowExpectedError[incompatible-type] number is not string + const fail: ?string = nestedNum; +} +{ + // $FlowExpectedError[incompatible-type] getIn can return undefined + const fail: number = nestedNum; +} +{ + const success: ?number = nestedNum; +} +// $FlowExpectedError[incompatible-call] expected a number 1st key +listOfListOfNumber.getIn(['whoops', 1]); +// $FlowExpectedError[incompatible-call] expected a number 2nd key +listOfListOfNumber.getIn([0, 'whoops']); +// $FlowExpectedError[incompatible-call] too many keys! +listOfListOfNumber.getIn([0, 0, 'whoops']); + +// Deep nested +const deepData: List>> = List([ + Map([['apple', List(['sauce'])]]), +]); +const deepNestedString = deepData.getIn([0, 'apple', 0]); +{ + // $FlowExpectedError[incompatible-type] string is not a number + const fail: ?number = deepNestedString; +} +{ + // $FlowExpectedError[incompatible-type] getIn can return undefined + const fail: string = deepNestedString; +} +{ + const success: ?string = deepNestedString; +} +// $FlowExpectedError[incompatible-call] expected a string 2nd key +deepData.getIn([0, 0, 0]); +// $FlowExpectedError[incompatible-call] expected a number 3rd key +deepData.getIn([0, 'apple', 'whoops']); + +// Containing Records +const listOfPersonRecord: List = List([personRecordInstance]); +const firstAge = listOfPersonRecord.getIn([0, 'age']); +{ + // $FlowExpectedError[incompatible-type] expected a string key + const age: string = firstAge; +} +{ + // $FlowExpectedError[incompatible-type] getIn can return undefined + const age: number = firstAge; +} +{ + const age: ?number = firstAge; +} +// $FlowExpectedError[incompatible-call] - the first key is not an index +listOfPersonRecord.getIn(['wrong', 'age']); +// $FlowExpectedError[incompatible-call] - the second key is not an record key +listOfPersonRecord.getIn([0, 'mispeld']); +// $FlowExpectedError[incompatible-call] - the second key is not an record key +listOfPersonRecord.getIn([0, 0]); +// $FlowExpectedError[incompatible-call] +listOfPersonRecord.setIn([0, 'age'], 'Thirteen'); +listOfPersonRecord.setIn([0, 'age'], 13); +// $FlowExpectedError[prop-missing] +listOfPersonRecord.updateIn([0, 'age'], (value) => value.unknownFunction()); +listOfPersonRecord.updateIn([0, 'age'], (value) => value + 1); +listOfPersonRecord.updateIn([0, 'age'], 0, (value) => value + 1); + +// Recursive Records +type PersonRecord2Fields = { name: string, friends: List }; +type PersonRecord2 = RecordOf; +const makePersonRecord2: RecordFactory = Record({ + name: 'Adam', + friends: List(), +}); +const friendly: PersonRecord2 = makePersonRecord2(); +{ + // $FlowExpectedError[incompatible-type] string is not a number + const fail: ?number = friendly.getIn(['friends', 0, 'name']); +} +// notSetValue provided +{ + const success: string = friendly.getIn(['friends', 0, 'name'], 'Abbie'); +} +{ + const success: ?string = friendly.getIn(['friends', 0, 'name']); +} + +// Functional API + +{ + // $FlowExpectedError[incompatible-type] string is not a number + const fail: ?number = getIn(friendly, ['friends', 0, 'name']); +} +// notSetValue provided +{ + const success: string = getIn(friendly, ['friends', 0, 'name'], 'Abbie'); +} +{ + const success: ?string = getIn(friendly, ['friends', 0, 'name']); +} + +// Deep nested containing recursive Records +const friendlies: List = List([makePersonRecord2()]); +{ + // $FlowExpectedError[incompatible-type] string is not a number + const fail: ?number = friendlies.getIn([0, 'friends', 0, 'name']); +} +// notSetValue provided +{ + const success: string = friendlies.getIn([0, 'friends', 0, 'name'], 'Abbie'); +} +{ + const success: ?string = friendlies.getIn([0, 'friends', 0, 'name']); +} +// $FlowExpectedError[incompatible-call] +friendlies.setIn([0, 'friends', 0, 'name'], 123); +friendlies.setIn([0, 'friends', 0, 'name'], 'Sally'); +friendlies.updateIn([0, 'friends', 0, 'name'], (value) => + // $FlowExpectedError[prop-missing] + value.unknownFunction() +); +friendlies.updateIn([0, 'friends', 0, 'name'], (value) => value.toUpperCase()); +friendlies.updateIn([0, 'friends', 0, 'name'], 'Unknown Name', (value) => + value.toUpperCase() +); + +// Nested plain JS values +type PlainPerson = { name: string, friends: Array }; +const plainFriendly: PlainPerson = { name: 'Bobbie', friends: [] }; +const plainFriendlies: List = List([plainFriendly]); + +{ + // $FlowExpectedError[incompatible-call] 'fraaands' is an unknown key in PlainPerson + const fail: ?number = plainFriendlies.getIn([0, 'fraaands', 0, 'name']); +} +{ + // $FlowExpectedError[incompatible-call] 0 is an unknown key in PlainPerson + const fail: ?number = plainFriendlies.getIn([0, 'fraaands', 0, 0]); +} +{ + // $FlowExpectedError[incompatible-type] string is not a number + const fail: ?number = plainFriendlies.getIn([0, 'friends', 0, 'name']); +} +{ + // $FlowExpectedError[incompatible-type] can return undefined + const fail: string = plainFriendlies.getIn([0, 'friends', 0, 'name']); +} +{ + const success: ?string = plainFriendlies.getIn([0, 'friends', 0, 'name']); +} + +// $FlowExpectedError[incompatible-call] number is not a string +plainFriendlies.setIn([0, 'friends', 0, 'name'], 123); +plainFriendlies.setIn([0, 'friends', 0, 'name'], 'Morgan'); + +plainFriendlies.updateIn([0, 'friends', 0, 'name'], (value) => + // $FlowExpectedError[prop-missing] value is a string, this is an unknown function + value.unknownFunction() +); +plainFriendlies.updateIn([0, 'friends', 0, 'name'], (value) => + value.toUpperCase() +); + +// $FlowExpectedError[incompatible-call] number is not a string +plainFriendlies.updateIn([0, 'friends', 0, 'name'], () => 123); +plainFriendlies.updateIn([0, 'friends', 0, 'name'], () => 'Whitney'); + +// Functional API + +{ + // $FlowExpectedError[incompatible-call] 'fraaands' is an unknown key in PlainPerson + const fail: ?number = getIn(plainFriendlies, [0, 'fraaands', 0, 'name']); +} +{ + // $FlowExpectedError[incompatible-call] 0 is an unknown key in PlainPerson + const fail: ?number = getIn(plainFriendlies, [0, 'fraaands', 0, 0]); +} +{ + // $FlowExpectedError[incompatible-type] string is not a number + const fail: ?number = getIn(plainFriendlies, [0, 'friends', 0, 'name']); +} +{ + // $FlowExpectedError[incompatible-type] can return undefined + const fail: string = getIn(plainFriendlies, [0, 'friends', 0, 'name']); +} +{ + const success: ?string = getIn(plainFriendlies, [0, 'friends', 0, 'name']); +} + +// $FlowExpectedError[incompatible-call] number is not a string +setIn(plainFriendlies, [0, 'friends', 0, 'name'], 123); +setIn(plainFriendlies, [0, 'friends', 0, 'name'], 'Morgan'); + +updateIn(plainFriendlies, [0, 'friends', 0, 'name'], (value) => + // $FlowExpectedError[prop-missing] value is a string, this is an unknown function + value.unknownFunction() +); +updateIn(plainFriendlies, [0, 'friends', 0, 'name'], (value) => + value.toUpperCase() +); + +// $FlowExpectedError[incompatible-call] number is not a string +updateIn(plainFriendlies, [0, 'friends', 0, 'name'], () => 123); +updateIn(plainFriendlies, [0, 'friends', 0, 'name'], () => 'Whitney'); + +// Plain JS values + +{ + const success: number | void = get([1, 2, 3], 0); +} +{ + const success: number | string = get([1, 2, 3], 0, 'missing'); +} +{ + // $FlowExpectedError[incompatible-call] - string is not an array index + const success: number = get([1, 2, 3], 'z'); +} +// Note: does not return null since x is known to exist in {x,y} +{ + const success: number = get({ x: 10, y: 10 }, 'x'); +} +{ + // $FlowExpectedError[incompatible-call] - z is not in {x,y} + const success: number | void = get({ x: 10, y: 10 }, 'z'); +} +{ + const objMap: { [string]: number } = { x: 10, y: 10 }; + const success: number | void = get(objMap, 'z'); +} +{ + const success: number = get({ x: 10, y: 10 }, 'x', 'missing'); +} +{ + const objMap: { [string]: number } = { x: 10, y: 10 }; + const success: number | string = get(objMap, 'z', 'missing'); +} + +// Deeply nested records + +type DeepNestFields = { + foo: number, +}; +type DeepNest = RecordOf; +const deepNest: RecordFactory = Record({ + foo: 0, +}); + +type NestFields = { + deepNest: DeepNest, +}; +type Nest = RecordOf; +const nest: RecordFactory = Record({ + deepNest: deepNest(), +}); + +type StateFields = { + nest: Nest, +}; +type State = RecordOf; +const initialState: RecordFactory = Record({ + nest: nest(), +}); + +const state = initialState(); +(state.setIn(['nest', 'deepNest', 'foo'], 5): State); +// $FlowExpectedError[incompatible-call] +(state.setIn(['nest', 'deepNest', 'foo'], 'string'): State); +// $FlowExpectedError[incompatible-call] +(state.setIn(['nest', 'deepNest', 'unknownField'], 5): State); diff --git a/type-definitions/flow-tests/merge.js b/type-definitions/flow-tests/merge.js new file mode 100644 index 0000000000..ad4cc4b21f --- /dev/null +++ b/type-definitions/flow-tests/merge.js @@ -0,0 +1,138 @@ +// @flow +import { + List, + Map, + Record, + type RecordOf, + type RecordFactory, + get, + getIn, + has, + hasIn, + merge, + mergeDeep, + mergeWith, + mergeDeepWith, + remove, + removeIn, + set, + setIn, + update, + updateIn, +} from 'immutable'; + +// merge: Objects as Maps + +type ObjMap = { [key: string]: T }; +const objMap: ObjMap = { x: 12, y: 34 }; +(merge(objMap, { x: 321 }): ObjMap); +(merge(objMap, { z: 321 }): ObjMap); +// $FlowExpectedError[incompatible-call] +(merge(objMap, { x: 'abc' }): ObjMap); +(merge(objMap, [['x', 321]]): ObjMap); +(merge(objMap, [['z', 321]]): ObjMap); +// $FlowExpectedError[incompatible-call] +(merge(objMap, [['x', 'abc']]): ObjMap); +// $FlowExpectedError[incompatible-call] +(merge(objMap, [321]): ObjMap); +(merge(objMap, Map({ x: 123 })): ObjMap); +(merge(objMap, Map({ z: 123 })): ObjMap); +(merge(objMap, Map([['x', 123]])): ObjMap); +(merge(objMap, Map([['z', 123]])): ObjMap); +// $FlowExpectedError[incompatible-call] +(merge(objMap, List([123])): ObjMap); + +// merge: Maps + +const map = Map({ key: 'value' }); +(merge(map, { key: 'alternate' }): Map); +(merge(map, { otherKey: 'value' }): Map); +(merge(map, Map({ key: 'alternate' })): Map); +(merge(map, Map({ otherKey: 'value' })): Map); +(merge(map, [['otherKey', 'value']]): Map); +// $FlowExpectedError[incompatible-call] (functional merge cannot return union value types) +(merge(map, Map({ otherKey: 123 })): Map); +// $FlowExpectedError[incompatible-call] +(merge(map, [4, 5, 6]): Map); +// $FlowExpectedError[incompatible-call] +(merge(map, 123): Map); +// $FlowExpectedError[incompatible-call] +(merge(map, { '0': 123 }): Map); +// $FlowExpectedError[incompatible-call] +(merge(map, [ + [0, 4], + [1, 5], + [1, 6], +]): Map); + +// merge: Lists + +const list = List([1, 2, 3]); +(merge(list, [4, 5, 6]): List); +(merge(list, List([4, 5, 6])): List); +// $FlowExpectedError[incompatible-call] (functional merge cannot return union value types) +(merge(list, ['a', 'b', 'c']): List); +// $FlowExpectedError[incompatible-call] (functional merge cannot return union value types) +(merge(list, List(['a', 'b', 'c'])): List); +// $FlowExpectedError[incompatible-call] +(merge(list, 123): List); +// $FlowExpectedError[incompatible-call] +(merge(list, { '0': 123 }): List); +// $FlowExpectedError[incompatible-call] +(merge(list, Map({ '0': 123 })): List); +// $FlowExpectedError[incompatible-call] +(merge(list, [ + [0, 4], + [1, 5], + [1, 6], +]): List); + +// merge: Objects as Records + +type XYPoint = { x: number, y: number }; +const objRecord: XYPoint = { x: 12, y: 34 }; +(merge(objRecord, { x: 321 }): XYPoint); +(merge(objRecord, [['x', 321]]): XYPoint); +(merge(objRecord, Map({ x: 123 })): XYPoint); +(merge(objRecord, Map([['x', 123]])): XYPoint); +const xyPointRecord = Record({ x: 0, y: 0 }); +(merge(objRecord, xyPointRecord({ x: 321 })): XYPoint); +// $FlowExpectedError[incompatible-call] +(merge(objRecord, { x: 'abc' }): XYPoint); +// $FlowExpectedError[incompatible-call] +(merge({ x: 12, y: 34 }, [['x', 'abc']]): XYPoint); +// $FlowExpectedError[incompatible-call] +(merge(objRecord, { z: 321 }): XYPoint); +// $FlowExpectedError[prop-missing]] +// $FlowExpectedError[invalid-call-util]] +(merge(objRecord, [['z', 321]]): XYPoint); +// $FlowExpectedError[incompatible-call] +(merge(objRecord, Map({ z: 123 })): XYPoint); +// $FlowExpectedError[incompatible-call] +(merge(objRecord, Map([['z', 123]])): XYPoint); +// $FlowExpectedError[incompatible-call] +(merge(objRecord, [321]): XYPoint); +// $FlowExpectedError[incompatible-call] +(merge(objRecord, List([123])): XYPoint); + +// merge: Arrays + +const arr = [1, 2, 3]; +(merge(arr, [4, 5, 6]): Array); +(merge(arr, List([4, 5, 6])): Array); +// $FlowExpectedError[incompatible-call] (functional merge cannot return union value types) +(merge(arr, ['a', 'b', 'c']): Array); +// $FlowExpectedError[incompatible-call] (functional merge cannot return union value types) +(merge(arr, List(['a', 'b', 'c'])): Array); +// $FlowExpectedError[incompatible-call] +(merge(arr, 123): Array); +// $FlowExpectedError[incompatible-call] +(merge(arr, { '0': 123 }): Array); +// $FlowExpectedError[incompatible-call] +(merge(arr, Map({ '0': 123 })): Array); +// $FlowExpectedError[incompatible-call] +(merge(arr, [ + [0, 4], + [1, 5], + [1, 6], +]): Array); diff --git a/type-definitions/tests/predicates.js b/type-definitions/flow-tests/predicates.js similarity index 74% rename from type-definitions/tests/predicates.js rename to type-definitions/flow-tests/predicates.js index 20af14e743..a72072bb96 100644 --- a/type-definitions/tests/predicates.js +++ b/type-definitions/flow-tests/predicates.js @@ -1,12 +1,9 @@ -/* - * @flow - */ - -import { List } from '../../'; +// @flow +import { List } from 'immutable'; declare var mystery: mixed; -// $ExpectError +// $FlowExpectedError[cannot-resolve-name] maybe.push('3'); if (mystery instanceof List) { diff --git a/type-definitions/flow-tests/record.js b/type-definitions/flow-tests/record.js new file mode 100644 index 0000000000..d820608d92 --- /dev/null +++ b/type-definitions/flow-tests/record.js @@ -0,0 +1,217 @@ +// @flow +// Some tests look like they are repeated in order to avoid false positives. +// Flow might not complain about an instance of (what it thinks is) T to be assigned to T + +import { Record, type RecordFactory, type RecordOf, Map, List, merge } from 'immutable'; + +// Use the RecordFactory type to annotate +const Point2: RecordFactory<{ x: number, y: number }> = Record({ x: 0, y: 0 }); +const Point3: RecordFactory<{ x: number, y: number, z: number }> = Record({ + x: 0, + y: 0, + z: 0, +}); +type TGeoPoint = { lat: ?number, lon: ?number }; +const GeoPoint: RecordFactory = Record({ lat: null, lon: null }); + +// TODO: this should be FlowExpectedError - 'abc' is not a number +// However, due to support for the brittle support for subclassing, Flow +// cannot also type check default values in this position. +const PointWhoops: RecordFactory<{ x: number, y: number }> = Record({ + x: 0, + y: 'abc', +}); + +let origin2 = Point2({}); +let origin3 = Point3({}); +let geo = GeoPoint({ lat: 34 }); +// $FlowExpectedError[incompatible-call] +const mistake = Point2({ x: 'string' }); +origin3 = GeoPoint({ lat: 34 }); +geo = Point3({}); + +// Use RecordOf to type the return value of a Record factory function. +let geoPointExpected1: RecordOf = GeoPoint({}); + +// $FlowExpectedError[prop-missing] - Point2 does not return GeoPoint. +let geoPointExpected2: RecordOf = Point2({}); + +const px = origin2.get('x'); +const px2: number = origin2.x; +// $FlowExpectedError[incompatible-type] +const px3: number = origin2.get('x', 'not set value'); +const px4: number | string = origin2.get('x', 'not set value'); +// $FlowExpectedError[incompatible-call] +const pz = origin2.get('z'); +// $FlowExpectedError[incompatible-use] +const pz2 = origin2.z; + +origin2.set('x', 4); +// $FlowExpectedError[incompatible-call] +origin2.set('x', 'not-a-number'); +// $FlowExpectedError[incompatible-call] +origin2.set('z', 3); + +const name: string = Record.getDescriptiveName(origin2); +// $FlowExpectedError[incompatible-call] +const name2: string = Record.getDescriptiveName({}); + +// Note: need to cast through any when extending Records as if they ere classes +class ABClass extends (Record({ a: 1, b: 2 }): any) { + setA(a: number) { + return this.set('a', a); + } + + setB(b: number) { + return this.set('b', b); + } +} + +var t1 = new ABClass({ a: 1 }); +var t2 = t1.setA(3); +var t3 = t2.setB(10); +// Note: flow does not check extended Record classes yet +var t4 = t2.setC(10); + +// Note: flow does not check extended Record classes yet +var t1a: string = t1.a; +// Note: flow does not check extended Record classes yet +var t1c = t1.c; + +// Use of new to create record factories (supported, but discouraged) +type TPointNew = { x: number, y: number }; +type PointNew = RecordOf; +const MakePointNew: RecordFactory = new Record({ x: 0, y: 0 }); +// Not using new allows returning a record. +const origin: PointNew = MakePointNew(); +// Both get and prop access are supported with RecordOf +{ + const x: number = origin.get('x'); +} +{ + const x: number = origin.x; +} +{ + // $FlowExpectedError[incompatible-type] number is not a string + const x: string = origin.x; +} +// Can use the Record constructor type as an alternative, +// it just doesn't support property access. +const originAlt1: MakePointNew = MakePointNew(); +// Both get and prop access are supported with RecordOf +{ + const x: number = originAlt1.get('x'); +} +{ + // $FlowExpectedError[prop-missing] cannot use property access for this alternative annotation + const x: number = originAlt1.x; +} +// Can also sort of use the inner Record values type as an alternative, +// however it does not have the immutable record API, though useful for flowing +// immutable Records where plain objects are expected. +// Remember that Records are *read only*, and using the $ReadOnly helper type +// can ensure correct types. +const originAlt2: $ReadOnly = MakePointNew(); +{ + // $FlowExpectedError[prop-missing] cannot use Record API for this alternative annotation + const x: number = originAlt2.get('x'); +} +{ + const x: number = originAlt2.x; +} + +// Use of new may only return a class instance, not a record +// (supported but discouraged) +// $FlowExpectedError[class-object-subtyping] +// $FlowExpectedError[prop-missing] +const mistakeOriginNew: PointNew = new MakePointNew(); +// An alternative type strategy is instance based +const originNew: MakePointNew = new MakePointNew(); +// Only get, but not prop access are supported with class instances +{ + const x: number = originNew.get('x'); +} +{ + // $FlowExpectedError[prop-missing] property `x`. Property not found in RecordInstance + const x: number = originNew.x; +} + +// $FlowExpectedError[incompatible-call] instantiated with invalid type +const mistakeNewRecord = MakePointNew({ x: 'string' }); +// $FlowExpectedError[incompatible-call] instantiated with invalid type +const mistakeNewInstance = new MakePointNew({ x: 'string' }); + +// Subclassing + +// Note use of + for Read Only. +type TPerson = { +name: string, +age: number }; +const defaultValues: TPerson = { name: 'Aristotle', age: 2400 }; +const PersonRecord = Record(defaultValues); + +class Person extends PersonRecord { + getName(): string { + return this.get('name'); + } + + setName(name: string): this & TPerson { + return this.set('name', name); + } +} + +const person = new Person(); +(person.setName('Thales'): Person); +(person.getName(): string); +(person.setName('Thales').getName(): string); +(person.setName('Thales').name: string); +person.get('name'); +person.set('name', 'Thales'); +// $FlowExpectedError[incompatible-call] +person.get('unknown'); +// $FlowExpectedError[prop-missing] +person.set('unknown', 'Thales'); + +// Note: not +class PersonWithoutTypes extends PersonRecord { + getName(): string { + return this.get('name'); + } + + setName(name: string): this & TPerson { + return this.set('name', name); + } +} + +const person2 = new PersonWithoutTypes(); + +person2.get('name'); +// Note: no error +person2.get('unknown'); + + +// Functional Merge + +type XYPoint = { x: number, y: number }; +type XYPointRecord = RecordOf; +const xyRecord: RecordFactory = Record({ x: 0, y: 0 }); +const record = xyRecord(); +(merge(record, { x: 321 }): XYPointRecord); +(merge(record, xyRecord({ x: 321 })): XYPointRecord); +// $FlowExpectedError[incompatible-call] +(merge(record, { z: 321 }): XYPointRecord); +// $FlowExpectedError[incompatible-call] +(merge(record, { x: 'abc' }): XYPointRecord); +(merge(record, [['x', 321]]): XYPointRecord); +// $FlowExpectedError[prop-missing]] +(merge(record, [['z', 321]]): XYPointRecord); +// $FlowExpectedError[incompatible-call] +(merge(record, [['x', 'abc']]): XYPointRecord); +// $FlowExpectedError[incompatible-call] +(merge(record, [321]): XYPointRecord); +(merge(record, Map({ x: 123 })): XYPointRecord); +// $FlowExpectedError[incompatible-call] +(merge(record, Map({ z: 123 })): XYPointRecord); +(merge(record, Map([['x', 123]])): XYPointRecord); +// $FlowExpectedError[incompatible-call] +(merge(record, Map([['z', 123]])): XYPointRecord); +// $FlowExpectedError[incompatible-call] +(merge(record, List([123])): XYPointRecord); diff --git a/type-definitions/immutable.d.ts b/type-definitions/immutable.d.ts new file mode 100644 index 0000000000..b545b80f96 --- /dev/null +++ b/type-definitions/immutable.d.ts @@ -0,0 +1,5126 @@ +/** @ignore we should disable this rules, but let's activate it to enable eslint first */ +/** + * Immutable data encourages pure functions (data-in, data-out) and lends itself + * to much simpler application development and enabling techniques from + * functional programming such as lazy evaluation. + * + * While designed to bring these powerful functional concepts to JavaScript, it + * presents an Object-Oriented API familiar to Javascript engineers and closely + * mirroring that of Array, Map, and Set. It is easy and efficient to convert to + * and from plain Javascript types. + * + * ## How to read these docs + * + * In order to better explain what kinds of values the Immutable.js API expects + * and produces, this documentation is presented in a statically typed dialect of + * JavaScript (like [Flow][] or [TypeScript][]). You *don't need* to use these + * type checking tools in order to use Immutable.js, however becoming familiar + * with their syntax will help you get a deeper understanding of this API. + * + * **A few examples and how to read them.** + * + * All methods describe the kinds of data they accept and the kinds of data + * they return. For example a function which accepts two numbers and returns + * a number would look like this: + * + * ```js + * sum(first: number, second: number): number + * ``` + * + * Sometimes, methods can accept different kinds of data or return different + * kinds of data, and this is described with a *type variable*, which is + * typically in all-caps. For example, a function which always returns the same + * kind of data it was provided would look like this: + * + * ```js + * identity(value: T): T + * ``` + * + * Type variables are defined with classes and referred to in methods. For + * example, a class that holds onto a value for you might look like this: + * + * ```js + * class Box { + * constructor(value: T) + * getValue(): T + * } + * ``` + * + * In order to manipulate Immutable data, methods that we're used to affecting + * a Collection instead return a new Collection of the same type. The type + * `this` refers to the same kind of class. For example, a List which returns + * new Lists when you `push` a value onto it might look like: + * + * ```js + * class List { + * push(value: T): this + * } + * ``` + * + * Many methods in Immutable.js accept values which implement the JavaScript + * [Iterable][] protocol, and might appear like `Iterable` for something + * which represents sequence of strings. Typically in JavaScript we use plain + * Arrays (`[]`) when an Iterable is expected, but also all of the Immutable.js + * collections are iterable themselves! + * + * For example, to get a value deep within a structure of data, we might use + * `getIn` which expects an `Iterable` path: + * + * ``` + * getIn(path: Iterable): unknown + * ``` + * + * To use this method, we could pass an array: `data.getIn([ "key", 2 ])`. + * + * + * Note: All examples are presented in the modern [ES2015][] version of + * JavaScript. Use tools like Babel to support older browsers. + * + * For example: + * + * ```js + * // ES2015 + * const mappedFoo = foo.map(x => x * x); + * // ES5 + * var mappedFoo = foo.map(function (x) { return x * x; }); + * ``` + * + * [ES2015]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla + * [TypeScript]: https://www.typescriptlang.org/ + * [Flow]: https://flowtype.org/ + * [Iterable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols + */ + +declare namespace Immutable { + /** @ignore */ + type OnlyObject = Extract; + + /** @ignore */ + type ContainObject = + OnlyObject extends object + ? OnlyObject extends never + ? false + : true + : false; + + /** + * @ignore + * + * Used to convert deeply all immutable types to a plain TS type. + * Using `unknown` on object instead of recursive call as we have a circular reference issue + */ + export type DeepCopy = + T extends Record + ? // convert Record to DeepCopy plain JS object + { + [key in keyof R]: ContainObject extends true + ? unknown + : R[key]; + } + : T extends MapOf + ? // convert MapOf to DeepCopy plain JS object + { + [key in keyof R]: ContainObject extends true + ? unknown + : R[key]; + } + : T extends Collection.Keyed + ? // convert KeyedCollection to DeepCopy plain JS object + { + [key in KeyedKey extends PropertyKey + ? KeyedKey + : string]: V extends object ? unknown : V; + } + : // convert IndexedCollection or Immutable.Set to DeepCopy plain JS array + // eslint-disable-next-line @typescript-eslint/no-unused-vars + T extends Collection + ? Array> + : T extends string | number // Iterable scalar types : should be kept as is + ? T + : T extends Iterable // Iterable are converted to plain JS array + ? Array> + : T extends object // plain JS object are converted deeply + ? { + [ObjectKey in keyof T]: ContainObject< + T[ObjectKey] + > extends true + ? unknown + : T[ObjectKey]; + } + : // other case : should be kept as is + T; + + /** + * Describes which item in a pair should be placed first when sorting + * + * @ignore + */ + export enum PairSorting { + LeftThenRight = -1, + RightThenLeft = +1, + } + + /** + * Function comparing two items of the same type. It can return: + * + * * a PairSorting value, to indicate whether the left-hand item or the right-hand item should be placed before the other + * + * * the traditional numeric return value - especially -1, 0, or 1 + * + * @ignore + */ + export type Comparator = (left: T, right: T) => PairSorting | number; + + /** + * @ignore + * + * KeyPath allowed for `xxxIn` methods + */ + export type KeyPath = OrderedCollection | ArrayLike; + + /** + * Lists are ordered indexed dense collections, much like a JavaScript + * Array. + * + * Lists are immutable and fully persistent with O(log32 N) gets and sets, + * and O(1) push and pop. + * + * Lists implement Deque, with efficient addition and removal from both the + * end (`push`, `pop`) and beginning (`unshift`, `shift`). + * + * Unlike a JavaScript Array, there is no distinction between an + * "unset" index and an index set to `undefined`. `List#forEach` visits all + * indices from 0 to size, regardless of whether they were explicitly defined. + */ + namespace List { + /** + * True if the provided value is a List + */ + function isList(maybeList: unknown): maybeList is List; + + /** + * Creates a new List containing `values`. + * + * Note: Values are not altered or converted in any way. + */ + function of(...values: Array): List; + } + + /** + * Create a new immutable List containing the values of the provided + * collection-like. + * + * Note: `List` is a factory function and not a class, and does not use the + * `new` keyword during construction. + */ + function List(collection?: Iterable | ArrayLike): List; + + interface List extends Collection.Indexed { + /** + * The number of items in this List. + */ + readonly size: number; + + // Persistent changes + + /** + * Returns a new List which includes `value` at `index`. If `index` already + * exists in this List, it will be replaced. + * + * `index` may be a negative number, which indexes back from the end of the + * List. `v.set(-1, "value")` sets the last item in the List. + * + * If `index` larger than `size`, the returned List's `size` will be large + * enough to include the `index`. + * + * Note: `set` can be used in `withMutations`. + */ + set(index: number, value: T): List; + + /** + * Returns a new List which excludes this `index` and with a size 1 less + * than this List. Values at indices above `index` are shifted down by 1 to + * fill the position. + * + * This is synonymous with `list.splice(index, 1)`. + * + * `index` may be a negative number, which indexes back from the end of the + * List. `v.delete(-1)` deletes the last item in the List. + * + * Note: `delete` cannot be safely used in IE8 + * + * Since `delete()` re-indexes values, it produces a complete copy, which + * has `O(N)` complexity. + * + * Note: `delete` *cannot* be used in `withMutations`. + * + * @alias remove + */ + delete(index: number): List; + remove(index: number): List; + + /** + * Returns a new List with `value` at `index` with a size 1 more than this + * List. Values at indices above `index` are shifted over by 1. + * + * This is synonymous with `list.splice(index, 0, value)`. + * + * Since `insert()` re-indexes values, it produces a complete copy, which + * has `O(N)` complexity. + * + * Note: `insert` *cannot* be used in `withMutations`. + */ + insert(index: number, value: T): List; + + /** + * Returns a new List with 0 size and no values in constant time. + * + * Note: `clear` can be used in `withMutations`. + */ + clear(): List; + + /** + * Returns a new List with the provided `values` appended, starting at this + * List's `size`. + * + * Note: `push` can be used in `withMutations`. + */ + push(...values: Array): List; + + /** + * Returns a new List with a size ones less than this List, excluding + * the last index in this List. + * + * Note: this differs from `Array#pop` because it returns a new + * List rather than the removed value. Use `last()` to get the last value + * in this List. + * + * ```js + * List([ 1, 2, 3, 4 ]).pop() + * // List[ 1, 2, 3 ] + * ``` + * + * Note: `pop` can be used in `withMutations`. + */ + pop(): List; + + /** + * Returns a new List with the provided `values` prepended, shifting other + * values ahead to higher indices. + * + * Note: `unshift` can be used in `withMutations`. + */ + unshift(...values: Array): List; + + /** + * Returns a new List with a size ones less than this List, excluding + * the first index in this List, shifting all other values to a lower index. + * + * Note: this differs from `Array#shift` because it returns a new + * List rather than the removed value. Use `first()` to get the first + * value in this List. + * + * Note: `shift` can be used in `withMutations`. + */ + shift(): List; + + /** + * Returns a new List with an updated value at `index` with the return + * value of calling `updater` with the existing value, or `notSetValue` if + * `index` was not set. If called with a single argument, `updater` is + * called with the List itself. + * + * `index` may be a negative number, which indexes back from the end of the + * List. `v.update(-1)` updates the last item in the List. + * + * This can be very useful as a way to "chain" a normal function into a + * sequence of methods. RxJS calls this "let" and lodash calls it "thru". + * + * For example, to sum a List after mapping and filtering: + * + * Note: `update(index)` can be used in `withMutations`. + * + * @see `Map#update` + */ + update(index: number, notSetValue: T, updater: (value: T) => T): this; + update( + index: number, + updater: (value: T | undefined) => T | undefined + ): this; + update(updater: (value: this) => R): R; + + /** + * Returns a new List with size `size`. If `size` is less than this + * List's size, the new List will exclude values at the higher indices. + * If `size` is greater than this List's size, the new List will have + * undefined values for the newly available indices. + * + * When building a new List and the final size is known up front, `setSize` + * used in conjunction with `withMutations` may result in the more + * performant construction. + */ + setSize(size: number): List; + + // Deep persistent changes + + /** + * Returns a new List having set `value` at this `keyPath`. If any keys in + * `keyPath` do not exist, a new immutable Map will be created at that key. + * + * Index numbers are used as keys to determine the path to follow in + * the List. + * + * Plain JavaScript Object or Arrays may be nested within an Immutable.js + * Collection, and setIn() can update those values as well, treating them + * immutably by creating new copies of those values with the changes applied. + * + * Note: `setIn` can be used in `withMutations`. + */ + setIn(keyPath: Iterable, value: unknown): this; + + /** + * Returns a new List having removed the value at this `keyPath`. If any + * keys in `keyPath` do not exist, no change will occur. + * + * Plain JavaScript Object or Arrays may be nested within an Immutable.js + * Collection, and removeIn() can update those values as well, treating them + * immutably by creating new copies of those values with the changes applied. + * + * Note: `deleteIn` *cannot* be safely used in `withMutations`. + * + * @alias removeIn + */ + deleteIn(keyPath: Iterable): this; + removeIn(keyPath: Iterable): this; + + /** + * Note: `updateIn` can be used in `withMutations`. + * + * @see `Map#updateIn` + */ + updateIn( + keyPath: Iterable, + notSetValue: unknown, + updater: (value: unknown) => unknown + ): this; + updateIn( + keyPath: Iterable, + updater: (value: unknown) => unknown + ): this; + + /** + * Note: `mergeIn` can be used in `withMutations`. + * + * @see `Map#mergeIn` + */ + mergeIn(keyPath: Iterable, ...collections: Array): this; + + /** + * Note: `mergeDeepIn` can be used in `withMutations`. + * + * @see `Map#mergeDeepIn` + */ + mergeDeepIn( + keyPath: Iterable, + ...collections: Array + ): this; + + // Transient changes + + /** + * Note: Not all methods can be safely used on a mutable collection or within + * `withMutations`! Check the documentation for each method to see if it + * allows being used in `withMutations`. + * + * @see `Map#withMutations` + */ + withMutations(mutator: (mutable: this) => unknown): this; + + /** + * An alternative API for withMutations() + * + * Note: Not all methods can be safely used on a mutable collection or within + * `withMutations`! Check the documentation for each method to see if it + * allows being used in `withMutations`. + * + * @see `Map#asMutable` + */ + asMutable(): this; + + /** + * @see `Map#wasAltered` + */ + wasAltered(): boolean; + + /** + * @see `Map#asImmutable` + */ + asImmutable(): this; + + // Sequence algorithms + + /** + * Returns a new List with other values or collections concatenated to this one. + * + * Note: `concat` can be used in `withMutations`. + * + * @alias merge + */ + concat(...valuesOrCollections: Array | C>): List; + merge(...collections: Array>): List; + + /** + * Returns a new List with values passed through a + * `mapper` function. + */ + map( + mapper: (value: T, key: number, iter: this) => M, + context?: unknown + ): List; + + /** + * Flat-maps the List, returning a new List. + * + * Similar to `list.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: T, key: number, iter: this) => Iterable, + context?: unknown + ): List; + + /** + * Returns a new List with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: T, index: number, iter: this) => value is F, + context?: unknown + ): List; + filter( + predicate: (value: T, index: number, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new List with the values for which the `predicate` + * function returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: T, index: number, iter: this) => value is F, + context?: C + ): [List, List]; + partition( + predicate: (this: C, value: T, index: number, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * Returns a List "zipped" with the provided collection. + * + * Like `zipWith`, but using the default `zipper`: creating an `Array`. + */ + zip(other: Collection): List<[T, U]>; + zip( + other: Collection, + other2: Collection + ): List<[T, U, V]>; + zip(...collections: Array>): List; + + /** + * Returns a List "zipped" with the provided collections. + * + * Unlike `zip`, `zipAll` continues zipping until the longest collection is + * exhausted. Missing values from shorter collections are filled with `undefined`. + * + * Note: Since zipAll will return a collection as large as the largest + * input, some results may contain undefined values. TypeScript cannot + * account for these without cases (as of v2.5). + */ + zipAll(other: Collection): List<[T, U]>; + zipAll( + other: Collection, + other2: Collection + ): List<[T, U, V]>; + zipAll(...collections: Array>): List; + + /** + * Returns a List "zipped" with the provided collections by using a + * custom `zipper` function. + */ + zipWith( + zipper: (value: T, otherValue: U) => Z, + otherCollection: Collection + ): List; + zipWith( + zipper: (value: T, otherValue: U, thirdValue: V) => Z, + otherCollection: Collection, + thirdCollection: Collection + ): List; + zipWith( + zipper: (...values: Array) => Z, + ...collections: Array> + ): List; + + /** + * Returns a new List with its values shuffled thanks to the + * [Fisher–Yates](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) + * algorithm. + * It uses Math.random, but you can provide your own random number generator. + */ + shuffle(random?: () => number): this; + } + + /** + * Immutable Map is an unordered Collection.Keyed of (key, value) pairs with + * `O(log32 N)` gets and `O(log32 N)` persistent sets. + * + * Iteration order of a Map is undefined, however is stable. Multiple + * iterations of the same Map will iterate in the same order. + * + * Map's keys can be of any type, and use `Immutable.is` to determine key + * equality. This allows the use of any value (including NaN) as a key. + * + * Because `Immutable.is` returns equality based on value semantics, and + * Immutable collections are treated as values, any Immutable collection may + * be used as a key. + * + * Any JavaScript object may be used as a key, however strict identity is used + * to evaluate key equality. Two similar looking objects will represent two + * different keys. + * + * Implemented by a hash-array mapped trie. + */ + namespace Map { + /** + * True if the provided value is a Map + */ + function isMap(maybeMap: unknown): maybeMap is Map; + } + + /** + * Creates a new Immutable Map. + * + * Created with the same key value pairs as the provided Collection.Keyed or + * JavaScript Object or expects a Collection of [K, V] tuple entries. + * + * Note: `Map` is a factory function and not a class, and does not use the + * `new` keyword during construction. + * + * Keep in mind, when using JS objects to construct Immutable Maps, that + * JavaScript Object properties are always strings, even if written in a + * quote-less shorthand, while Immutable Maps accept keys of any type. + * + * Property access for JavaScript Objects first converts the key to a string, + * but since Immutable Map keys can be of any type the argument to `get()` is + * not altered. + */ + function Map(collection?: Iterable<[K, V]>): Map; + function Map(obj: R): MapOf; + function Map(obj: { [key: string]: V }): Map; + function Map(obj: { [P in K]?: V }): Map; + + /** + * Represent a Map constructed by an object + * + * @ignore + */ + interface MapOf + extends Map { + /** + * Returns the value associated with the provided key, or notSetValue if + * the Collection does not contain this key. + * + * Note: it is possible a key may be associated with an `undefined` value, + * so if `notSetValue` is not provided and this method returns `undefined`, + * that does not guarantee the key was not found. + */ + get(key: K, notSetValue?: unknown): R[K]; + get(key: unknown, notSetValue: NSV): NSV; + + // TODO `` can be used after dropping support for TypeScript 4.x + // reference: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#const-type-parameters + // after this change, `as const` assertions can be remove from the type tests + getIn

>( + searchKeyPath: [...P], + notSetValue?: unknown + ): RetrievePath; + + set(key: K, value: R[K]): this; + + update(updater: (value: this) => this): this; + update(key: K, updater: (value: R[K]) => R[K]): this; + update( + key: K, + notSetValue: NSV, + updater: (value: R[K]) => R[K] + ): this; + + // Possible best type is MapOf> but Omit seems to broke other function calls + // and generate recursion error with other methods (update, merge, etc.) until those functions are defined in MapOf + delete( + key: K + ): Extract extends never ? never : this; + remove( + key: K + ): Extract extends never ? never : this; + + toJS(): { [K in keyof R]: DeepCopy }; + + toJSON(): { [K in keyof R]: R[K] }; + } + + // Loosely based off of this work. + // https://github.com/immutable-js/immutable-js/issues/1462#issuecomment-584123268 + + /** + * @ignore + * Convert an immutable type to the equivalent plain TS type + * - MapOf -> object + * - List -> Array + */ + type GetNativeType = + S extends MapOf ? T : S extends List ? Array : S; + + /** @ignore */ + type Head> = T extends [ + infer H, + ...Array, + ] + ? H + : never; + /** @ignore */ + type Tail> = T extends [unknown, ...infer I] + ? I + : Array; + /** @ignore */ + type RetrievePathReducer< + T, + C, + L extends ReadonlyArray, + NT = GetNativeType, + > = + // we can not retrieve a path from a primitive type + T extends string | number | boolean | null | undefined + ? never + : C extends keyof NT + ? L extends [] // L extends [] means we are at the end of the path, lets return the current type + ? NT[C] + : // we are not at the end of the path, lets continue with the next key + RetrievePathReducer, Tail> + : // C is not a "key" of NT, so the path is invalid + never; + + /** @ignore */ + type RetrievePath> = P extends [] + ? P + : RetrievePathReducer, Tail

>; + + interface Map extends Collection.Keyed { + /** + * The number of entries in this Map. + */ + readonly size: number; + + // Persistent changes + + /** + * Returns a new Map also containing the new key, value pair. If an equivalent + * key already exists in this Map, it will be replaced. + * + * Note: `set` can be used in `withMutations`. + */ + set(key: K, value: V): this; + + /** + * Returns a new Map which excludes this `key`. + * + * Note: `delete` cannot be safely used in IE8, but is provided to mirror + * the ES6 collection API. + * + * Note: `delete` can be used in `withMutations`. + * + * @alias remove + */ + delete(key: K): this; + remove(key: K): this; + + /** + * Returns a new Map which excludes the provided `keys`. + * + * Note: `deleteAll` can be used in `withMutations`. + * + * @alias removeAll + */ + deleteAll(keys: Iterable): this; + removeAll(keys: Iterable): this; + + /** + * Returns a new Map containing no keys or values. + * + * Note: `clear` can be used in `withMutations`. + */ + clear(): this; + + /** + * Returns a new Map having updated the value at this `key` with the return + * value of calling `updater` with the existing value. + * + * Similar to: `map.set(key, updater(map.get(key)))`. + * + * This is most commonly used to call methods on collections within a + * structure of data. For example, in order to `.push()` onto a nested `List`, + * `update` and `push` can be used together: + * + * When a `notSetValue` is provided, it is provided to the `updater` + * function when the value at the key does not exist in the Map. + * + * However, if the `updater` function returns the same value it was called + * with, then no change will occur. This is still true if `notSetValue` + * is provided. + * + * For code using ES2015 or later, using `notSetValue` is discourged in + * favor of function parameter default values. This helps to avoid any + * potential confusion with identify functions as described above. + * + * The previous example behaves differently when written with default values: + * + * If no key is provided, then the `updater` function return value is + * returned as well. + * + * This can be very useful as a way to "chain" a normal function into a + * sequence of methods. RxJS calls this "let" and lodash calls it "thru". + * + * For example, to sum the values in a Map + * + * Note: `update(key)` can be used in `withMutations`. + */ + update(key: K, notSetValue: V, updater: (value: V) => V): this; + update(key: K, updater: (value: V | undefined) => V | undefined): this; + update(updater: (value: this) => R): R; + + /** + * Returns a new Map resulting from merging the provided Collections + * (or JS objects) into this Map. In other words, this takes each entry of + * each collection and sets it on this Map. + * + * Note: Values provided to `merge` are shallowly converted before being + * merged. No nested values are altered. + * ``` + * + * Note: `merge` can be used in `withMutations`. + * + * @alias concat + */ + merge( + ...collections: Array> + ): Map | VC>; + merge( + ...collections: Array<{ [key: string]: C }> + ): Map | C>; + + concat( + ...collections: Array> + ): Map | VC>; + concat( + ...collections: Array<{ [key: string]: C }> + ): Map | C>; + + /** + * Like `merge()`, `mergeWith()` returns a new Map resulting from merging + * the provided Collections (or JS objects) into this Map, but uses the + * `merger` function for dealing with conflicts. + * + * Note: `mergeWith` can be used in `withMutations`. + */ + mergeWith( + merger: (oldVal: V, newVal: VC, key: K) => VCC, + ...collections: Array> + ): Map; + mergeWith( + merger: (oldVal: V, newVal: C, key: string) => CC, + ...collections: Array<{ [key: string]: C }> + ): Map; + + /** + * Like `merge()`, but when two compatible collections are encountered with + * the same key, it merges them as well, recursing deeply through the nested + * data. Two collections are considered to be compatible (and thus will be + * merged together) if they both fall into one of three categories: keyed + * (e.g., `Map`s, `Record`s, and objects), indexed (e.g., `List`s and + * arrays), or set-like (e.g., `Set`s). If they fall into separate + * categories, `mergeDeep` will replace the existing collection with the + * collection being merged in. This behavior can be customized by using + * `mergeDeepWith()`. + * + * Note: Indexed and set-like collections are merged using + * `concat()`/`union()` and therefore do not recurse. + * + * Note: `mergeDeep` can be used in `withMutations`. + */ + mergeDeep( + ...collections: Array> + ): Map; + mergeDeep( + ...collections: Array<{ [key: string]: C }> + ): Map; + + /** + * Like `mergeDeep()`, but when two non-collections or incompatible + * collections are encountered at the same key, it uses the `merger` + * function to determine the resulting value. Collections are considered + * incompatible if they fall into separate categories between keyed, + * indexed, and set-like. + * + * Note: `mergeDeepWith` can be used in `withMutations`. + */ + mergeDeepWith( + merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown, + ...collections: Array | { [key: string]: V }> + ): this; + + // Deep persistent changes + + /** + * Returns a new Map having set `value` at this `keyPath`. If any keys in + * `keyPath` do not exist, a new immutable Map will be created at that key. + * + * Plain JavaScript Object or Arrays may be nested within an Immutable.js + * Collection, and setIn() can update those values as well, treating them + * immutably by creating new copies of those values with the changes applied. + * + * If any key in the path exists but cannot be updated (such as a primitive + * like number or a custom Object like Date), an error will be thrown. + * + * Note: `setIn` can be used in `withMutations`. + */ + setIn(keyPath: Iterable, value: unknown): this; + + /** + * Returns a new Map having removed the value at this `keyPath`. If any keys + * in `keyPath` do not exist, no change will occur. + * + * Note: `deleteIn` can be used in `withMutations`. + * + * @alias removeIn + */ + deleteIn(keyPath: Iterable): this; + removeIn(keyPath: Iterable): this; + + /** + * Returns a new Map having applied the `updater` to the entry found at the + * keyPath. + * + * This is most commonly used to call methods on collections nested within a + * structure of data. For example, in order to `.push()` onto a nested `List`, + * `updateIn` and `push` can be used together: + + * + * If any keys in `keyPath` do not exist, new Immutable `Map`s will + * be created at those keys. If the `keyPath` does not already contain a + * value, the `updater` function will be called with `notSetValue`, if + * provided, otherwise `undefined`. + * + * If the `updater` function returns the same value it was called with, then + * no change will occur. This is still true if `notSetValue` is provided. + * + * For code using ES2015 or later, using `notSetValue` is discourged in + * favor of function parameter default values. This helps to avoid any + * potential confusion with identify functions as described above. + * + * The previous example behaves differently when written with default values: + * + * Plain JavaScript Object or Arrays may be nested within an Immutable.js + * Collection, and updateIn() can update those values as well, treating them + * immutably by creating new copies of those values with the changes applied. + * + * If any key in the path exists but cannot be updated (such as a primitive + * like number or a custom Object like Date), an error will be thrown. + * + * Note: `updateIn` can be used in `withMutations`. + */ + updateIn( + keyPath: Iterable, + notSetValue: unknown, + updater: (value: unknown) => unknown + ): this; + updateIn( + keyPath: Iterable, + updater: (value: unknown) => unknown + ): this; + + /** + * A combination of `updateIn` and `merge`, returning a new Map, but + * performing the merge at a point arrived at by following the keyPath. + * In other words, these two lines are equivalent: + * + * ```js + * map.updateIn(['a', 'b', 'c'], abc => abc.merge(y)) + * map.mergeIn(['a', 'b', 'c'], y) + * ``` + * + * Note: `mergeIn` can be used in `withMutations`. + */ + mergeIn(keyPath: Iterable, ...collections: Array): this; + + /** + * A combination of `updateIn` and `mergeDeep`, returning a new Map, but + * performing the deep merge at a point arrived at by following the keyPath. + * In other words, these two lines are equivalent: + * + * ```js + * map.updateIn(['a', 'b', 'c'], abc => abc.mergeDeep(y)) + * map.mergeDeepIn(['a', 'b', 'c'], y) + * ``` + * + * Note: `mergeDeepIn` can be used in `withMutations`. + */ + mergeDeepIn( + keyPath: Iterable, + ...collections: Array + ): this; + + // Transient changes + + /** + * Every time you call one of the above functions, a new immutable Map is + * created. If a pure function calls a number of these to produce a final + * return value, then a penalty on performance and memory has been paid by + * creating all of the intermediate immutable Maps. + * + * If you need to apply a series of mutations to produce a new immutable + * Map, `withMutations()` creates a temporary mutable copy of the Map which + * can apply mutations in a highly performant manner. In fact, this is + * exactly how complex mutations like `merge` are done. + * + * As an example, this results in the creation of 2, not 4, new Maps: + * + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Read the documentation for each method to see if it + * is safe to use in `withMutations`. + */ + withMutations(mutator: (mutable: this) => unknown): this; + + /** + * Another way to avoid creation of intermediate Immutable maps is to create + * a mutable copy of this collection. Mutable copies *always* return `this`, + * and thus shouldn't be used for equality. Your function should never return + * a mutable copy of a collection, only use it internally to create a new + * collection. + * + * If possible, use `withMutations` to work with temporary mutable copies as + * it provides an easier to use API and considers many common optimizations. + * + * Note: if the collection is already mutable, `asMutable` returns itself. + * + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Read the documentation for each method to see if it + * is safe to use in `withMutations`. + * + * @see `Map#asImmutable` + */ + asMutable(): this; + + /** + * Returns true if this is a mutable copy (see `asMutable()`) and mutative + * alterations have been applied. + * + * @see `Map#asMutable` + */ + wasAltered(): boolean; + + /** + * The yin to `asMutable`'s yang. Because it applies to mutable collections, + * this operation is *mutable* and may return itself (though may not + * return itself, i.e. if the result is an empty collection). Once + * performed, the original mutable copy must no longer be mutated since it + * may be the immutable result. + * + * If possible, use `withMutations` to work with temporary mutable copies as + * it provides an easier to use API and considers many common optimizations. + * + * @see `Map#asMutable` + */ + asImmutable(): this; + + // Sequence algorithms + + /** + * Returns a new Map with values passed through a + * `mapper` function. + * + * Map({ a: 1, b: 2 }).map(x => 10 * x) + * // Map { a: 10, b: 20 } + */ + map( + mapper: (value: V, key: K, iter: this) => M, + context?: unknown + ): Map; + + /** + * @see Collection.Keyed.mapKeys + */ + mapKeys( + mapper: (key: K, value: V, iter: this) => M, + context?: unknown + ): Map; + + /** + * @see Collection.Keyed.mapEntries + */ + mapEntries( + mapper: ( + entry: [K, V], + index: number, + iter: this + ) => [KM, VM] | undefined, + context?: unknown + ): Map; + + /** + * Flat-maps the Map, returning a new Map. + * + * Similar to `data.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, + context?: unknown + ): Map; + + /** + * Returns a new Map with only the entries for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: V, key: K, iter: this) => value is F, + context?: unknown + ): Map; + filter( + predicate: (value: V, key: K, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new Map with the values for which the `predicate` + * function returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: V, key: K, iter: this) => value is F, + context?: C + ): [Map, Map]; + partition( + predicate: (this: C, value: V, key: K, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * @see Collection.Keyed.flip + */ + flip(): Map; + + /** + * Returns an OrderedMap of the same type which includes the same entries, + * stably sorted by using a `comparator`. + * + * If a `comparator` is not provided, a default comparator uses `<` and `>`. + * + * `comparator(valueA, valueB)`: + * + * * Returns `0` if the elements should not be swapped. + * * Returns `-1` (or any negative number) if `valueA` comes before `valueB` + * * Returns `1` (or any positive number) if `valueA` comes after `valueB` + * * Alternatively, can return a value of the `PairSorting` enum type + * * Is pure, i.e. it must always return the same value for the same pair + * of values. + * + * Note: `sort()` Always returns a new instance, even if the original was + * already sorted. + * + * Note: This is always an eager operation. + */ + sort(comparator?: Comparator): this & OrderedMap; + + /** + * Like `sort`, but also accepts a `comparatorValueMapper` which allows for + * sorting by more sophisticated means: + * + * Note: `sortBy()` Always returns a new instance, even if the original was + * already sorted. + * + * Note: This is always an eager operation. + */ + sortBy( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: (valueA: C, valueB: C) => number + ): this & OrderedMap; + } + + /** + * A type of Map that has the additional guarantee that the iteration order of + * entries will be the order in which they were set(). + * + * The iteration behavior of OrderedMap is the same as native ES6 Map and + * JavaScript Object. + * + * Note that `OrderedMap` are more expensive than non-ordered `Map` and may + * consume more memory. `OrderedMap#set` is amortized O(log32 N), but not + * stable. + */ + namespace OrderedMap { + /** + * True if the provided value is an OrderedMap. + */ + function isOrderedMap( + maybeOrderedMap: unknown + ): maybeOrderedMap is OrderedMap; + } + + /** + * Creates a new Immutable OrderedMap. + * + * Created with the same key value pairs as the provided Collection.Keyed or + * JavaScript Object or expects a Collection of [K, V] tuple entries. + * + * The iteration order of key-value pairs provided to this constructor will + * be preserved in the OrderedMap. + * + * let newOrderedMap = OrderedMap({key: "value"}) + * let newOrderedMap = OrderedMap([["key", "value"]]) + * + * Note: `OrderedMap` is a factory function and not a class, and does not use + * the `new` keyword during construction. + */ + function OrderedMap(collection?: Iterable<[K, V]>): OrderedMap; + function OrderedMap(obj: { [key: string]: V }): OrderedMap; + + interface OrderedMap extends Map, OrderedCollection<[K, V]> { + /** + * The number of entries in this OrderedMap. + */ + readonly size: number; + + /** + * Returns a new OrderedMap also containing the new key, value pair. If an + * equivalent key already exists in this OrderedMap, it will be replaced + * while maintaining the existing order. + * + * Note: `set` can be used in `withMutations`. + */ + set(key: K, value: V): this; + + /** + * Returns a new OrderedMap resulting from merging the provided Collections + * (or JS objects) into this OrderedMap. In other words, this takes each + * entry of each collection and sets it on this OrderedMap. + * + * Note: Values provided to `merge` are shallowly converted before being + * merged. No nested values are altered. + * + * Note: `merge` can be used in `withMutations`. + * + * @alias concat + */ + merge( + ...collections: Array> + ): OrderedMap | VC>; + merge( + ...collections: Array<{ [key: string]: C }> + ): OrderedMap | C>; + + concat( + ...collections: Array> + ): OrderedMap | VC>; + concat( + ...collections: Array<{ [key: string]: C }> + ): OrderedMap | C>; + + mergeWith( + merger: (oldVal: V, newVal: VC, key: K) => VCC, + ...collections: Array> + ): OrderedMap; + mergeWith( + merger: (oldVal: V, newVal: C, key: string) => CC, + ...collections: Array<{ [key: string]: C }> + ): OrderedMap; + + mergeDeep( + ...collections: Array> + ): OrderedMap; + mergeDeep( + ...collections: Array<{ [key: string]: C }> + ): OrderedMap; + + // Sequence algorithms + + /** + * Returns a new OrderedMap with values passed through a + * `mapper` function. + * + * OrderedMap({ a: 1, b: 2 }).map(x => 10 * x) + * // OrderedMap { "a": 10, "b": 20 } + * + * Note: `map()` always returns a new instance, even if it produced the same + * value at every step. + */ + map( + mapper: (value: V, key: K, iter: this) => M, + context?: unknown + ): OrderedMap; + + /** + * @see Collection.Keyed.mapKeys + */ + mapKeys( + mapper: (key: K, value: V, iter: this) => M, + context?: unknown + ): OrderedMap; + + /** + * @see Collection.Keyed.mapEntries + */ + mapEntries( + mapper: ( + entry: [K, V], + index: number, + iter: this + ) => [KM, VM] | undefined, + context?: unknown + ): OrderedMap; + + /** + * Flat-maps the OrderedMap, returning a new OrderedMap. + * + * Similar to `data.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, + context?: unknown + ): OrderedMap; + + /** + * Returns a new OrderedMap with only the entries for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: V, key: K, iter: this) => value is F, + context?: unknown + ): OrderedMap; + filter( + predicate: (value: V, key: K, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new OrderedMap with the values for which the `predicate` + * function returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: V, key: K, iter: this) => value is F, + context?: C + ): [OrderedMap, OrderedMap]; + partition( + predicate: (this: C, value: V, key: K, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * @see Collection.Keyed.flip + */ + flip(): OrderedMap; + } + + /** + * A Collection of unique values with `O(log32 N)` adds and has. + * + * When iterating a Set, the entries will be (value, value) pairs. Iteration + * order of a Set is undefined, however is stable. Multiple iterations of the + * same Set will iterate in the same order. + * + * Set values, like Map keys, may be of any type. Equality is determined using + * `Immutable.is`, enabling Sets to uniquely include other Immutable + * collections, custom value types, and NaN. + */ + namespace Set { + /** + * True if the provided value is a Set + */ + function isSet(maybeSet: unknown): maybeSet is Set; + + /** + * Creates a new Set containing `values`. + */ + function of(...values: Array): Set; + + /** + * `Set.fromKeys()` creates a new immutable Set containing the keys from + * this Collection or JavaScript Object. + */ + function fromKeys(iter: Collection.Keyed): Set; + function fromKeys(iter: Collection): Set; + function fromKeys(obj: { [key: string]: unknown }): Set; + + /** + * `Set.intersect()` creates a new immutable Set that is the intersection of + * a collection of other sets. + * + * ```js + * const { Set } = require('immutable') + * const intersected = Set.intersect([ + * Set([ 'a', 'b', 'c' ]) + * Set([ 'c', 'a', 't' ]) + * ]) + * // Set [ "a", "c" ] + * ``` + */ + function intersect(sets: Iterable>): Set; + + /** + * `Set.union()` creates a new immutable Set that is the union of a + * collection of other sets. + * + * ```js + * const { Set } = require('immutable') + * const unioned = Set.union([ + * Set([ 'a', 'b', 'c' ]) + * Set([ 'c', 'a', 't' ]) + * ]) + * // Set [ "a", "b", "c", "t" ] + * ``` + */ + function union(sets: Iterable>): Set; + } + + /** + * Create a new immutable Set containing the values of the provided + * collection-like. + * + * Note: `Set` is a factory function and not a class, and does not use the + * `new` keyword during construction. + */ + function Set(collection?: Iterable | ArrayLike): Set; + + interface Set extends Collection.Set { + /** + * The number of items in this Set. + */ + readonly size: number; + + // Persistent changes + + /** + * Returns a new Set which also includes this value. + * + * Note: `add` can be used in `withMutations`. + */ + add(value: T): this; + + /** + * Returns a new Set which excludes this value. + * + * Note: `delete` can be used in `withMutations`. + * + * Note: `delete` **cannot** be safely used in IE8, use `remove` if + * supporting old browsers. + * + * @alias remove + */ + delete(value: T): this; + remove(value: T): this; + + /** + * Returns a new Set containing no values. + * + * Note: `clear` can be used in `withMutations`. + */ + clear(): this; + + /** + * Returns a Set including any value from `collections` that does not already + * exist in this Set. + * + * Note: `union` can be used in `withMutations`. + * @alias merge + * @alias concat + */ + union(...collections: Array>): Set; + merge(...collections: Array>): Set; + concat(...collections: Array>): Set; + + /** + * Returns a Set which has removed any values not also contained + * within `collections`. + * + * Note: `intersect` can be used in `withMutations`. + */ + intersect(...collections: Array>): this; + + /** + * Returns a Set excluding any values contained within `collections`. + * + * Note: `subtract` can be used in `withMutations`. + */ + subtract(...collections: Array>): this; + + // Transient changes + + /** + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Check the documentation for each method to see if it + * mentions being safe to use in `withMutations`. + * + * @see `Map#withMutations` + */ + withMutations(mutator: (mutable: this) => unknown): this; + + /** + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Check the documentation for each method to see if it + * mentions being safe to use in `withMutations`. + * + * @see `Map#asMutable` + */ + asMutable(): this; + + /** + * @see `Map#wasAltered` + */ + wasAltered(): boolean; + + /** + * @see `Map#asImmutable` + */ + asImmutable(): this; + + // Sequence algorithms + + /** + * Returns a new Set with values passed through a + * `mapper` function. + * + * Set([1,2]).map(x => 10 * x) + * // Set [10,20] + */ + map( + mapper: (value: T, key: T, iter: this) => M, + context?: unknown + ): Set; + + /** + * Flat-maps the Set, returning a new Set. + * + * Similar to `set.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: T, key: T, iter: this) => Iterable, + context?: unknown + ): Set; + + /** + * Returns a new Set with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: T, key: T, iter: this) => value is F, + context?: unknown + ): Set; + filter( + predicate: (value: T, key: T, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new Set with the values for which the `predicate` function + * returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: T, key: T, iter: this) => value is F, + context?: C + ): [Set, Set]; + partition( + predicate: (this: C, value: T, key: T, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * Returns an OrderedSet of the same type which includes the same entries, + * stably sorted by using a `comparator`. + * + * If a `comparator` is not provided, a default comparator uses `<` and `>`. + * + * `comparator(valueA, valueB)`: + * + * * Returns `0` if the elements should not be swapped. + * * Returns `-1` (or any negative number) if `valueA` comes before `valueB` + * * Returns `1` (or any positive number) if `valueA` comes after `valueB` + * * Alternatively, can return a value of the `PairSorting` enum type + * * Is pure, i.e. it must always return the same value for the same pair + * of values. + * + * Note: `sort()` Always returns a new instance, even if the original was + * already sorted. + * + * Note: This is always an eager operation. + */ + sort(comparator?: Comparator): this & OrderedSet; + + /** + * Like `sort`, but also accepts a `comparatorValueMapper` which allows for + * sorting by more sophisticated means: + * + * Note: `sortBy()` Always returns a new instance, even if the original was + * already sorted. + * + * Note: This is always an eager operation. + */ + sortBy( + comparatorValueMapper: (value: T, key: T, iter: this) => C, + comparator?: (valueA: C, valueB: C) => number + ): this & OrderedSet; + } + + /** + * A type of Set that has the additional guarantee that the iteration order of + * values will be the order in which they were `add`ed. + * + * The iteration behavior of OrderedSet is the same as native ES6 Set. + * + * Note that `OrderedSet` are more expensive than non-ordered `Set` and may + * consume more memory. `OrderedSet#add` is amortized O(log32 N), but not + * stable. + */ + namespace OrderedSet { + /** + * True if the provided value is an OrderedSet. + */ + function isOrderedSet( + maybeOrderedSet: unknown + ): maybeOrderedSet is OrderedSet; + + /** + * Creates a new OrderedSet containing `values`. + */ + function of(...values: Array): OrderedSet; + + /** + * `OrderedSet.fromKeys()` creates a new immutable OrderedSet containing + * the keys from this Collection or JavaScript Object. + */ + function fromKeys(iter: Collection.Keyed): OrderedSet; + function fromKeys(iter: Collection): OrderedSet; + function fromKeys(obj: { [key: string]: unknown }): OrderedSet; + } + + /** + * Create a new immutable OrderedSet containing the values of the provided + * collection-like. + * + * Note: `OrderedSet` is a factory function and not a class, and does not use + * the `new` keyword during construction. + */ + function OrderedSet( + collection?: Iterable | ArrayLike + ): OrderedSet; + + interface OrderedSet extends Set, OrderedCollection { + /** + * The number of items in this OrderedSet. + */ + readonly size: number; + + /** + * Returns an OrderedSet including any value from `collections` that does + * not already exist in this OrderedSet. + * + * Note: `union` can be used in `withMutations`. + * @alias merge + * @alias concat + */ + union(...collections: Array>): OrderedSet; + merge(...collections: Array>): OrderedSet; + concat(...collections: Array>): OrderedSet; + + // Sequence algorithms + + /** + * Returns a new Set with values passed through a + * `mapper` function. + * + * OrderedSet([ 1, 2 ]).map(x => 10 * x) + * // OrderedSet [10, 20] + */ + map( + mapper: (value: T, key: T, iter: this) => M, + context?: unknown + ): OrderedSet; + + /** + * Flat-maps the OrderedSet, returning a new OrderedSet. + * + * Similar to `set.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: T, key: T, iter: this) => Iterable, + context?: unknown + ): OrderedSet; + + /** + * Returns a new OrderedSet with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: T, key: T, iter: this) => value is F, + context?: unknown + ): OrderedSet; + filter( + predicate: (value: T, key: T, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new OrderedSet with the values for which the `predicate` + * function returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: T, key: T, iter: this) => value is F, + context?: C + ): [OrderedSet, OrderedSet]; + partition( + predicate: (this: C, value: T, key: T, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * Returns an OrderedSet of the same type "zipped" with the provided + * collections. + * + * Like `zipWith`, but using the default `zipper`: creating an `Array`. + * + * ```js + * const a = OrderedSet([ 1, 2, 3 ]) + * const b = OrderedSet([ 4, 5, 6 ]) + * const c = a.zip(b) + * // OrderedSet [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] + * ``` + */ + zip(other: Collection): OrderedSet<[T, U]>; + zip( + other1: Collection, + other2: Collection + ): OrderedSet<[T, U, V]>; + zip( + ...collections: Array> + ): OrderedSet; + + /** + * Returns a OrderedSet of the same type "zipped" with the provided + * collections. + * + * Unlike `zip`, `zipAll` continues zipping until the longest collection is + * exhausted. Missing values from shorter collections are filled with `undefined`. + * + * ```js + * const a = OrderedSet([ 1, 2 ]); + * const b = OrderedSet([ 3, 4, 5 ]); + * const c = a.zipAll(b); // OrderedSet [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] + * ``` + * + * Note: Since zipAll will return a collection as large as the largest + * input, some results may contain undefined values. TypeScript cannot + * account for these without cases (as of v2.5). + */ + zipAll(other: Collection): OrderedSet<[T, U]>; + zipAll( + other1: Collection, + other2: Collection + ): OrderedSet<[T, U, V]>; + zipAll( + ...collections: Array> + ): OrderedSet; + + /** + * Returns an OrderedSet of the same type "zipped" with the provided + * collections by using a custom `zipper` function. + * + * @see Seq.Indexed.zipWith + */ + zipWith( + zipper: (value: T, otherValue: U) => Z, + otherCollection: Collection + ): OrderedSet; + zipWith( + zipper: (value: T, otherValue: U, thirdValue: V) => Z, + otherCollection: Collection, + thirdCollection: Collection + ): OrderedSet; + zipWith( + zipper: (...values: Array) => Z, + ...collections: Array> + ): OrderedSet; + } + + /** + * Stacks are indexed collections which support very efficient O(1) addition + * and removal from the front using `unshift(v)` and `shift()`. + * + * For familiarity, Stack also provides `push(v)`, `pop()`, and `peek()`, but + * be aware that they also operate on the front of the list, unlike List or + * a JavaScript Array. + * + * Note: `reverse()` or any inherent reverse traversal (`reduceRight`, + * `lastIndexOf`, etc.) is not efficient with a Stack. + * + * Stack is implemented with a Single-Linked List. + */ + namespace Stack { + /** + * True if the provided value is a Stack + */ + function isStack(maybeStack: unknown): maybeStack is Stack; + + /** + * Creates a new Stack containing `values`. + */ + function of(...values: Array): Stack; + } + + /** + * Create a new immutable Stack containing the values of the provided + * collection-like. + * + * The iteration order of the provided collection is preserved in the + * resulting `Stack`. + * + * Note: `Stack` is a factory function and not a class, and does not use the + * `new` keyword during construction. + */ + function Stack(collection?: Iterable | ArrayLike): Stack; + + interface Stack extends Collection.Indexed { + /** + * The number of items in this Stack. + */ + readonly size: number; + + // Reading values + + /** + * Alias for `Stack.first()`. + */ + peek(): T | undefined; + + // Persistent changes + + /** + * Returns a new Stack with 0 size and no values. + * + * Note: `clear` can be used in `withMutations`. + */ + clear(): Stack; + + /** + * Returns a new Stack with the provided `values` prepended, shifting other + * values ahead to higher indices. + * + * This is very efficient for Stack. + * + * Note: `unshift` can be used in `withMutations`. + */ + unshift(...values: Array): Stack; + + /** + * Like `Stack#unshift`, but accepts a collection rather than varargs. + * + * Note: `unshiftAll` can be used in `withMutations`. + */ + unshiftAll(iter: Iterable): Stack; + + /** + * Returns a new Stack with a size ones less than this Stack, excluding + * the first item in this Stack, shifting all other values to a lower index. + * + * Note: this differs from `Array#shift` because it returns a new + * Stack rather than the removed value. Use `first()` or `peek()` to get the + * first value in this Stack. + * + * Note: `shift` can be used in `withMutations`. + */ + shift(): Stack; + + /** + * Alias for `Stack#unshift` and is not equivalent to `List#push`. + */ + push(...values: Array): Stack; + + /** + * Alias for `Stack#unshiftAll`. + */ + pushAll(iter: Iterable): Stack; + + /** + * Alias for `Stack#shift` and is not equivalent to `List#pop`. + */ + pop(): Stack; + + // Transient changes + + /** + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Check the documentation for each method to see if it + * mentions being safe to use in `withMutations`. + * + * @see `Map#withMutations` + */ + withMutations(mutator: (mutable: this) => unknown): this; + + /** + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Check the documentation for each method to see if it + * mentions being safe to use in `withMutations`. + * + * @see `Map#asMutable` + */ + asMutable(): this; + + /** + * @see `Map#wasAltered` + */ + wasAltered(): boolean; + + /** + * @see `Map#asImmutable` + */ + asImmutable(): this; + + // Sequence algorithms + + /** + * Returns a new Stack with other collections concatenated to this one. + */ + concat(...valuesOrCollections: Array | C>): Stack; + + /** + * Returns a new Stack with values passed through a + * `mapper` function. + * + * Stack([ 1, 2 ]).map(x => 10 * x) + * // Stack [ 10, 20 ] + * + * Note: `map()` always returns a new instance, even if it produced the same + * value at every step. + */ + map( + mapper: (value: T, key: number, iter: this) => M, + context?: unknown + ): Stack; + + /** + * Flat-maps the Stack, returning a new Stack. + * + * Similar to `stack.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: T, key: number, iter: this) => Iterable, + context?: unknown + ): Stack; + + /** + * Returns a new Set with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: T, index: number, iter: this) => value is F, + context?: unknown + ): Set; + filter( + predicate: (value: T, index: number, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a Stack "zipped" with the provided collections. + * + * Like `zipWith`, but using the default `zipper`: creating an `Array`. + * + * ```js + * const a = Stack([ 1, 2, 3 ]); + * const b = Stack([ 4, 5, 6 ]); + * const c = a.zip(b); // Stack [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] + * ``` + */ + zip(other: Collection): Stack<[T, U]>; + zip( + other: Collection, + other2: Collection + ): Stack<[T, U, V]>; + zip(...collections: Array>): Stack; + + /** + * Returns a Stack "zipped" with the provided collections. + * + * Unlike `zip`, `zipAll` continues zipping until the longest collection is + * exhausted. Missing values from shorter collections are filled with `undefined`. + * + * ```js + * const a = Stack([ 1, 2 ]); + * const b = Stack([ 3, 4, 5 ]); + * const c = a.zipAll(b); // Stack [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] + * ``` + * + * Note: Since zipAll will return a collection as large as the largest + * input, some results may contain undefined values. TypeScript cannot + * account for these without cases (as of v2.5). + */ + zipAll(other: Collection): Stack<[T, U]>; + zipAll( + other: Collection, + other2: Collection + ): Stack<[T, U, V]>; + zipAll(...collections: Array>): Stack; + + /** + * Returns a Stack "zipped" with the provided collections by using a + * custom `zipper` function. + * + * ```js + * const a = Stack([ 1, 2, 3 ]); + * const b = Stack([ 4, 5, 6 ]); + * const c = a.zipWith((a, b) => a + b, b); + * // Stack [ 5, 7, 9 ] + * ``` + */ + zipWith( + zipper: (value: T, otherValue: U) => Z, + otherCollection: Collection + ): Stack; + zipWith( + zipper: (value: T, otherValue: U, thirdValue: V) => Z, + otherCollection: Collection, + thirdCollection: Collection + ): Stack; + zipWith( + zipper: (...values: Array) => Z, + ...collections: Array> + ): Stack; + } + + /** + * Returns a Seq.Indexed of numbers from `start` (inclusive) to `end` + * (exclusive), by `step`, where `start` defaults to 0, `step` to 1, and `end` to + * infinity. When `start` is equal to `end`, returns empty range. + * + * Note: `Range` is a factory function and not a class, and does not use the + * `new` keyword during construction. + * + * ```js + * const { Range } = require('immutable') + * Range(10, 15) // [ 10, 11, 12, 13, 14 ] + * Range(10, 30, 5) // [ 10, 15, 20, 25 ] + * Range(30, 10, 5) // [ 30, 25, 20, 15 ] + * Range(30, 30, 5) // [] + * ``` + */ + function Range( + start: number, + end: number, + step?: number + ): Seq.Indexed; + + /** + * Returns a Seq.Indexed of `value` repeated `times` times. When `times` is + * not defined, returns an infinite `Seq` of `value`. + * + * Note: `Repeat` is a factory function and not a class, and does not use the + * `new` keyword during construction. + * + * ```js + * const { Repeat } = require('immutable') + * Repeat('foo') // [ 'foo', 'foo', 'foo', ... ] + * Repeat('bar', 4) // [ 'bar', 'bar', 'bar', 'bar' ] + * ``` + */ + function Repeat(value: T, times?: number): Seq.Indexed; + + /** + * A record is similar to a JS object, but enforces a specific set of allowed + * string keys, and has default values. + * + * The `Record()` function produces new Record Factories, which when called + * create Record instances. + * + * ```js + * const { Record } = require('immutable') + * const ABRecord = Record({ a: 1, b: 2 }) + * const myRecord = ABRecord({ b: 3 }) + * ``` + * + * Records always have a value for the keys they define. `remove`ing a key + * from a record simply resets it to the default value for that key. + * + * ```js + * myRecord.get('a') // 1 + * myRecord.get('b') // 3 + * const myRecordWithoutB = myRecord.remove('b') + * myRecordWithoutB.get('b') // 2 + * ``` + * + * Values provided to the constructor not found in the Record type will + * be ignored. For example, in this case, ABRecord is provided a key "x" even + * though only "a" and "b" have been defined. The value for "x" will be + * ignored for this record. + * + * ```js + * const myRecord = ABRecord({ b: 3, x: 10 }) + * myRecord.get('x') // undefined + * ``` + * + * Because Records have a known set of string keys, property get access works + * as expected, however property sets will throw an Error. + * + * Note: IE8 does not support property access. Only use `get()` when + * supporting IE8. + * + * ```js + * myRecord.b // 3 + * myRecord.b = 5 // throws Error + * ``` + * + * Record Types can be extended as well, allowing for custom methods on your + * Record. This is not a common pattern in functional environments, but is in + * many JS programs. + * + * However Record Types are more restricted than typical JavaScript classes. + * They do not use a class constructor, which also means they cannot use + * class properties (since those are technically part of a constructor). + * + * While Record Types can be syntactically created with the JavaScript `class` + * form, the resulting Record function is actually a factory function, not a + * class constructor. Even though Record Types are not classes, JavaScript + * currently requires the use of `new` when creating new Record instances if + * they are defined as a `class`. + * + * ``` + * class ABRecord extends Record({ a: 1, b: 2 }) { + * getAB() { + * return this.a + this.b; + * } + * } + * + * var myRecord = new ABRecord({b: 3}) + * myRecord.getAB() // 4 + * ``` + * + * + * **Flow Typing Records:** + * + * Immutable.js exports two Flow types designed to make it easier to use + * Records with flow typed code, `RecordOf` and `RecordFactory`. + * + * When defining a new kind of Record factory function, use a flow type that + * describes the values the record contains along with `RecordFactory`. + * To type instances of the Record (which the factory function returns), + * use `RecordOf`. + * + * Typically, new Record definitions will export both the Record factory + * function as well as the Record instance type for use in other code. + * + * ```js + * import type { RecordFactory, RecordOf } from 'immutable'; + * + * // Use RecordFactory for defining new Record factory functions. + * type Point3DProps = { x: number, y: number, z: number }; + * const defaultValues: Point3DProps = { x: 0, y: 0, z: 0 }; + * const makePoint3D: RecordFactory = Record(defaultValues); + * export makePoint3D; + * + * // Use RecordOf for defining new instances of that Record. + * export type Point3D = RecordOf; + * const some3DPoint: Point3D = makePoint3D({ x: 10, y: 20, z: 30 }); + * ``` + * + * **Flow Typing Record Subclasses:** + * + * Records can be subclassed as a means to add additional methods to Record + * instances. This is generally discouraged in favor of a more functional API, + * since Subclasses have some minor overhead. However the ability to create + * a rich API on Record types can be quite valuable. + * + * When using Flow to type Subclasses, do not use `RecordFactory`, + * instead apply the props type when subclassing: + * + * ```js + * type PersonProps = {name: string, age: number}; + * const defaultValues: PersonProps = {name: 'Aristotle', age: 2400}; + * const PersonRecord = Record(defaultValues); + * class Person extends PersonRecord { + * getName(): string { + * return this.get('name') + * } + * + * setName(name: string): this { + * return this.set('name', name); + * } + * } + * ``` + * + * **Choosing Records vs plain JavaScript objects** + * + * Records offer a persistently immutable alternative to plain JavaScript + * objects, however they're not required to be used within Immutable.js + * collections. In fact, the deep-access and deep-updating functions + * like `getIn()` and `setIn()` work with plain JavaScript Objects as well. + * + * Deciding to use Records or Objects in your application should be informed + * by the tradeoffs and relative benefits of each: + * + * - *Runtime immutability*: plain JS objects may be carefully treated as + * immutable, however Record instances will *throw* if attempted to be + * mutated directly. Records provide this additional guarantee, however at + * some marginal runtime cost. While JS objects are mutable by nature, the + * use of type-checking tools like [Flow](https://medium.com/@gcanti/immutability-with-flow-faa050a1aef4) + * can help gain confidence in code written to favor immutability. + * + * - *Value equality*: Records use value equality when compared with `is()` + * or `record.equals()`. That is, two Records with the same keys and values + * are equal. Plain objects use *reference equality*. Two objects with the + * same keys and values are not equal since they are different objects. + * This is important to consider when using objects as keys in a `Map` or + * values in a `Set`, which use equality when retrieving values. + * + * - *API methods*: Records have a full featured API, with methods like + * `.getIn()`, and `.equals()`. These can make working with these values + * easier, but comes at the cost of not allowing keys with those names. + * + * - *Default values*: Records provide default values for every key, which + * can be useful when constructing Records with often unchanging values. + * However default values can make using Flow and TypeScript more laborious. + * + * - *Serialization*: Records use a custom internal representation to + * efficiently store and update their values. Converting to and from this + * form isn't free. If converting Records to plain objects is common, + * consider sticking with plain objects to begin with. + */ + namespace Record { + /** + * True if `maybeRecord` is an instance of a Record. + */ + function isRecord(maybeRecord: unknown): maybeRecord is Record; + + /** + * Records allow passing a second parameter to supply a descriptive name + * that appears when converting a Record to a string or in any error + * messages. A descriptive name for any record can be accessed by using this + * method. If one was not provided, the string "Record" is returned. + * + * ```js + * const { Record } = require('immutable') + * const Person = Record({ + * name: null + * }, 'Person') + * + * var me = Person({ name: 'My Name' }) + * me.toString() // "Person { "name": "My Name" }" + * Record.getDescriptiveName(me) // "Person" + * ``` + */ + function getDescriptiveName( + record: RecordOf + ): string; + + /** + * A Record.Factory is created by the `Record()` function. Record instances + * are created by passing it some of the accepted values for that Record + * type: + * + * Note that Record Factories return `Record & Readonly`, + * this allows use of both the Record instance API, and direct property + * access on the resulting instances: + */ + namespace Factory {} + + interface Factory { + ( + values?: Partial | Iterable<[string, unknown]> + ): RecordOf; + new ( + values?: Partial | Iterable<[string, unknown]> + ): RecordOf; + + /** + * The name provided to `Record(values, name)` can be accessed with + * `displayName`. + */ + displayName: string; + } + + function Factory( + values?: Partial | Iterable<[string, unknown]> + ): RecordOf; + } + + /** + * Unlike other types in Immutable.js, the `Record()` function creates a new + * Record Factory, which is a function that creates Record instances. + * + * See above for examples of using `Record()`. + * + * Note: `Record` is a factory function and not a class, and does not use the + * `new` keyword during construction. + */ + function Record( + defaultValues: TProps, + name?: string + ): Record.Factory; + + interface Record { + // Reading values + + has(key: string): key is keyof TProps & string; + + /** + * Returns the value associated with the provided key, which may be the + * default value defined when creating the Record factory function. + * + * If the requested key is not defined by this Record type, then + * notSetValue will be returned if provided. Note that this scenario would + * produce an error when using Flow or TypeScript. + */ + get(key: K, notSetValue?: unknown): TProps[K]; + get(key: string, notSetValue: T): T; + + // Reading deep values + + hasIn(keyPath: Iterable): boolean; + getIn(keyPath: Iterable): unknown; + + // Value equality + + equals(other: unknown): boolean; + hashCode(): number; + + // Persistent changes + + set(key: K, value: TProps[K]): this; + update( + key: K, + updater: (value: TProps[K]) => TProps[K] + ): this; + merge( + ...collections: Array | Iterable<[string, unknown]>> + ): this; + mergeDeep( + ...collections: Array | Iterable<[string, unknown]>> + ): this; + + mergeWith( + merger: (oldVal: unknown, newVal: unknown, key: keyof TProps) => unknown, + ...collections: Array | Iterable<[string, unknown]>> + ): this; + mergeDeepWith( + merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown, + ...collections: Array | Iterable<[string, unknown]>> + ): this; + + /** + * Returns a new instance of this Record type with the value for the + * specific key set to its default value. + * + * @alias remove + */ + delete(key: K): this; + remove(key: K): this; + + /** + * Returns a new instance of this Record type with all values set + * to their default values. + */ + clear(): this; + + // Deep persistent changes + + setIn(keyPath: Iterable, value: unknown): this; + updateIn( + keyPath: Iterable, + updater: (value: unknown) => unknown + ): this; + mergeIn(keyPath: Iterable, ...collections: Array): this; + mergeDeepIn( + keyPath: Iterable, + ...collections: Array + ): this; + + /** + * @alias removeIn + */ + deleteIn(keyPath: Iterable): this; + removeIn(keyPath: Iterable): this; + + // Conversion to JavaScript types + + /** + * Deeply converts this Record to equivalent native JavaScript Object. + * + * Note: This method may not be overridden. Objects with custom + * serialization to plain JS may override toJSON() instead. + */ + toJS(): DeepCopy; + + /** + * Shallowly converts this Record to equivalent native JavaScript Object. + */ + toJSON(): TProps; + + /** + * Shallowly converts this Record to equivalent JavaScript Object. + */ + toObject(): TProps; + + // Transient changes + + /** + * Note: Not all methods can be used on a mutable collection or within + * `withMutations`! Only `set` may be used mutatively. + * + * @see `Map#withMutations` + */ + withMutations(mutator: (mutable: this) => unknown): this; + + /** + * @see `Map#asMutable` + */ + asMutable(): this; + + /** + * @see `Map#wasAltered` + */ + wasAltered(): boolean; + + /** + * @see `Map#asImmutable` + */ + asImmutable(): this; + + // Sequence algorithms + + toSeq(): Seq.Keyed; + + [Symbol.iterator](): IterableIterator<[keyof TProps, TProps[keyof TProps]]>; + } + + /** + * RecordOf is used in TypeScript to define interfaces expecting an + * instance of record with type T. + * + * This is equivalent to an instance of a record created by a Record Factory. + */ + type RecordOf = Record & Readonly; + + /** + * `Seq` describes a lazy operation, allowing them to efficiently chain + * use of all the higher-order collection methods (such as `map` and `filter`) + * by not creating intermediate collections. + * + * **Seq is immutable** — Once a Seq is created, it cannot be + * changed, appended to, rearranged or otherwise modified. Instead, any + * mutative method called on a `Seq` will return a new `Seq`. + * + * **Seq is lazy** — `Seq` does as little work as necessary to respond to any + * method call. Values are often created during iteration, including implicit + * iteration when reducing or converting to a concrete data structure such as + * a `List` or JavaScript `Array`. + * + * For example, the following performs no work, because the resulting + * `Seq`'s values are never iterated: + * + * ```js + * const { Seq } = require('immutable') + * const oddSquares = Seq([ 1, 2, 3, 4, 5, 6, 7, 8 ]) + * .filter(x => x % 2 !== 0) + * .map(x => x * x) + * ``` + * + * Once the `Seq` is used, it performs only the work necessary. In this + * example, no intermediate arrays are ever created, filter is called three + * times, and map is only called once: + * + * ```js + * oddSquares.get(1); // 9 + * ``` + * + * Any collection can be converted to a lazy Seq with `Seq()`. + * + * `Seq` allows for the efficient chaining of operations, allowing for the + * expression of logic that can otherwise be very tedious: + * + * ```js + * lazySeq + * .flip() + * .map(key => key.toUpperCase()) + * .flip() + * // Seq { A: 1, B: 1, C: 1 } + * ``` + * + * As well as expressing logic that would otherwise seem memory or time + * limited, for example `Range` is a special kind of Lazy sequence. + * + * Seq is often used to provide a rich collection API to JavaScript Object. + * + * ```js + * Seq({ x: 0, y: 1, z: 2 }).map(v => v * 2).toObject(); + * // { x: 0, y: 2, z: 4 } + * ``` + */ + + namespace Seq { + /** + * True if `maybeSeq` is a Seq, it is not backed by a concrete + * structure such as Map, List, or Set. + */ + function isSeq( + maybeSeq: unknown + ): maybeSeq is + | Seq.Indexed + | Seq.Keyed + | Seq.Set; + + /** + * `Seq` which represents key-value pairs. + */ + namespace Keyed {} + + /** + * Always returns a Seq.Keyed, if input is not keyed, expects an + * collection of [K, V] tuples. + * + * Note: `Seq.Keyed` is a conversion function and not a class, and does not + * use the `new` keyword during construction. + */ + function Keyed(collection?: Iterable<[K, V]>): Seq.Keyed; + function Keyed(obj: { [key: string]: V }): Seq.Keyed; + + interface Keyed extends Seq, Collection.Keyed { + /** + * Deeply converts this Keyed Seq to equivalent native JavaScript Object. + * + * Converts keys to Strings. + */ + toJS(): { [key in PropertyKey]: DeepCopy }; + + /** + * Shallowly converts this Keyed Seq to equivalent native JavaScript Object. + * + * Converts keys to Strings. + */ + toJSON(): { [key in PropertyKey]: V }; + + /** + * Shallowly converts this collection to an Array. + */ + toArray(): Array<[K, V]>; + + /** + * Returns itself + */ + toSeq(): this; + + /** + * Returns a new Seq with other collections concatenated to this one. + * + * All entries will be present in the resulting Seq, even if they + * have the same key. + */ + concat( + ...collections: Array> + ): Seq.Keyed; + concat( + ...collections: Array<{ [key: string]: C }> + ): Seq.Keyed; + + /** + * Returns a new Seq.Keyed with values passed through a + * `mapper` function. + * + * ```js + * const { Seq } = require('immutable') + * Seq.Keyed({ a: 1, b: 2 }).map(x => 10 * x) + * // Seq { "a": 10, "b": 20 } + * ``` + * + * Note: `map()` always returns a new instance, even if it produced the + * same value at every step. + */ + map( + mapper: (value: V, key: K, iter: this) => M, + context?: unknown + ): Seq.Keyed; + + /** + * @see Collection.Keyed.mapKeys + */ + mapKeys( + mapper: (key: K, value: V, iter: this) => M, + context?: unknown + ): Seq.Keyed; + + /** + * @see Collection.Keyed.mapEntries + */ + mapEntries( + mapper: ( + entry: [K, V], + index: number, + iter: this + ) => [KM, VM] | undefined, + context?: unknown + ): Seq.Keyed; + + /** + * Flat-maps the Seq, returning a Seq of the same type. + * + * Similar to `seq.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, + context?: unknown + ): Seq.Keyed; + + /** + * Returns a new Seq with only the entries for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: V, key: K, iter: this) => value is F, + context?: unknown + ): Seq.Keyed; + filter( + predicate: (value: V, key: K, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new keyed Seq with the values for which the `predicate` + * function returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: V, key: K, iter: this) => value is F, + context?: C + ): [Seq.Keyed, Seq.Keyed]; + partition( + predicate: (this: C, value: V, key: K, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * @see Collection.Keyed.flip + */ + flip(): Seq.Keyed; + + [Symbol.iterator](): IterableIterator<[K, V]>; + } + + /** + * `Seq` which represents an ordered indexed list of values. + */ + namespace Indexed { + /** + * Provides an Seq.Indexed of the values provided. + */ + function of(...values: Array): Seq.Indexed; + } + + /** + * Always returns Seq.Indexed, discarding associated keys and + * supplying incrementing indices. + * + * Note: `Seq.Indexed` is a conversion function and not a class, and does + * not use the `new` keyword during construction. + */ + function Indexed( + collection?: Iterable | ArrayLike + ): Seq.Indexed; + + interface Indexed extends Seq, Collection.Indexed { + /** + * Deeply converts this Indexed Seq to equivalent native JavaScript Array. + */ + toJS(): Array>; + + /** + * Shallowly converts this Indexed Seq to equivalent native JavaScript Array. + */ + toJSON(): Array; + + /** + * Shallowly converts this collection to an Array. + */ + toArray(): Array; + + /** + * Returns itself + */ + toSeq(): this; + + /** + * Returns a new Seq with other collections concatenated to this one. + */ + concat( + ...valuesOrCollections: Array | C> + ): Seq.Indexed; + + /** + * Returns a new Seq.Indexed with values passed through a + * `mapper` function. + * + * ```js + * const { Seq } = require('immutable') + * Seq.Indexed([ 1, 2 ]).map(x => 10 * x) + * // Seq [ 10, 20 ] + * ``` + * + * Note: `map()` always returns a new instance, even if it produced the + * same value at every step. + */ + map( + mapper: (value: T, key: number, iter: this) => M, + context?: unknown + ): Seq.Indexed; + + /** + * Flat-maps the Seq, returning a a Seq of the same type. + * + * Similar to `seq.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: T, key: number, iter: this) => Iterable, + context?: unknown + ): Seq.Indexed; + + /** + * Returns a new Seq with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: T, index: number, iter: this) => value is F, + context?: unknown + ): Seq.Indexed; + filter( + predicate: (value: T, index: number, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new indexed Seq with the values for which the `predicate` + * function returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: T, index: number, iter: this) => value is F, + context?: C + ): [Seq.Indexed, Seq.Indexed]; + partition( + predicate: (this: C, value: T, index: number, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * Returns a Seq "zipped" with the provided collections. + * + * Like `zipWith`, but using the default `zipper`: creating an `Array`. + * + * ```js + * const a = Seq([ 1, 2, 3 ]); + * const b = Seq([ 4, 5, 6 ]); + * const c = a.zip(b); // Seq [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] + * ``` + */ + zip(other: Collection): Seq.Indexed<[T, U]>; + zip( + other: Collection, + other2: Collection + ): Seq.Indexed<[T, U, V]>; + zip( + ...collections: Array> + ): Seq.Indexed; + + /** + * Returns a Seq "zipped" with the provided collections. + * + * Unlike `zip`, `zipAll` continues zipping until the longest collection is + * exhausted. Missing values from shorter collections are filled with `undefined`. + * + * ```js + * const a = Seq([ 1, 2 ]); + * const b = Seq([ 3, 4, 5 ]); + * const c = a.zipAll(b); // Seq [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] + * ``` + */ + zipAll(other: Collection): Seq.Indexed<[T, U]>; + zipAll( + other: Collection, + other2: Collection + ): Seq.Indexed<[T, U, V]>; + zipAll( + ...collections: Array> + ): Seq.Indexed; + + /** + * Returns a Seq "zipped" with the provided collections by using a + * custom `zipper` function. + * + * ```js + * const a = Seq([ 1, 2, 3 ]); + * const b = Seq([ 4, 5, 6 ]); + * const c = a.zipWith((a, b) => a + b, b); + * // Seq [ 5, 7, 9 ] + * ``` + */ + zipWith( + zipper: (value: T, otherValue: U) => Z, + otherCollection: Collection + ): Seq.Indexed; + zipWith( + zipper: (value: T, otherValue: U, thirdValue: V) => Z, + otherCollection: Collection, + thirdCollection: Collection + ): Seq.Indexed; + zipWith( + zipper: (...values: Array) => Z, + ...collections: Array> + ): Seq.Indexed; + + [Symbol.iterator](): IterableIterator; + } + + /** + * `Seq` which represents a set of values. + * + * Because `Seq` are often lazy, `Seq.Set` does not provide the same guarantee + * of value uniqueness as the concrete `Set`. + */ + namespace Set { + /** + * Returns a Seq.Set of the provided values + */ + function of(...values: Array): Seq.Set; + } + + /** + * Always returns a Seq.Set, discarding associated indices or keys. + * + * Note: `Seq.Set` is a conversion function and not a class, and does not + * use the `new` keyword during construction. + */ + function Set(collection?: Iterable | ArrayLike): Seq.Set; + + interface Set extends Seq, Collection.Set { + /** + * Deeply converts this Set Seq to equivalent native JavaScript Array. + */ + toJS(): Array>; + + /** + * Shallowly converts this Set Seq to equivalent native JavaScript Array. + */ + toJSON(): Array; + + /** + * Shallowly converts this collection to an Array. + */ + toArray(): Array; + + /** + * Returns itself + */ + toSeq(): this; + + /** + * Returns a new Seq with other collections concatenated to this one. + * + * All entries will be present in the resulting Seq, even if they + * are duplicates. + */ + concat(...collections: Array>): Seq.Set; + + /** + * Returns a new Seq.Set with values passed through a + * `mapper` function. + * + * ```js + * Seq.Set([ 1, 2 ]).map(x => 10 * x) + * // Seq { 10, 20 } + * ``` + * + * Note: `map()` always returns a new instance, even if it produced the + * same value at every step. + */ + map( + mapper: (value: T, key: T, iter: this) => M, + context?: unknown + ): Seq.Set; + + /** + * Flat-maps the Seq, returning a Seq of the same type. + * + * Similar to `seq.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: T, key: T, iter: this) => Iterable, + context?: unknown + ): Seq.Set; + + /** + * Returns a new Seq with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: T, key: T, iter: this) => value is F, + context?: unknown + ): Seq.Set; + filter( + predicate: (value: T, key: T, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new set Seq with the values for which the `predicate` + * function returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: T, key: T, iter: this) => value is F, + context?: C + ): [Seq.Set, Seq.Set]; + partition( + predicate: (this: C, value: T, key: T, iter: this) => unknown, + context?: C + ): [this, this]; + + [Symbol.iterator](): IterableIterator; + } + } + + /** + * Creates a Seq. + * + * Returns a particular kind of `Seq` based on the input. + * + * * If a `Seq`, that same `Seq`. + * * If an `Collection`, a `Seq` of the same kind (Keyed, Indexed, or Set). + * * If an Array-like, an `Seq.Indexed`. + * * If an Iterable Object, an `Seq.Indexed`. + * * If an Object, a `Seq.Keyed`. + * + * Note: An Iterator itself will be treated as an object, becoming a `Seq.Keyed`, + * which is usually not what you want. You should turn your Iterator Object into + * an iterable object by defining a Symbol.iterator (or @@iterator) method which + * returns `this`. + * + * Note: `Seq` is a conversion function and not a class, and does not use the + * `new` keyword during construction. + */ + function Seq>(seq: S): S; + function Seq(collection: Collection.Keyed): Seq.Keyed; + function Seq(collection: Collection.Set): Seq.Set; + function Seq( + collection: Collection.Indexed | Iterable | ArrayLike + ): Seq.Indexed; + function Seq(obj: { [key: string]: V }): Seq.Keyed; + function Seq(): Seq; + + interface Seq extends Collection { + /** + * Some Seqs can describe their size lazily. When this is the case, + * size will be an integer. Otherwise it will be undefined. + * + * For example, Seqs returned from `map()` or `reverse()` + * preserve the size of the original `Seq` while `filter()` does not. + * + * Note: `Range`, `Repeat` and `Seq`s made from `Array`s and `Object`s will + * always have a size. + */ + readonly size: number | undefined; + + // Force evaluation + + /** + * Because Sequences are lazy and designed to be chained together, they do + * not cache their results. For example, this map function is called a total + * of 6 times, as each `join` iterates the Seq of three values. + * + * var squares = Seq([ 1, 2, 3 ]).map(x => x * x) + * squares.join() + squares.join() + * + * If you know a `Seq` will be used multiple times, it may be more + * efficient to first cache it in memory. Here, the map function is called + * only 3 times. + * + * var squares = Seq([ 1, 2, 3 ]).map(x => x * x).cacheResult() + * squares.join() + squares.join() + * + * Use this method judiciously, as it must fully evaluate a Seq which can be + * a burden on memory and possibly performance. + * + * Note: after calling `cacheResult`, a Seq will always have a `size`. + */ + cacheResult(): this; + + // Sequence algorithms + + /** + * Returns a new Seq with values passed through a + * `mapper` function. + * + * ```js + * const { Seq } = require('immutable') + * Seq([ 1, 2 ]).map(x => 10 * x) + * // Seq [ 10, 20 ] + * ``` + * + * Note: `map()` always returns a new instance, even if it produced the same + * value at every step. + */ + map( + mapper: (value: V, key: K, iter: this) => M, + context?: unknown + ): Seq; + + /** + * Returns a new Seq with values passed through a + * `mapper` function. + * + * ```js + * const { Seq } = require('immutable') + * Seq([ 1, 2 ]).map(x => 10 * x) + * // Seq [ 10, 20 ] + * ``` + * + * Note: `map()` always returns a new instance, even if it produced the same + * value at every step. + * Note: used only for sets. + */ + map( + mapper: (value: V, key: K, iter: this) => M, + context?: unknown + ): Seq; + + /** + * Flat-maps the Seq, returning a Seq of the same type. + * + * Similar to `seq.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: V, key: K, iter: this) => Iterable, + context?: unknown + ): Seq; + + /** + * Flat-maps the Seq, returning a Seq of the same type. + * + * Similar to `seq.map(...).flatten(true)`. + * Note: Used only for sets. + */ + flatMap( + mapper: (value: V, key: K, iter: this) => Iterable, + context?: unknown + ): Seq; + + /** + * Returns a new Seq with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: V, key: K, iter: this) => value is F, + context?: unknown + ): Seq; + filter( + predicate: (value: V, key: K, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new Seq with the values for which the `predicate` function + * returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: V, key: K, iter: this) => value is F, + context?: C + ): [Seq, Seq]; + partition( + predicate: (this: C, value: V, key: K, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * Returns a new Sequence of the same type with other values and + * collection-like concatenated to this one. + * + * All entries will be present in the resulting Seq, even if they + * have the same key. + */ + concat(...valuesOrCollections: Array): Seq; + } + + /** + * The `Collection` is a set of (key, value) entries which can be iterated, and + * is the base class for all collections in `immutable`, allowing them to + * make use of all the Collection methods (such as `map` and `filter`). + * + * Note: A collection is always iterated in the same order, however that order + * may not always be well defined, as is the case for the `Map` and `Set`. + * + * Collection is the abstract base class for concrete data structures. It + * cannot be constructed directly. + * + * Implementations should extend one of the subclasses, `Collection.Keyed`, + * `Collection.Indexed`, or `Collection.Set`. + */ + namespace Collection { + /** + * Keyed Collections have discrete keys tied to each value. + * + * When iterating `Collection.Keyed`, each iteration will yield a `[K, V]` + * tuple, in other words, `Collection#entries` is the default iterator for + * Keyed Collections. + */ + namespace Keyed {} + + /** + * Creates a Collection.Keyed + * + * Similar to `Collection()`, however it expects collection-likes of [K, V] + * tuples if not constructed from a Collection.Keyed or JS Object. + * + * Note: `Collection.Keyed` is a conversion function and not a class, and + * does not use the `new` keyword during construction. + */ + function Keyed(collection?: Iterable<[K, V]>): Collection.Keyed; + function Keyed(obj: { [key: string]: V }): Collection.Keyed; + + interface Keyed extends Collection { + /** + * Deeply converts this Keyed collection to equivalent native JavaScript Object. + * + * Converts keys to Strings. + */ + toJS(): { [key in PropertyKey]: DeepCopy }; + + /** + * Shallowly converts this Keyed collection to equivalent native JavaScript Object. + * + * Converts keys to Strings. + */ + toJSON(): { [key in PropertyKey]: V }; + + /** + * Shallowly converts this collection to an Array. + */ + toArray(): Array<[K, V]>; + + /** + * Returns Seq.Keyed. + * @override + */ + toSeq(): Seq.Keyed; + + // Sequence functions + + /** + * Returns a new Collection.Keyed of the same type where the keys and values + * have been flipped. + */ + flip(): Collection.Keyed; + + /** + * Returns a new Collection with other collections concatenated to this one. + */ + concat( + ...collections: Array> + ): Collection.Keyed; + concat( + ...collections: Array<{ [key: string]: C }> + ): Collection.Keyed; + + /** + * Returns a new Collection.Keyed with values passed through a + * `mapper` function. + * + * ```js + * const { Collection } = require('immutable') + * Collection.Keyed({ a: 1, b: 2 }).map(x => 10 * x) + * // Seq { "a": 10, "b": 20 } + * ``` + * + * Note: `map()` always returns a new instance, even if it produced the + * same value at every step. + */ + map( + mapper: (value: V, key: K, iter: this) => M, + context?: unknown + ): Collection.Keyed; + + /** + * Returns a new Collection.Keyed of the same type with keys passed through + * a `mapper` function. + * + * Note: `mapKeys()` always returns a new instance, even if it produced + * the same key at every step. + */ + mapKeys( + mapper: (key: K, value: V, iter: this) => M, + context?: unknown + ): Collection.Keyed; + + /** + * Returns a new Collection.Keyed of the same type with entries + * ([key, value] tuples) passed through a `mapper` function. + * + * Note: `mapEntries()` always returns a new instance, even if it produced + * the same entry at every step. + * + * If the mapper function returns `undefined`, then the entry will be filtered + */ + mapEntries( + mapper: ( + entry: [K, V], + index: number, + iter: this + ) => [KM, VM] | undefined, + context?: unknown + ): Collection.Keyed; + + /** + * Flat-maps the Collection, returning a Collection of the same type. + * + * Similar to `collection.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, + context?: unknown + ): Collection.Keyed; + + /** + * Returns a new Collection with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: V, key: K, iter: this) => value is F, + context?: unknown + ): Collection.Keyed; + filter( + predicate: (value: V, key: K, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new keyed Collection with the values for which the + * `predicate` function returns false and another for which is returns + * true. + */ + partition( + predicate: (this: C, value: V, key: K, iter: this) => value is F, + context?: C + ): [Collection.Keyed, Collection.Keyed]; + partition( + predicate: (this: C, value: V, key: K, iter: this) => unknown, + context?: C + ): [this, this]; + + [Symbol.iterator](): IterableIterator<[K, V]>; + } + + /** + * Indexed Collections have incrementing numeric keys. They exhibit + * slightly different behavior than `Collection.Keyed` for some methods in order + * to better mirror the behavior of JavaScript's `Array`, and add methods + * which do not make sense on non-indexed Collections such as `indexOf`. + * + * Unlike JavaScript arrays, `Collection.Indexed`s are always dense. "Unset" + * indices and `undefined` indices are indistinguishable, and all indices from + * 0 to `size` are visited when iterated. + * + * All Collection.Indexed methods return re-indexed Collections. In other words, + * indices always start at 0 and increment until size. If you wish to + * preserve indices, using them as keys, convert to a Collection.Keyed by + * calling `toKeyedSeq`. + */ + namespace Indexed {} + + /** + * Creates a new Collection.Indexed. + * + * Note: `Collection.Indexed` is a conversion function and not a class, and + * does not use the `new` keyword during construction. + */ + function Indexed( + collection?: Iterable | ArrayLike + ): Collection.Indexed; + + interface Indexed extends Collection, OrderedCollection { + /** + * Deeply converts this Indexed collection to equivalent native JavaScript Array. + */ + toJS(): Array>; + + /** + * Shallowly converts this Indexed collection to equivalent native JavaScript Array. + */ + toJSON(): Array; + + /** + * Shallowly converts this collection to an Array. + */ + toArray(): Array; + + // Reading values + + /** + * Returns the value associated with the provided index, or notSetValue if + * the index is beyond the bounds of the Collection. + * + * `index` may be a negative number, which indexes back from the end of the + * Collection. `s.get(-1)` gets the last item in the Collection. + */ + get(index: number, notSetValue: NSV): T | NSV; + get(index: number): T | undefined; + + // Conversion to Seq + + /** + * Returns Seq.Indexed. + * @override + */ + toSeq(): Seq.Indexed; + + /** + * If this is a collection of [key, value] entry tuples, it will return a + * Seq.Keyed of those entries. + */ + fromEntrySeq(): Seq.Keyed; + + // Combination + + /** + * Returns a Collection of the same type with `separator` between each item + * in this Collection. + */ + interpose(separator: T): this; + + /** + * Returns a Collection of the same type with the provided `collections` + * interleaved into this collection. + * + * The resulting Collection includes the first item from each, then the + * second from each, etc. + * + * The shortest Collection stops interleave. + * + * Since `interleave()` re-indexes values, it produces a complete copy, + * which has `O(N)` complexity. + * + * Note: `interleave` *cannot* be used in `withMutations`. + */ + interleave(...collections: Array>): this; + + /** + * Splice returns a new indexed Collection by replacing a region of this + * Collection with new values. If values are not provided, it only skips the + * region to be removed. + * + * `index` may be a negative number, which indexes back from the end of the + * Collection. `s.splice(-2)` splices after the second to last item. + * + * Since `splice()` re-indexes values, it produces a complete copy, which + * has `O(N)` complexity. + * + * Note: `splice` *cannot* be used in `withMutations`. + */ + splice(index: number, removeNum: number, ...values: Array): this; + + /** + * Returns a Collection of the same type "zipped" with the provided + * collections. + * + * Like `zipWith`, but using the default `zipper`: creating an `Array`. + */ + zip(other: Collection): Collection.Indexed<[T, U]>; + zip( + other: Collection, + other2: Collection + ): Collection.Indexed<[T, U, V]>; + zip( + ...collections: Array> + ): Collection.Indexed; + + /** + * Returns a Collection "zipped" with the provided collections. + * + * Unlike `zip`, `zipAll` continues zipping until the longest collection is + * exhausted. Missing values from shorter collections are filled with `undefined`. + * + * ```js + * const a = List([ 1, 2 ]); + * const b = List([ 3, 4, 5 ]); + * const c = a.zipAll(b); // List [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] + * ``` + */ + zipAll(other: Collection): Collection.Indexed<[T, U]>; + zipAll( + other: Collection, + other2: Collection + ): Collection.Indexed<[T, U, V]>; + zipAll( + ...collections: Array> + ): Collection.Indexed; + + /** + * Returns a Collection of the same type "zipped" with the provided + * collections by using a custom `zipper` function. + */ + zipWith( + zipper: (value: T, otherValue: U) => Z, + otherCollection: Collection + ): Collection.Indexed; + zipWith( + zipper: (value: T, otherValue: U, thirdValue: V) => Z, + otherCollection: Collection, + thirdCollection: Collection + ): Collection.Indexed; + zipWith( + zipper: (...values: Array) => Z, + ...collections: Array> + ): Collection.Indexed; + + // Search for value + + /** + * Returns the first index at which a given value can be found in the + * Collection, or -1 if it is not present. + */ + indexOf(searchValue: T): number; + + /** + * Returns the last index at which a given value can be found in the + * Collection, or -1 if it is not present. + */ + lastIndexOf(searchValue: T): number; + + /** + * Returns the first index in the Collection where a value satisfies the + * provided predicate function. Otherwise -1 is returned. + */ + findIndex( + predicate: (value: T, index: number, iter: this) => boolean, + context?: unknown + ): number; + + /** + * Returns the last index in the Collection where a value satisfies the + * provided predicate function. Otherwise -1 is returned. + */ + findLastIndex( + predicate: (value: T, index: number, iter: this) => boolean, + context?: unknown + ): number; + + // Sequence algorithms + + /** + * Returns a new Collection with other collections concatenated to this one. + */ + concat( + ...valuesOrCollections: Array | C> + ): Collection.Indexed; + + /** + * Returns a new Collection.Indexed with values passed through a + * `mapper` function. + * + * ```js + * const { Collection } = require('immutable') + * Collection.Indexed([1,2]).map(x => 10 * x) + * // Seq [ 1, 2 ] + * ``` + * + * Note: `map()` always returns a new instance, even if it produced the + * same value at every step. + */ + map( + mapper: (value: T, key: number, iter: this) => M, + context?: unknown + ): Collection.Indexed; + + /** + * Flat-maps the Collection, returning a Collection of the same type. + * + * Similar to `collection.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: T, key: number, iter: this) => Iterable, + context?: unknown + ): Collection.Indexed; + + /** + * Returns a new Collection with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: T, index: number, iter: this) => value is F, + context?: unknown + ): Collection.Indexed; + filter( + predicate: (value: T, index: number, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new indexed Collection with the values for which the + * `predicate` function returns false and another for which is returns + * true. + */ + partition( + predicate: (this: C, value: T, index: number, iter: this) => value is F, + context?: C + ): [Collection.Indexed, Collection.Indexed]; + partition( + predicate: (this: C, value: T, index: number, iter: this) => unknown, + context?: C + ): [this, this]; + + [Symbol.iterator](): IterableIterator; + } + + /** + * Set Collections only represent values. They have no associated keys or + * indices. Duplicate values are possible in the lazy `Seq.Set`s, however + * the concrete `Set` Collection does not allow duplicate values. + * + * Collection methods on Collection.Set such as `map` and `forEach` will provide + * the value as both the first and second arguments to the provided function. + * + * ```js + * const { Collection } = require('immutable') + * const seq = Collection.Set([ 'A', 'B', 'C' ]) + * // Seq { "A", "B", "C" } + * seq.forEach((v, k) => + * assert.equal(v, k) + * ) + * ``` + */ + namespace Set {} + + /** + * Similar to `Collection()`, but always returns a Collection.Set. + * + * Note: `Collection.Set` is a factory function and not a class, and does + * not use the `new` keyword during construction. + */ + function Set(collection?: Iterable | ArrayLike): Collection.Set; + + interface Set extends Collection { + /** + * Deeply converts this Set collection to equivalent native JavaScript Array. + */ + toJS(): Array>; + + /** + * Shallowly converts this Set collection to equivalent native JavaScript Array. + */ + toJSON(): Array; + + /** + * Shallowly converts this collection to an Array. + */ + toArray(): Array; + + /** + * Returns Seq.Set. + * @override + */ + toSeq(): Seq.Set; + + // Sequence algorithms + + /** + * Returns a new Collection with other collections concatenated to this one. + */ + concat(...collections: Array>): Collection.Set; + + /** + * Returns a new Collection.Set with values passed through a + * `mapper` function. + * + * ``` + * Collection.Set([ 1, 2 ]).map(x => 10 * x) + * // Seq { 1, 2 } + * ``` + * + * Note: `map()` always returns a new instance, even if it produced the + * same value at every step. + */ + map( + mapper: (value: T, key: T, iter: this) => M, + context?: unknown + ): Collection.Set; + + /** + * Flat-maps the Collection, returning a Collection of the same type. + * + * Similar to `collection.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: T, key: T, iter: this) => Iterable, + context?: unknown + ): Collection.Set; + + /** + * Returns a new Collection with only the values for which the `predicate` + * function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: T, key: T, iter: this) => value is F, + context?: unknown + ): Collection.Set; + filter( + predicate: (value: T, key: T, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new set Collection with the values for which the + * `predicate` function returns false and another for which is returns + * true. + */ + partition( + predicate: (this: C, value: T, key: T, iter: this) => value is F, + context?: C + ): [Collection.Set, Collection.Set]; + partition( + predicate: (this: C, value: T, key: T, iter: this) => unknown, + context?: C + ): [this, this]; + + [Symbol.iterator](): IterableIterator; + } + } + + /** + * Creates a Collection. + * + * The type of Collection created is based on the input. + * + * * If an `Collection`, that same `Collection`. + * * If an Array-like, an `Collection.Indexed`. + * * If an Object with an Iterator defined, an `Collection.Indexed`. + * * If an Object, an `Collection.Keyed`. + * + * This methods forces the conversion of Objects and Strings to Collections. + * If you want to ensure that a Collection of one item is returned, use + * `Seq.of`. + * + * Note: An Iterator itself will be treated as an object, becoming a `Seq.Keyed`, + * which is usually not what you want. You should turn your Iterator Object into + * an iterable object by defining a Symbol.iterator (or @@iterator) method which + * returns `this`. + * + * Note: `Collection` is a conversion function and not a class, and does not + * use the `new` keyword during construction. + */ + function Collection>(collection: I): I; + function Collection( + collection: Iterable | ArrayLike + ): Collection.Indexed; + function Collection(obj: { + [key: string]: V; + }): Collection.Keyed; + function Collection(): Collection; + + interface Collection extends ValueObject { + // Value equality + + /** + * True if this and the other Collection have value equality, as defined + * by `Immutable.is()`. + * + * Note: This is equivalent to `Immutable.is(this, other)`, but provided to + * allow for chained expressions. + */ + equals(other: unknown): boolean; + + /** + * Computes and returns the hashed identity for this Collection. + * + * The `hashCode` of a Collection is used to determine potential equality, + * and is used when adding this to a `Set` or as a key in a `Map`, enabling + * lookup via a different instance. + * + * If two values have the same `hashCode`, they are [not guaranteed + * to be equal][Hash Collision]. If two values have different `hashCode`s, + * they must not be equal. + * + * [Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + */ + hashCode(): number; + + // Reading values + + /** + * Returns the value associated with the provided key, or notSetValue if + * the Collection does not contain this key. + * + * Note: it is possible a key may be associated with an `undefined` value, + * so if `notSetValue` is not provided and this method returns `undefined`, + * that does not guarantee the key was not found. + */ + get(key: K, notSetValue: NSV): V | NSV; + get(key: K): V | undefined; + + /** + * True if a key exists within this `Collection`, using `Immutable.is` + * to determine equality + */ + has(key: K): boolean; + + /** + * True if a value exists within this `Collection`, using `Immutable.is` + * to determine equality + * @alias contains + */ + includes(value: V): boolean; + contains(value: V): boolean; + + /** + * In case the `Collection` is not empty returns the first element of the + * `Collection`. + * In case the `Collection` is empty returns the optional default + * value if provided, if no default value is provided returns undefined. + */ + first(notSetValue: NSV): V | NSV; + first(): V | undefined; + + /** + * In case the `Collection` is not empty returns the last element of the + * `Collection`. + * In case the `Collection` is empty returns the optional default + * value if provided, if no default value is provided returns undefined. + */ + last(notSetValue: NSV): V | NSV; + last(): V | undefined; + + // Reading deep values + + /** + * Returns the value found by following a path of keys or indices through + * nested Collections. + * + * Plain JavaScript Object or Arrays may be nested within an Immutable.js + * Collection, and getIn() can access those values as well: + */ + getIn(searchKeyPath: Iterable, notSetValue?: unknown): unknown; + + /** + * True if the result of following a path of keys or indices through nested + * Collections results in a set value. + */ + hasIn(searchKeyPath: Iterable): boolean; + + // Persistent changes + + /** + * This can be very useful as a way to "chain" a normal function into a + * sequence of methods. RxJS calls this "let" and lodash calls it "thru". + * + * For example, to sum a Seq after mapping and filtering: + */ + update(updater: (value: this) => R): R; + + // Conversion to JavaScript types + + /** + * Deeply converts this Collection to equivalent native JavaScript Array or Object. + * + * `Collection.Indexed`, and `Collection.Set` become `Array`, while + * `Collection.Keyed` become `Object`, converting keys to Strings. + */ + toJS(): Array> | { [key in PropertyKey]: DeepCopy }; + + /** + * Shallowly converts this Collection to equivalent native JavaScript Array or Object. + * + * `Collection.Indexed`, and `Collection.Set` become `Array`, while + * `Collection.Keyed` become `Object`, converting keys to Strings. + */ + toJSON(): Array | { [key in PropertyKey]: V }; + + /** + * Shallowly converts this collection to an Array. + * + * `Collection.Indexed`, and `Collection.Set` produce an Array of values. + * `Collection.Keyed` produce an Array of [key, value] tuples. + */ + toArray(): Array | Array<[K, V]>; + + /** + * Shallowly converts this Collection to an Object. + * + * Converts keys to Strings. + */ + toObject(): { [key: string]: V }; + + // Conversion to Collections + + /** + * Converts this Collection to a Map, Throws if keys are not hashable. + * + * Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided + * for convenience and to allow for chained expressions. + */ + toMap(): Map; + + /** + * Converts this Collection to a Map, maintaining the order of iteration. + * + * Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but + * provided for convenience and to allow for chained expressions. + */ + toOrderedMap(): OrderedMap; + + /** + * Converts this Collection to a Set, discarding keys. Throws if values + * are not hashable. + * + * Note: This is equivalent to `Set(this)`, but provided to allow for + * chained expressions. + */ + toSet(): Set; + + /** + * Converts this Collection to a Set, maintaining the order of iteration and + * discarding keys. + * + * Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided + * for convenience and to allow for chained expressions. + */ + toOrderedSet(): OrderedSet; + + /** + * Converts this Collection to a List, discarding keys. + * + * This is similar to `List(collection)`, but provided to allow for chained + * expressions. However, when called on `Map` or other keyed collections, + * `collection.toList()` discards the keys and creates a list of only the + * values, whereas `List(collection)` creates a list of entry tuples. + */ + toList(): List; + + /** + * Converts this Collection to a Stack, discarding keys. Throws if values + * are not hashable. + * + * Note: This is equivalent to `Stack(this)`, but provided to allow for + * chained expressions. + */ + toStack(): Stack; + + // Conversion to Seq + + /** + * Converts this Collection to a Seq of the same kind (indexed, + * keyed, or set). + */ + toSeq(): Seq; + + /** + * Returns a Seq.Keyed from this Collection where indices are treated as keys. + * + * This is useful if you want to operate on an + * Collection.Indexed and preserve the [index, value] pairs. + * + * The returned Seq will have identical iteration order as + * this Collection. + */ + toKeyedSeq(): Seq.Keyed; + + /** + * Returns an Seq.Indexed of the values of this Collection, discarding keys. + */ + toIndexedSeq(): Seq.Indexed; + + /** + * Returns a Seq.Set of the values of this Collection, discarding keys. + */ + toSetSeq(): Seq.Set; + + // Iterators + + /** + * An iterator of this `Collection`'s keys. + * + * Note: this will return an ES6 iterator which does not support + * Immutable.js sequence algorithms. Use `keySeq` instead, if this is + * what you want. + */ + keys(): IterableIterator; + + /** + * An iterator of this `Collection`'s values. + * + * Note: this will return an ES6 iterator which does not support + * Immutable.js sequence algorithms. Use `valueSeq` instead, if this is + * what you want. + */ + values(): IterableIterator; + + /** + * An iterator of this `Collection`'s entries as `[ key, value ]` tuples. + * + * Note: this will return an ES6 iterator which does not support + * Immutable.js sequence algorithms. Use `entrySeq` instead, if this is + * what you want. + */ + entries(): IterableIterator<[K, V]>; + + [Symbol.iterator](): IterableIterator; + + // Collections (Seq) + + /** + * Returns a new Seq.Indexed of the keys of this Collection, + * discarding values. + */ + keySeq(): Seq.Indexed; + + /** + * Returns an Seq.Indexed of the values of this Collection, discarding keys. + */ + valueSeq(): Seq.Indexed; + + /** + * Returns a new Seq.Indexed of [key, value] tuples. + */ + entrySeq(): Seq.Indexed<[K, V]>; + + // Sequence algorithms + + /** + * Returns a new Collection of the same type with values passed through a + * `mapper` function. + * + * Note: `map()` always returns a new instance, even if it produced the same + * value at every step. + */ + map( + mapper: (value: V, key: K, iter: this) => M, + context?: unknown + ): Collection; + + /** + * Note: used only for sets, which return Collection but are otherwise + * identical to normal `map()`. + * + * @ignore + */ + map(...args: Array): unknown; + + /** + * Returns a new Collection of the same type with only the entries for which + * the `predicate` function returns true. + * + * Note: `filter()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filter( + predicate: (value: V, key: K, iter: this) => value is F, + context?: unknown + ): Collection; + filter( + predicate: (value: V, key: K, iter: this) => unknown, + context?: unknown + ): this; + + /** + * Returns a new Collection of the same type with only the entries for which + * the `predicate` function returns false. + * + * Note: `filterNot()` always returns a new instance, even if it results in + * not filtering out any values. + */ + filterNot( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): this; + + /** + * Returns a new Collection with the values for which the `predicate` + * function returns false and another for which is returns true. + */ + partition( + predicate: (this: C, value: V, key: K, iter: this) => value is F, + context?: C + ): [Collection, Collection]; + partition( + predicate: (this: C, value: V, key: K, iter: this) => unknown, + context?: C + ): [this, this]; + + /** + * Returns a new Collection of the same type in reverse order. + */ + reverse(): this; + + /** + * Returns a new Collection of the same type which includes the same entries, + * stably sorted by using a `comparator`. + * + * If a `comparator` is not provided, a default comparator uses `<` and `>`. + * + * `comparator(valueA, valueB)`: + * + * * Returns `0` if the elements should not be swapped. + * * Returns `-1` (or any negative number) if `valueA` comes before `valueB` + * * Returns `1` (or any positive number) if `valueA` comes after `valueB` + * * Alternatively, can return a value of the `PairSorting` enum type + * * Is pure, i.e. it must always return the same value for the same pair + * of values. + * + * When sorting collections which have no defined order, their ordered + * equivalents will be returned. e.g. `map.sort()` returns OrderedMap. + * + * Note: `sort()` Always returns a new instance, even if the original was + * already sorted. + * + * Note: This is always an eager operation. + */ + sort(comparator?: Comparator): this; + + /** + * Like `sort`, but also accepts a `comparatorValueMapper` which allows for + * sorting by more sophisticated means: + * + * Note: `sortBy()` Always returns a new instance, even if the original was + * already sorted. + * + * Note: This is always an eager operation. + */ + sortBy( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: Comparator + ): this; + + /** + * Returns a `Map` of `Collection`, grouped by the return + * value of the `grouper` function. + * + * Note: This is always an eager operation. + */ + groupBy( + grouper: (value: V, key: K, iter: this) => G, + context?: unknown + ): Map; + + // Side effects + + /** + * The `sideEffect` is executed for every entry in the Collection. + * + * Unlike `Array#forEach`, if any call of `sideEffect` returns + * `false`, the iteration will stop. Returns the number of entries iterated + * (including the last iteration which returned false). + */ + forEach( + sideEffect: (value: V, key: K, iter: this) => unknown, + context?: unknown + ): number; + + // Creating subsets + + /** + * Returns a new Collection of the same type representing a portion of this + * Collection from start up to but not including end. + * + * If begin is negative, it is offset from the end of the Collection. e.g. + * `slice(-2)` returns a Collection of the last two entries. If it is not + * provided the new Collection will begin at the beginning of this Collection. + * + * If end is negative, it is offset from the end of the Collection. e.g. + * `slice(0, -1)` returns a Collection of everything but the last entry. If + * it is not provided, the new Collection will continue through the end of + * this Collection. + * + * If the requested slice is equivalent to the current Collection, then it + * will return itself. + */ + slice(begin?: number, end?: number): this; + + /** + * Returns a new Collection of the same type containing all entries except + * the first. + */ + rest(): this; + + /** + * Returns a new Collection of the same type containing all entries except + * the last. + */ + butLast(): this; + + /** + * Returns a new Collection of the same type which excludes the first `amount` + * entries from this Collection. + */ + skip(amount: number): this; + + /** + * Returns a new Collection of the same type which excludes the last `amount` + * entries from this Collection. + */ + skipLast(amount: number): this; + + /** + * Returns a new Collection of the same type which includes entries starting + * from when `predicate` first returns false. + */ + skipWhile( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): this; + + /** + * Returns a new Collection of the same type which includes entries starting + * from when `predicate` first returns true. + */ + skipUntil( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): this; + + /** + * Returns a new Collection of the same type which includes the first `amount` + * entries from this Collection. + */ + take(amount: number): this; + + /** + * Returns a new Collection of the same type which includes the last `amount` + * entries from this Collection. + */ + takeLast(amount: number): this; + + /** + * Returns a new Collection of the same type which includes entries from this + * Collection as long as the `predicate` returns true. + */ + takeWhile( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): this; + + /** + * Returns a new Collection of the same type which includes entries from this + * Collection as long as the `predicate` returns false. + */ + takeUntil( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): this; + + // Combination + + /** + * Returns a new Collection of the same type with other values and + * collection-like concatenated to this one. + * + * For Seqs, all entries will be present in the resulting Seq, even if they + * have the same key. + */ + concat( + ...valuesOrCollections: Array + ): Collection; + + /** + * Flattens nested Collections. + * + * Will deeply flatten the Collection by default, returning a Collection of the + * same type, but a `depth` can be provided in the form of a number or + * boolean (where true means to shallowly flatten one level). A depth of 0 + * (or shallow: false) will deeply flatten. + * + * Flattens only others Collection, not Arrays or Objects. + * + * Note: `flatten(true)` operates on Collection> and + * returns Collection + */ + flatten(depth?: number): Collection; + flatten(shallow?: boolean): Collection; + + /** + * Flat-maps the Collection, returning a Collection of the same type. + * + * Similar to `collection.map(...).flatten(true)`. + */ + flatMap( + mapper: (value: V, key: K, iter: this) => Iterable, + context?: unknown + ): Collection; + + /** + * Flat-maps the Collection, returning a Collection of the same type. + * + * Similar to `collection.map(...).flatten(true)`. + * Used for Dictionaries only. + */ + flatMap( + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, + context?: unknown + ): Collection; + + // Reducing a value + + /** + * Reduces the Collection to a value by calling the `reducer` for every entry + * in the Collection and passing along the reduced value. + * + * If `initialReduction` is not provided, the first item in the + * Collection will be used. + * + * @see `Array#reduce`. + */ + reduce( + reducer: (reduction: R, value: V, key: K, iter: this) => R, + initialReduction: R, + context?: unknown + ): R; + reduce( + reducer: (reduction: V | R, value: V, key: K, iter: this) => R + ): R; + + /** + * Reduces the Collection in reverse (from the right side). + * + * Note: Similar to this.reverse().reduce(), and provided for parity + * with `Array#reduceRight`. + */ + reduceRight( + reducer: (reduction: R, value: V, key: K, iter: this) => R, + initialReduction: R, + context?: unknown + ): R; + reduceRight( + reducer: (reduction: V | R, value: V, key: K, iter: this) => R + ): R; + + /** + * True if `predicate` returns true for all entries in the Collection. + */ + every( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): boolean; + + /** + * True if `predicate` returns true for any entry in the Collection. + */ + some( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): boolean; + + /** + * Joins values together as a string, inserting a separator between each. + * The default separator is `","`. + */ + join(separator?: string): string; + + /** + * Returns true if this Collection includes no values. + * + * For some lazy `Seq`, `isEmpty` might need to iterate to determine + * emptiness. At most one iteration will occur. + */ + isEmpty(): boolean; + + /** + * Returns the size of this Collection. + * + * Regardless of if this Collection can describe its size lazily (some Seqs + * cannot), this method will always return the correct size. E.g. it + * evaluates a lazy `Seq` if necessary. + * + * If `predicate` is provided, then this returns the count of entries in the + * Collection for which the `predicate` returns true. + */ + count(): number; + count( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): number; + + /** + * Returns a `Seq.Keyed` of counts, grouped by the return value of + * the `grouper` function. + * + * Note: This is not a lazy operation. + */ + countBy( + grouper: (value: V, key: K, iter: this) => G, + context?: unknown + ): Map; + + // Search for value + + /** + * Returns the first value for which the `predicate` returns true. + */ + find( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown, + notSetValue?: V + ): V | undefined; + + /** + * Returns the last value for which the `predicate` returns true. + * + * Note: `predicate` will be called for each entry in reverse. + */ + findLast( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown, + notSetValue?: V + ): V | undefined; + + /** + * Returns the first [key, value] entry for which the `predicate` returns true. + */ + findEntry( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown, + notSetValue?: V + ): [K, V] | undefined; + + /** + * Returns the last [key, value] entry for which the `predicate` + * returns true. + * + * Note: `predicate` will be called for each entry in reverse. + */ + findLastEntry( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown, + notSetValue?: V + ): [K, V] | undefined; + + /** + * Returns the key for which the `predicate` returns true. + */ + findKey( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): K | undefined; + + /** + * Returns the last key for which the `predicate` returns true. + * + * Note: `predicate` will be called for each entry in reverse. + */ + findLastKey( + predicate: (value: V, key: K, iter: this) => boolean, + context?: unknown + ): K | undefined; + + /** + * Returns the key associated with the search value, or undefined. + */ + keyOf(searchValue: V): K | undefined; + + /** + * Returns the last key associated with the search value, or undefined. + */ + lastKeyOf(searchValue: V): K | undefined; + + /** + * Returns the maximum value in this collection. If any values are + * comparatively equivalent, the first one found will be returned. + * + * The `comparator` is used in the same way as `Collection#sort`. If it is not + * provided, the default comparator is `>`. + * + * When two values are considered equivalent, the first encountered will be + * returned. Otherwise, `max` will operate independent of the order of input + * as long as the comparator is commutative. The default comparator `>` is + * commutative *only* when types do not differ. + * + * If `comparator` returns 0 and either value is NaN, undefined, or null, + * that value will be returned. + */ + max(comparator?: Comparator): V | undefined; + + /** + * Like `max`, but also accepts a `comparatorValueMapper` which allows for + * comparing by more sophisticated means: + */ + maxBy( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: Comparator + ): V | undefined; + + /** + * Returns the minimum value in this collection. If any values are + * comparatively equivalent, the first one found will be returned. + * + * The `comparator` is used in the same way as `Collection#sort`. If it is not + * provided, the default comparator is `<`. + * + * When two values are considered equivalent, the first encountered will be + * returned. Otherwise, `min` will operate independent of the order of input + * as long as the comparator is commutative. The default comparator `<` is + * commutative *only* when types do not differ. + * + * If `comparator` returns 0 and either value is NaN, undefined, or null, + * that value will be returned. + */ + min(comparator?: Comparator): V | undefined; + + /** + * Like `min`, but also accepts a `comparatorValueMapper` which allows for + * comparing by more sophisticated means: + */ + minBy( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: Comparator + ): V | undefined; + + // Comparison + + /** + * True if `iter` includes every value in this Collection. + */ + isSubset(iter: Iterable): boolean; + + /** + * True if this Collection includes every value in `iter`. + */ + isSuperset(iter: Iterable): boolean; + } + + /** + * The interface to fulfill to qualify as a Value Object. + */ + interface ValueObject { + /** + * True if this and the other Collection have value equality, as defined + * by `Immutable.is()`. + * + * Note: This is equivalent to `Immutable.is(this, other)`, but provided to + * allow for chained expressions. + */ + equals(other: unknown): boolean; + + /** + * Computes and returns the hashed identity for this Collection. + * + * The `hashCode` of a Collection is used to determine potential equality, + * and is used when adding this to a `Set` or as a key in a `Map`, enabling + * lookup via a different instance. + * + * Note: hashCode() MUST return a Uint32 number. The easiest way to + * guarantee this is to return `myHash | 0` from a custom implementation. + * + * If two values have the same `hashCode`, they are [not guaranteed + * to be equal][Hash Collision]. If two values have different `hashCode`s, + * they must not be equal. + * + * Note: `hashCode()` is not guaranteed to always be called before + * `equals()`. Most but not all Immutable.js collections use hash codes to + * organize their internal data structures, while all Immutable.js + * collections use equality during lookups. + * + * [Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + */ + hashCode(): number; + } + + /** + * Interface representing all oredered collections. + * This includes `List`, `Stack`, `Map`, `OrderedMap`, `Set`, and `OrderedSet`. + * return of `isOrdered()` return true in that case. + */ + interface OrderedCollection { + /** + * Shallowly converts this collection to an Array. + */ + toArray(): Array; + + [Symbol.iterator](): IterableIterator; + } + + /** + * Deeply converts plain JS objects and arrays to Immutable Maps and Lists. + * + * `fromJS` will convert Arrays and [array-like objects][2] to a List, and + * plain objects (without a custom prototype) to a Map. [Iterable objects][3] + * may be converted to List, Map, or Set. + * + * If a `reviver` is optionally provided, it will be called with every + * collection as a Seq (beginning with the most nested collections + * and proceeding to the top-level collection itself), along with the key + * referring to each collection and the parent JS object provided as `this`. + * For the top level, object, the key will be `""`. This `reviver` is expected + * to return a new Immutable Collection, allowing for custom conversions from + * deep JS objects. Finally, a `path` is provided which is the sequence of + * keys to this value from the starting value. + * + * `reviver` acts similarly to the [same parameter in `JSON.parse`][1]. + * + * If `reviver` is not provided, the default behavior will convert Objects + * into Maps and Arrays into Lists like so: + * + * Accordingly, this example converts native JS data to OrderedMap and List: + * + * Keep in mind, when using JS objects to construct Immutable Maps, that + * JavaScript Object properties are always strings, even if written in a + * quote-less shorthand, while Immutable Maps accept keys of any type. + * + * Property access for JavaScript Objects first converts the key to a string, + * but since Immutable Map keys can be of any type the argument to `get()` is + * not altered. + * + * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter + * "Using the reviver parameter" + * [2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Indexed_collections#working_with_array-like_objects + * "Working with array-like objects" + * [3]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol + * "The iterable protocol" + */ + function fromJS( + jsValue: JSValue, + reviver?: undefined + ): FromJS; + function fromJS( + jsValue: unknown, + reviver?: ( + key: string | number, + sequence: Collection.Keyed | Collection.Indexed, + path?: Array + ) => unknown + ): Collection; + + type FromJS = JSValue extends FromJSNoTransform + ? JSValue + : JSValue extends Array + ? FromJSArray + : JSValue extends object + ? FromJSObject + : unknown; + + type FromJSNoTransform = + | Collection + | number + | string + | null + | undefined; + + type FromJSArray = + JSValue extends Array ? List> : never; + + type FromJSObject = JSValue extends object + ? Map> + : never; + + /** + * Value equality check with semantics similar to `Object.is`, but treats + * Immutable `Collection`s as values, equal if the second `Collection` includes + * equivalent values. + * + * It's used throughout Immutable when checking for equality, including `Map` + * key equality and `Set` membership. + * + * `is()` compares primitive types like strings and numbers, Immutable.js + * collections like `Map` and `List`, but also any custom object which + * implements `ValueObject` by providing `equals()` and `hashCode()` methods. + * + * Note: Unlike `Object.is`, `Immutable.is` assumes `0` and `-0` are the same + * value, matching the behavior of ES6 Map key equality. + */ + function is(first: unknown, second: unknown): boolean; + + /** + * The `hash()` function is an important part of how Immutable determines if + * two values are equivalent and is used to determine how to store those + * values. Provided with any value, `hash()` will return a 31-bit integer. + * + * When designing Objects which may be equal, it's important that when a + * `.equals()` method returns true, that both values `.hashCode()` method + * return the same value. `hash()` may be used to produce those values. + * + * For non-Immutable Objects that do not provide a `.hashCode()` functions + * (including plain Objects, plain Arrays, Date objects, etc), a unique hash + * value will be created for each *instance*. That is, the create hash + * represents referential equality, and not value equality for Objects. This + * ensures that if that Object is mutated over time that its hash code will + * remain consistent, allowing Objects to be used as keys and values in + * Immutable.js collections. + * + * Note that `hash()` attempts to balance between speed and avoiding + * collisions, however it makes no attempt to produce secure hashes. + * + * *New in Version 4.0* + */ + function hash(value: unknown): number; + + /** + * True if `maybeImmutable` is an Immutable Collection or Record. + * + * Note: Still returns true even if the collections is within a `withMutations()`. + */ + function isImmutable( + maybeImmutable: unknown + ): maybeImmutable is Collection; + + /** + * True if `maybeCollection` is a Collection, or any of its subclasses. + */ + function isCollection( + maybeCollection: unknown + ): maybeCollection is Collection; + + /** + * True if `maybeKeyed` is a Collection.Keyed, or any of its subclasses. + */ + function isKeyed( + maybeKeyed: unknown + ): maybeKeyed is Collection.Keyed; + + /** + * True if `maybeIndexed` is a Collection.Indexed, or any of its subclasses. + */ + function isIndexed( + maybeIndexed: unknown + ): maybeIndexed is Collection.Indexed; + + /** + * True if `maybeAssociative` is either a Keyed or Indexed Collection. + */ + function isAssociative( + maybeAssociative: unknown + ): maybeAssociative is + | Collection.Keyed + | Collection.Indexed; + + /** + * True if `maybeOrdered` is a Collection where iteration order is well + * defined. True for Collection.Indexed as well as OrderedMap and OrderedSet. + */ + function isOrdered( + maybeOrdered: Iterable + ): maybeOrdered is OrderedCollection; + function isOrdered( + maybeOrdered: unknown + ): maybeOrdered is OrderedCollection; + + /** + * True if `maybeValue` is a JavaScript Object which has *both* `equals()` + * and `hashCode()` methods. + * + * Any two instances of *value objects* can be compared for value equality with + * `Immutable.is()` and can be used as keys in a `Map` or members in a `Set`. + */ + function isValueObject(maybeValue: unknown): maybeValue is ValueObject; + + /** + * True if `maybeSeq` is a Seq. + */ + function isSeq( + maybeSeq: unknown + ): maybeSeq is + | Seq.Indexed + | Seq.Keyed + | Seq.Set; + + /** + * True if `maybeList` is a List. + */ + function isList(maybeList: unknown): maybeList is List; + + /** + * True if `maybeMap` is a Map. + * + * Also true for OrderedMaps. + */ + function isMap(maybeMap: unknown): maybeMap is Map; + + /** + * True if `maybeOrderedMap` is an OrderedMap. + */ + function isOrderedMap( + maybeOrderedMap: unknown + ): maybeOrderedMap is OrderedMap; + + /** + * True if `maybeStack` is a Stack. + */ + function isStack(maybeStack: unknown): maybeStack is Stack; + + /** + * True if `maybeSet` is a Set. + * + * Also true for OrderedSets. + */ + function isSet(maybeSet: unknown): maybeSet is Set; + + /** + * True if `maybeOrderedSet` is an OrderedSet. + */ + function isOrderedSet( + maybeOrderedSet: unknown + ): maybeOrderedSet is OrderedSet; + + /** + * True if `maybeRecord` is a Record. + */ + function isRecord(maybeRecord: unknown): maybeRecord is Record; + + /** + * Returns the value within the provided collection associated with the + * provided key, or notSetValue if the key is not defined in the collection. + * + * A functional alternative to `collection.get(key)` which will also work on + * plain Objects and Arrays as an alternative for `collection[key]`. + */ + function get(collection: Collection, key: K): V | undefined; + function get( + collection: Collection, + key: K, + notSetValue: NSV + ): V | NSV; + function get( + record: Record, + key: K, + notSetValue: unknown + ): TProps[K]; + function get(collection: Array, key: number): V | undefined; + function get( + collection: Array, + key: number, + notSetValue: NSV + ): V | NSV; + function get( + object: C, + key: K, + notSetValue: unknown + ): C[K]; + function get( + collection: { [key: PropertyKey]: V }, + key: string + ): V | undefined; + function get( + collection: { [key: PropertyKey]: V }, + key: string, + notSetValue: NSV + ): V | NSV; + + /** + * Returns true if the key is defined in the provided collection. + * + * A functional alternative to `collection.has(key)` which will also work with + * plain Objects and Arrays as an alternative for + * `collection.hasOwnProperty(key)`. + */ + function has(collection: object, key: unknown): boolean; + + /** + * Returns a copy of the collection with the value at key removed. + * + * A functional alternative to `collection.remove(key)` which will also work + * with plain Objects and Arrays as an alternative for + * `delete collectionCopy[key]`. + */ + function remove>( + collection: C, + key: K + ): C; + function remove< + TProps extends object, + C extends Record, + K extends keyof TProps, + >(collection: C, key: K): C; + function remove>(collection: C, key: number): C; + function remove(collection: C, key: K): C; + function remove( + collection: C, + key: K + ): C; + + /** + * Returns a copy of the collection with the value at key set to the provided + * value. + * + * A functional alternative to `collection.set(key, value)` which will also + * work with plain Objects and Arrays as an alternative for + * `collectionCopy[key] = value`. + */ + function set>( + collection: C, + key: K, + value: V + ): C; + function set< + TProps extends object, + C extends Record, + K extends keyof TProps, + >(record: C, key: K, value: TProps[K]): C; + function set>(collection: C, key: number, value: V): C; + function set(object: C, key: K, value: C[K]): C; + function set( + collection: C, + key: string, + value: V + ): C; + + /** + * Returns a copy of the collection with the value at key set to the result of + * providing the existing value to the updating function. + * + * A functional alternative to `collection.update(key, fn)` which will also + * work with plain Objects and Arrays as an alternative for + * `collectionCopy[key] = fn(collection[key])`. + */ + function update>( + collection: C, + key: K, + updater: (value: V | undefined) => V | undefined + ): C; + function update, NSV>( + collection: C, + key: K, + notSetValue: NSV, + updater: (value: V | NSV) => V + ): C; + function update< + TProps extends object, + C extends Record, + K extends keyof TProps, + >(record: C, key: K, updater: (value: TProps[K]) => TProps[K]): C; + function update< + TProps extends object, + C extends Record, + K extends keyof TProps, + NSV, + >( + record: C, + key: K, + notSetValue: NSV, + updater: (value: TProps[K] | NSV) => TProps[K] + ): C; + function update( + collection: Array, + key: number, + updater: (value: V | undefined) => V | undefined + ): Array; + function update( + collection: Array, + key: number, + notSetValue: NSV, + updater: (value: V | NSV) => V + ): Array; + function update( + object: C, + key: K, + updater: (value: C[K]) => C[K] + ): C; + function update( + object: C, + key: K, + notSetValue: NSV, + updater: (value: C[K] | NSV) => C[K] + ): C; + function update( + collection: C, + key: K, + updater: (value: V) => V + ): { [key: string]: V }; + function update( + collection: C, + key: K, + notSetValue: NSV, + updater: (value: V | NSV) => V + ): { [key: string]: V }; + + // TODO `` can be used after dropping support for TypeScript 4.x + // reference: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#const-type-parameters + // after this change, `as const` assertions can be remove from the type tests + /** + * Returns the value at the provided key path starting at the provided + * collection, or notSetValue if the key path is not defined. + * + * A functional alternative to `collection.getIn(keypath)` which will also + * work with plain Objects and Arrays. + */ + function getIn>( + object: C, + keyPath: [...P] + ): RetrievePath; + function getIn>(object: C, keyPath: P): unknown; + function getIn, NSV>( + collection: C, + keyPath: [...P], + notSetValue: NSV + ): RetrievePath extends never ? NSV : RetrievePath; + function getIn, NSV>( + object: C, + keyPath: P, + notSetValue: NSV + ): unknown; + + /** + * Returns true if the key path is defined in the provided collection. + * + * A functional alternative to `collection.hasIn(keypath)` which will also + * work with plain Objects and Arrays. + */ + function hasIn( + collection: string | boolean | number, + keyPath: KeyPath + ): never; + function hasIn(collection: unknown, keyPath: KeyPath): boolean; + + /** + * Returns a copy of the collection with the value at the key path removed. + * + * A functional alternative to `collection.removeIn(keypath)` which will also + * work with plain Objects and Arrays. + */ + function removeIn(collection: C, keyPath: Iterable): C; + + /** + * Returns a copy of the collection with the value at the key path set to the + * provided value. + * + * A functional alternative to `collection.setIn(keypath)` which will also + * work with plain Objects and Arrays. + */ + function setIn( + collection: C, + keyPath: Iterable, + value: unknown + ): C; + + /** + * Returns a copy of the collection with the value at key path set to the + * result of providing the existing value to the updating function. + * + * A functional alternative to `collection.updateIn(keypath)` which will also + * work with plain Objects and Arrays. + */ + function updateIn>( + collection: C, + keyPath: KeyPath, + updater: ( + value: RetrievePath> | undefined + ) => unknown | undefined + ): C; + function updateIn, NSV>( + collection: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: (value: RetrievePath> | NSV) => unknown + ): C; + function updateIn< + TProps extends object, + C extends Record, + K extends keyof TProps, + >( + record: C, + keyPath: KeyPath, + updater: (value: RetrievePath>) => unknown + ): C; + function updateIn< + TProps extends object, + C extends Record, + K extends keyof TProps, + NSV, + >( + record: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: (value: RetrievePath> | NSV) => unknown + ): C; + function updateIn>( + collection: Array, + keyPath: KeyPath, + updater: ( + value: RetrievePath> | undefined + ) => unknown | undefined + ): Array; + function updateIn, NSV>( + collection: Array, + keyPath: KeyPath, + notSetValue: NSV, + updater: (value: RetrievePath> | NSV) => unknown + ): Array; + function updateIn( + object: C, + keyPath: KeyPath, + updater: (value: RetrievePath>) => unknown + ): C; + function updateIn( + object: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: (value: RetrievePath> | NSV) => unknown + ): C; + function updateIn< + K extends PropertyKey, + V, + C extends { [key: PropertyKey]: V }, + >( + collection: C, + keyPath: KeyPath, + updater: (value: RetrievePath>) => unknown + ): { [key: PropertyKey]: V }; + function updateIn< + K extends PropertyKey, + V, + C extends { [key: PropertyKey]: V }, + NSV, + >( + collection: C, + keyPath: KeyPath, + notSetValue: NSV, + updater: (value: RetrievePath> | NSV) => unknown + ): { [key: PropertyKey]: V }; + + /** + * Returns a copy of the collection with the remaining collections merged in. + * + * A functional alternative to `collection.merge()` which will also work with + * plain Objects and Arrays. + */ + function merge( + collection: C, + ...collections: Array< + | Iterable + | Iterable<[unknown, unknown]> + | { [key: string]: unknown } + > + ): C; + + /** + * Returns a copy of the collection with the remaining collections merged in, + * calling the `merger` function whenever an existing value is encountered. + * + * A functional alternative to `collection.mergeWith()` which will also work + * with plain Objects and Arrays. + */ + function mergeWith( + merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown, + collection: C, + ...collections: Array< + | Iterable + | Iterable<[unknown, unknown]> + | { [key: string]: unknown } + > + ): C; + + /** + * Like `merge()`, but when two compatible collections are encountered with + * the same key, it merges them as well, recursing deeply through the nested + * data. Two collections are considered to be compatible (and thus will be + * merged together) if they both fall into one of three categories: keyed + * (e.g., `Map`s, `Record`s, and objects), indexed (e.g., `List`s and + * arrays), or set-like (e.g., `Set`s). If they fall into separate + * categories, `mergeDeep` will replace the existing collection with the + * collection being merged in. This behavior can be customized by using + * `mergeDeepWith()`. + * + * Note: Indexed and set-like collections are merged using + * `concat()`/`union()` and therefore do not recurse. + * + * A functional alternative to `collection.mergeDeep()` which will also work + * with plain Objects and Arrays. + */ + function mergeDeep( + collection: C, + ...collections: Array< + | Iterable + | Iterable<[unknown, unknown]> + | { [key: string]: unknown } + > + ): C; + + /** + * Like `mergeDeep()`, but when two non-collections or incompatible + * collections are encountered at the same key, it uses the `merger` function + * to determine the resulting value. Collections are considered incompatible + * if they fall into separate categories between keyed, indexed, and set-like. + * + * A functional alternative to `collection.mergeDeepWith()` which will also + * work with plain Objects and Arrays. + */ + function mergeDeepWith( + merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown, + collection: C, + ...collections: Array< + | Iterable + | Iterable<[unknown, unknown]> + | { [key: string]: unknown } + > + ): C; +} + +/** + * Defines the main export of the immutable module to be the Immutable namespace + * This supports many common module import patterns: + * + * const Immutable = require("immutable"); + * const { List } = require("immutable"); + * import Immutable from "immutable"; + * import * as Immutable from "immutable"; + * import { List } from "immutable"; + * + */ +export = Immutable; + +/** + * A global "Immutable" namespace used by UMD modules which allows the use of + * the full Immutable API. + * + * If using Immutable as an imported module, prefer using: + * + * import Immutable from 'immutable' + * + */ +export as namespace Immutable; diff --git a/type-definitions/immutable.js.flow b/type-definitions/immutable.js.flow index ac9551132b..9ab444d234 100644 --- a/type-definitions/immutable.js.flow +++ b/type-definitions/immutable.js.flow @@ -2,49 +2,122 @@ * This file provides type definitions for use with the Flow type checker. * * An important caveat when using these definitions is that the types for - * `Iterable.Keyed`, `Iterable.Indexed`, `Seq.Keyed`, and so on are stubs. + * `Collection.Keyed`, `Collection.Indexed`, `Seq.Keyed`, and so on are stubs. * When referring to those types, you can get the proper definitions by - * importing the types `KeyedIterable`, `IndexedIterable`, `KeyedSeq`, etc. + * importing the types `KeyedCollection`, `IndexedCollection`, `KeyedSeq`, etc. * For example, * * import { Seq } from 'immutable' - * import type { IndexedIterable, IndexedSeq } from 'immutable' + * import type { IndexedCollection, IndexedSeq } from 'immutable' * * const someSeq: IndexedSeq = Seq.Indexed.of(1, 2, 3) * - * function takesASeq>(iter: TS): TS { + * function takesASeq>(iter: TS): TS { * return iter.butLast() * } * * takesASeq(someSeq) * - * @flow + * @flow strict */ -/* - * Alias for ECMAScript `Iterable` type, declared in - * https://github.com/facebook/flow/blob/master/lib/core.js - * - * Note that Immutable values implement the `ESIterable` interface. - */ -type ESIterable<+T> = $Iterable; - -declare class _Iterable { +// Helper type that represents plain objects allowed as arguments to +// some constructors and functions. +type PlainObjInput = { +[key: K]: V, __proto__: null }; + +type K = $Keys; + +// Helper types to extract the "keys" and "values" use by the *In() methods. +type $KeyOf = $Call< + ((?_Collection) => K) & + ((?$ReadOnlyArray) => number) & + ((?RecordInstance | T) => $Keys) & + ((T) => $Keys), + C, +>; + +type $ValOf> = $Call< + ((?_Collection) => V) & + ((?$ReadOnlyArray) => T) & + (>(?RecordInstance | T, K) => $ElementType) & + ((T) => $Values), + C, + K, +>; + +type $IterableOf = $Call< + ( | IndexedCollection | SetCollection>( + V + ) => Iterable<$ValOf>) & + (< + V: + | KeyedCollection + | RecordInstance + | PlainObjInput, + >( + V + ) => Iterable<[$KeyOf, $ValOf]>), + C, +>; + +const PairSorting: $ReadOnly<{ LeftThenRight: number, RightThenLeft: number }> = + { + LeftThenRight: -1, + RightThenLeft: +1, + }; + +type Comparator = (left: T, right: T) => number; + +declare class _Collection implements ValueObject { equals(other: mixed): boolean; hashCode(): number; - get(key: K, _: empty): V | void; + get(key: K, ..._: []): V | void; get(key: K, notSetValue: NSV): V | NSV; has(key: K): boolean; includes(value: V): boolean; contains(value: V): boolean; first(): V | void; + first(notSetValue: NSV): V | NSV; last(): V | void; - - getIn(searchKeyPath: ESIterable, notSetValue?: mixed): any; - hasIn(searchKeyPath: ESIterable): boolean; - - toJS(): mixed; - toArray(): Array; + last(notSetValue: NSV): V | NSV; + + hasIn(keyPath: Iterable): boolean; + + getIn(keyPath: [], notSetValue?: mixed): this; + getIn(keyPath: [K], notSetValue: NSV): V | NSV; + getIn>( + keyPath: [K, K2], + notSetValue: NSV + ): $ValOf | NSV; + getIn, K3: $KeyOf<$ValOf>>( + keyPath: [K, K2, K3], + notSetValue: NSV + ): $ValOf<$ValOf, K3> | NSV; + getIn< + NSV, + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + >( + keyPath: [K, K2, K3, K4], + notSetValue: NSV + ): $ValOf<$ValOf<$ValOf, K3>, K4> | NSV; + getIn< + NSV, + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf, K3>, K4>>, + >( + keyPath: [K, K2, K3, K4, K5], + notSetValue: NSV + ): $ValOf<$ValOf<$ValOf<$ValOf, K3>, K4>, K5> | NSV; + + update(updater: (value: this) => U): U; + + toJS(): Array | { [key: string]: mixed }; + toJSON(): Array | { [key: string]: V }; + toArray(): Array | Array<[K, V]>; toObject(): { [key: string]: V }; toMap(): Map; toOrderedMap(): OrderedMap; @@ -66,11 +139,11 @@ declare class _Iterable { entrySeq(): IndexedSeq<[K, V]>; reverse(): this; - sort(comparator?: (valueA: V, valueB: V) => number): this; + sort(comparator?: Comparator): this; sortBy( comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number + comparator?: Comparator ): this; groupBy( @@ -88,14 +161,21 @@ declare class _Iterable { butLast(): this; skip(amount: number): this; skipLast(amount: number): this; - skipWhile(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this; - skipUntil(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this; + skipWhile( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): this; + skipUntil( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): this; take(amount: number): this; takeLast(amount: number): this; - takeWhile(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this; - takeUntil(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): this; - - filter( + takeWhile( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): this; + takeUntil( predicate: (value: V, key: K, iter: this) => mixed, context?: mixed ): this; @@ -107,201 +187,298 @@ declare class _Iterable { reduce( reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: mixed, + initialReduction: R, + context?: mixed ): R; + reduce(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R; reduceRight( reducer: (reduction: R, value: V, key: K, iter: this) => R, - initialReduction?: R, - context?: mixed, + initialReduction: R, + context?: mixed + ): R; + reduceRight( + reducer: (reduction: V | R, value: V, key: K, iter: this) => R ): R; - every(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): boolean; - some(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): boolean; + every( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): boolean; + some( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): boolean; join(separator?: string): string; isEmpty(): boolean; - count(predicate?: (value: V, key: K, iter: this) => mixed, context?: mixed): number; - countBy(grouper: (value: V, key: K, iter: this) => G, context?: mixed): Map; + count( + predicate?: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): number; + countBy( + grouper: (value: V, key: K, iter: this) => G, + context?: mixed + ): Map; - find( + find( predicate: (value: V, key: K, iter: this) => mixed, context?: mixed, - notSetValue?: NSV - ): V | NSV; - findLast( + notSetValue?: V + ): V | void; + findLast( predicate: (value: V, key: K, iter: this) => mixed, context?: mixed, - notSetValue?: NSV - ): V | NSV; + notSetValue?: V + ): V | void; findEntry(predicate: (value: V, key: K, iter: this) => mixed): [K, V] | void; - findLastEntry(predicate: (value: V, key: K, iter: this) => mixed): [K, V] | void; + findLastEntry( + predicate: (value: V, key: K, iter: this) => mixed + ): [K, V] | void; - findKey(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): K | void; - findLastKey(predicate: (value: V, key: K, iter: this) => mixed, context?: mixed): K | void; + findKey( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): K | void; + findLastKey( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): K | void; keyOf(searchValue: V): K | void; lastKeyOf(searchValue: V): K | void; - max(comparator?: (valueA: V, valueB: V) => number): V; + max(comparator?: Comparator): V; maxBy( comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number + comparator?: Comparator ): V; - min(comparator?: (valueA: V, valueB: V) => number): V; + min(comparator?: Comparator): V; minBy( comparatorValueMapper: (value: V, key: K, iter: this) => C, - comparator?: (valueA: C, valueB: C) => number + comparator?: Comparator ): V; - isSubset(iter: ESIterable): boolean; - isSuperset(iter: ESIterable): boolean; + isSubset(iter: Iterable): boolean; + isSuperset(iter: Iterable): boolean; } -declare function isIterable(maybeIterable: mixed): boolean %checks(maybeIterable instanceof Iterable); -declare function isKeyed(maybeKeyed: mixed): boolean %checks(maybeKeyed instanceof KeyedIterable); -declare function isIndexed(maybeIndexed: mixed): boolean %checks(maybeIndexed instanceof IndexedIterable); -declare function isAssociative(maybeAssociative: mixed): boolean %checks( - maybeAssociative instanceof KeyedIterable || - maybeAssociative instanceof IndexedIterable -); -declare function isOrdered(maybeOrdered: mixed): boolean %checks( - maybeOrdered instanceof IndexedIterable || +declare function isImmutable( + maybeImmutable: mixed +): boolean %checks(maybeImmutable instanceof Collection); +declare function isCollection( + maybeCollection: mixed +): boolean %checks(maybeCollection instanceof Collection); +declare function isKeyed( + maybeKeyed: mixed +): boolean %checks(maybeKeyed instanceof KeyedCollection); +declare function isIndexed( + maybeIndexed: mixed +): boolean %checks(maybeIndexed instanceof IndexedCollection); +declare function isAssociative( + maybeAssociative: mixed +): boolean %checks(maybeAssociative instanceof KeyedCollection || + maybeAssociative instanceof IndexedCollection); +declare function isOrdered( + maybeOrdered: mixed +): boolean %checks(maybeOrdered instanceof IndexedCollection || maybeOrdered instanceof OrderedMap || - maybeOrdered instanceof OrderedSet -); + maybeOrdered instanceof OrderedSet); +declare function isValueObject(maybeValue: mixed): boolean; + +declare function isSeq(maybeSeq: any): boolean %checks(maybeSeq instanceof Seq); +declare function isList(maybeList: any): boolean %checks(maybeList instanceof + List); +declare function isMap(maybeMap: any): boolean %checks(maybeMap instanceof Map); +declare function isOrderedMap( + maybeOrderedMap: any +): boolean %checks(maybeOrderedMap instanceof OrderedMap); +declare function isStack(maybeStack: any): boolean %checks(maybeStack instanceof + Stack); +declare function isSet(maybeSet: any): boolean %checks(maybeSet instanceof Set); +declare function isOrderedSet( + maybeOrderedSet: any +): boolean %checks(maybeOrderedSet instanceof OrderedSet); +declare function isRecord( + maybeRecord: any +): boolean %checks(maybeRecord instanceof Record); + +declare interface ValueObject { + equals(other: mixed): boolean; + hashCode(): number; +} -declare class Iterable extends _Iterable { - static Keyed: typeof KeyedIterable; - static Indexed: typeof IndexedIterable; - static Set: typeof SetIterable; +declare class Collection extends _Collection { + static Keyed: typeof KeyedCollection; + static Indexed: typeof IndexedCollection; + static Set: typeof SetCollection; - static isIterable: typeof isIterable; + static isCollection: typeof isCollection; static isKeyed: typeof isKeyed; static isIndexed: typeof isIndexed; static isAssociative: typeof isAssociative; static isOrdered: typeof isOrdered; } -declare class KeyedIterable extends Iterable { - static (iter?: ESIterable<[K, V]>): KeyedIterable; - static (obj?: { [key: K]: V }): KeyedIterable; +declare class KeyedCollection extends Collection { + static ( + values?: Iterable<[K, V]> | PlainObjInput + ): KeyedCollection; toJS(): { [key: string]: mixed }; + toJSON(): { [key: string]: V }; + toArray(): Array<[K, V]>; @@iterator(): Iterator<[K, V]>; toSeq(): KeyedSeq; - flip(): KeyedIterable; + flip(): KeyedCollection; - concat(...iters: ESIterable<[K, V]>[]): this; + concat( + ...iters: Array | PlainObjInput> + ): KeyedCollection; + + filter(predicate: typeof Boolean): KeyedCollection>; + filter( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): KeyedCollection; + + partition( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): [this, this]; map( mapper: (value: V, key: K, iter: this) => M, context?: mixed - ): KeyedIterable; + ): KeyedCollection; mapKeys( mapper: (key: K, value: V, iter: this) => M, context?: mixed - ): KeyedIterable; + ): KeyedCollection; mapEntries( mapper: (entry: [K, V], index: number, iter: this) => [KM, VM], context?: mixed - ): KeyedIterable; + ): KeyedCollection; flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable<[KM, VM]>, + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: mixed - ): KeyedIterable; + ): KeyedCollection; - flatten(depth?: number): KeyedIterable; - flatten(shallow?: boolean): KeyedIterable; + flatten(depth?: number): KeyedCollection; + flatten(shallow?: boolean): KeyedCollection; } -Iterable.Keyed = KeyedIterable +Collection.Keyed = KeyedCollection; -declare class IndexedIterable<+T> extends Iterable { - static (iter?: ESIterable): IndexedIterable; +declare class IndexedCollection<+T> extends Collection { + static (iter?: Iterable): IndexedCollection; toJS(): Array; + toJSON(): Array; + toArray(): Array; @@iterator(): Iterator; toSeq(): IndexedSeq; fromEntrySeq(): KeyedSeq; interpose(separator: T): this; - interleave(...iterables: ESIterable[]): this; - splice( - index: number, - removeNum: number, - ...values: T[] - ): this; + interleave(...collections: Iterable[]): this; + splice(index: number, removeNum: number, ...values: T[]): this; - zip( - a: ESIterable, - _: empty - ): IndexedIterable<[T, A]>; + zip(a: Iterable, ..._: []): IndexedCollection<[T, A]>; zip( - a: ESIterable, - b: ESIterable, - _: empty - ): IndexedIterable<[T, A, B]>; + a: Iterable, + b: Iterable, + ..._: [] + ): IndexedCollection<[T, A, B]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): IndexedIterable<[T, A, B, C]>; + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): IndexedCollection<[T, A, B, C]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): IndexedIterable<[T, A, B, C, D]>; + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): IndexedCollection<[T, A, B, C, D]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): IndexedIterable<[T, A, B, C, D, E]>; + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): IndexedCollection<[T, A, B, C, D, E]>; + + zipAll(a: Iterable, ..._: []): IndexedCollection<[T | void, A | void]>; + zipAll( + a: Iterable, + b: Iterable, + ..._: [] + ): IndexedCollection<[T | void, A | void, B | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): IndexedCollection<[T | void, A | void, B | void, C | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): IndexedCollection<[T | void, A | void, B | void, C | void, D | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): IndexedCollection< + [T | void, A | void, B | void, C | void, D | void, E | void], + >; zipWith( zipper: (value: T, a: A) => R, - a: ESIterable, - _: empty - ): IndexedIterable; + a: Iterable, + ..._: [] + ): IndexedCollection; zipWith( zipper: (value: T, a: A, b: B) => R, - a: ESIterable, - b: ESIterable, - _: empty - ): IndexedIterable; + a: Iterable, + b: Iterable, + ..._: [] + ): IndexedCollection; zipWith( zipper: (value: T, a: A, b: B, c: C) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty - ): IndexedIterable; + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): IndexedCollection; zipWith( zipper: (value: T, a: A, b: B, c: C, d: D) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty - ): IndexedIterable; + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): IndexedCollection; zipWith( zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty - ): IndexedIterable; + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): IndexedCollection; indexOf(searchValue: T): number; lastIndexOf(searchValue: T): number; @@ -314,96 +491,115 @@ declare class IndexedIterable<+T> extends Iterable { context?: mixed ): number; - concat(...iters: ESIterable[]): this; + concat(...iters: Array | C>): IndexedCollection; + + filter(predicate: typeof Boolean): IndexedCollection<$NonMaybeType>; + filter( + predicate: (value: T, index: number, iter: this) => mixed, + context?: mixed + ): IndexedCollection; + + partition( + predicate: (value: T, index: number, iter: this) => mixed, + context?: mixed + ): [this, this]; map( mapper: (value: T, index: number, iter: this) => M, context?: mixed - ): IndexedIterable; + ): IndexedCollection; flatMap( - mapper: (value: T, index: number, iter: this) => ESIterable, + mapper: (value: T, index: number, iter: this) => Iterable, context?: mixed - ): IndexedIterable; + ): IndexedCollection; - flatten(depth?: number): IndexedIterable; - flatten(shallow?: boolean): IndexedIterable; + flatten(depth?: number): IndexedCollection; + flatten(shallow?: boolean): IndexedCollection; } -declare class SetIterable<+T> extends Iterable { - static (iter?: ESIterable): SetIterable; +declare class SetCollection<+T> extends Collection { + static (iter?: Iterable): SetCollection; toJS(): Array; + toJSON(): Array; + toArray(): Array; @@iterator(): Iterator; toSeq(): SetSeq; - concat(...iters: ESIterable[]): this; + concat(...collections: Iterable[]): SetCollection; + + // `filter`, `map` and `flatMap` cannot be defined further up the hierarchy, + // because the implementation for `KeyedCollection` allows the value type to + // change without constraining the key type. That does not work for + // `SetCollection` - the value and key types *must* match. + filter(predicate: typeof Boolean): SetCollection<$NonMaybeType>; + filter( + predicate: (value: T, value: T, iter: this) => mixed, + context?: mixed + ): SetCollection; + + partition( + predicate: (value: T, value: T, iter: this) => mixed, + context?: mixed + ): [this, this]; - // `map` and `flatMap` cannot be defined further up the hiearchy, because the - // implementation for `KeyedIterable` allows the value type to change without - // constraining the key type. That does not work for `SetIterable` - the value - // and key types *must* match. map( mapper: (value: T, value: T, iter: this) => M, context?: mixed - ): SetIterable; + ): SetCollection; flatMap( - mapper: (value: T, value: T, iter: this) => ESIterable, + mapper: (value: T, value: T, iter: this) => Iterable, context?: mixed - ): SetIterable; - - flatten(depth?: number): SetIterable; - flatten(shallow?: boolean): SetIterable; -} + ): SetCollection; -declare class Collection extends _Iterable { - static Keyed: typeof KeyedCollection; - static Indexed: typeof IndexedCollection; - static Set: typeof SetCollection; - - size: number; -} - -declare class KeyedCollection extends Collection mixins KeyedIterable { - toSeq(): KeyedSeq; + flatten(depth?: number): SetCollection; + flatten(shallow?: boolean): SetCollection; } -declare class IndexedCollection<+T> extends Collection mixins IndexedIterable { - toSeq(): IndexedSeq; -} - -declare class SetCollection<+T> extends Collection mixins SetIterable { - toSeq(): SetSeq; -} - -declare function isSeq(maybeSeq: mixed): boolean %checks(maybeSeq instanceof Seq); -declare class Seq extends _Iterable { +declare function isSeq(maybeSeq: mixed): boolean %checks(maybeSeq instanceof + Seq); +declare class Seq extends _Collection { static Keyed: typeof KeyedSeq; static Indexed: typeof IndexedSeq; static Set: typeof SetSeq; - static (iter: KeyedSeq): KeyedSeq; - static (iter: SetSeq): SetSeq; - static (iter?: ESIterable): IndexedSeq; - static (iter: { [key: K]: V }): KeyedSeq; - - static of(...values: T[]): IndexedSeq; + static (values: KeyedSeq): KeyedSeq; + static (values: SetSeq): SetSeq; + static (values: Iterable): IndexedSeq; + static (values?: PlainObjInput): KeyedSeq; static isSeq: typeof isSeq; - size?: number; + size: number | void; cacheResult(): this; toSeq(): this; } -declare class KeyedSeq extends Seq mixins KeyedIterable { - static (iter?: ESIterable<[K, V]>): KeyedSeq; - static (iter?: { [key: K]: V }): KeyedSeq; +declare class KeyedSeq extends Seq mixins KeyedCollection { + static ( + values?: Iterable<[K, V]> | PlainObjInput + ): KeyedSeq; // Override specialized return types flip(): KeyedSeq; + concat( + ...iters: Array | PlainObjInput> + ): KeyedSeq; + + filter(predicate: typeof Boolean): KeyedSeq>; + filter( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): KeyedSeq; + + partition( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): [this, this]; + map( mapper: (value: V, key: K, iter: this) => M, context?: mixed @@ -420,7 +616,7 @@ declare class KeyedSeq extends Seq mixins KeyedIterable { ): KeyedSeq; flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable<[KM, VM]>, + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: mixed ): KeyedSeq; @@ -428,106 +624,158 @@ declare class KeyedSeq extends Seq mixins KeyedIterable { flatten(shallow?: boolean): KeyedSeq; } -declare class IndexedSeq<+T> extends Seq mixins IndexedIterable { - static (iter?: ESIterable): IndexedSeq; +declare class IndexedSeq<+T> + extends Seq + mixins IndexedCollection +{ + static (values?: Iterable): IndexedSeq; static of(...values: T[]): IndexedSeq; // Override specialized return types + + concat(...iters: Array | C>): IndexedSeq; + + filter(predicate: typeof Boolean): IndexedSeq<$NonMaybeType>; + filter( + predicate: (value: T, index: number, iter: this) => mixed, + context?: mixed + ): IndexedSeq; + + partition( + predicate: (value: T, index: number, iter: this) => mixed, + context?: mixed + ): [this, this]; + map( mapper: (value: T, index: number, iter: this) => M, context?: mixed ): IndexedSeq; flatMap( - mapper: (value: T, index: number, iter: this) => ESIterable, + mapper: (value: T, index: number, iter: this) => Iterable, context?: mixed ): IndexedSeq; flatten(depth?: number): IndexedSeq; flatten(shallow?: boolean): IndexedSeq; - zip( - a: ESIterable, - _: empty - ): IndexedSeq<[T, A]>; - zip( - a: ESIterable, - b: ESIterable, - _: empty - ): IndexedSeq<[T, A, B]>; + zip(a: Iterable, ..._: []): IndexedSeq<[T, A]>; + zip(a: Iterable, b: Iterable, ..._: []): IndexedSeq<[T, A, B]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] ): IndexedSeq<[T, A, B, C]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] ): IndexedSeq<[T, A, B, C, D]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] ): IndexedSeq<[T, A, B, C, D, E]>; + zipAll(a: Iterable, ..._: []): IndexedSeq<[T | void, A | void]>; + zipAll( + a: Iterable, + b: Iterable, + ..._: [] + ): IndexedSeq<[T | void, A | void, B | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): IndexedSeq<[T | void, A | void, B | void, C | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): IndexedSeq<[T | void, A | void, B | void, C | void, D | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): IndexedSeq<[T | void, A | void, B | void, C | void, D | void, E | void]>; + zipWith( zipper: (value: T, a: A) => R, - a: ESIterable, - _: empty + a: Iterable, + ..._: [] ): IndexedSeq; zipWith( zipper: (value: T, a: A, b: B) => R, - a: ESIterable, - b: ESIterable, - _: empty + a: Iterable, + b: Iterable, + ..._: [] ): IndexedSeq; zipWith( zipper: (value: T, a: A, b: B, c: C) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] ): IndexedSeq; zipWith( zipper: (value: T, a: A, b: B, c: C, d: D) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] ): IndexedSeq; zipWith( zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] ): IndexedSeq; } -declare class SetSeq<+T> extends Seq mixins SetIterable { - static (iter?: ESIterable): IndexedSeq; +declare class SetSeq<+T> extends Seq mixins SetCollection { + static (values?: Iterable): SetSeq; static of(...values: T[]): SetSeq; // Override specialized return types + + concat(...collections: Iterable[]): SetSeq; + + filter(predicate: typeof Boolean): SetSeq<$NonMaybeType>; + filter( + predicate: (value: T, value: T, iter: this) => mixed, + context?: mixed + ): SetSeq; + + partition( + predicate: (value: T, value: T, iter: this) => mixed, + context?: mixed + ): [this, this]; + map( mapper: (value: T, value: T, iter: this) => M, context?: mixed ): SetSeq; flatMap( - mapper: (value: T, value: T, iter: this) => ESIterable, + mapper: (value: T, value: T, iter: this) => Iterable, context?: mixed ): SetSeq; @@ -535,14 +783,169 @@ declare class SetSeq<+T> extends Seq mixins SetIterable { flatten(shallow?: boolean): SetSeq; } -declare function isList(maybeList: mixed): boolean %checks(maybeList instanceof List); -declare class List<+T> extends IndexedCollection { - static (iterable?: ESIterable): List; +declare class UpdatableInCollection { + setIn(keyPath: [], value: S): S; + setIn(keyPath: [K], value: V): this; + setIn, S: $ValOf>(keyPath: [K, K2], value: S): this; + setIn, K3: $KeyOf<$ValOf>, S: $ValOf<$ValOf, K3>>( + keyPath: [K, K2, K3], + value: S + ): this; + setIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + S: $ValOf<$ValOf<$ValOf, K3>, K4>, + >( + keyPath: [K, K2, K3, K4], + value: S + ): this; + setIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K3>, K4>, K5>, + >( + keyPath: [K, K2, K3, K4, K5], + value: S + ): this; + + deleteIn(keyPath: []): void; + deleteIn(keyPath: [K]): this; + deleteIn>(keyPath: [K, K2]): this; + deleteIn, K3: $KeyOf<$ValOf>>( + keyPath: [K, K2, K3] + ): this; + deleteIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + >( + keyPath: [K, K2, K3, K4] + ): this; + deleteIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf, K3>, K4>>, + >( + keyPath: [K, K2, K3, K4, K5] + ): this; + + removeIn(keyPath: []): void; + removeIn(keyPath: [K]): this; + removeIn>(keyPath: [K, K2]): this; + removeIn, K3: $KeyOf<$ValOf>>( + keyPath: [K, K2, K3] + ): this; + removeIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + >( + keyPath: [K, K2, K3, K4] + ): this; + removeIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf, K3>, K4>>, + >( + keyPath: [K, K2, K3, K4, K5] + ): this; + + updateIn(keyPath: [], notSetValue: mixed, updater: (value: this) => U): U; + updateIn(keyPath: [], updater: (value: this) => U): U; + updateIn(keyPath: [K], notSetValue: NSV, updater: (value: V) => V): this; + updateIn(keyPath: [K], updater: (value: V) => V): this; + updateIn, S: $ValOf>( + keyPath: [K, K2], + notSetValue: NSV, + updater: (value: $ValOf | NSV) => S + ): this; + updateIn, S: $ValOf>( + keyPath: [K, K2], + updater: (value: $ValOf) => S + ): this; + updateIn< + NSV, + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + S: $ValOf<$ValOf, K3>, + >( + keyPath: [K, K2, K3], + notSetValue: NSV, + updater: (value: $ValOf<$ValOf, K3> | NSV) => S + ): this; + updateIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + S: $ValOf<$ValOf, K3>, + >( + keyPath: [K, K2, K3], + updater: (value: $ValOf<$ValOf, K3>) => S + ): this; + updateIn< + NSV, + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + S: $ValOf<$ValOf<$ValOf, K3>, K4>, + >( + keyPath: [K, K2, K3, K4], + notSetValue: NSV, + updater: (value: $ValOf<$ValOf<$ValOf, K3>, K4> | NSV) => S + ): this; + updateIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + S: $ValOf<$ValOf<$ValOf, K3>, K4>, + >( + keyPath: [K, K2, K3, K4], + updater: (value: $ValOf<$ValOf<$ValOf, K3>, K4>) => S + ): this; + updateIn< + NSV, + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K3>, K4>, K5>, + >( + keyPath: [K, K2, K3, K4, K5], + notSetValue: NSV, + updater: ( + value: $ValOf<$ValOf<$ValOf<$ValOf, K3>, K4>, K5> | NSV + ) => S + ): this; + updateIn< + K2: $KeyOf, + K3: $KeyOf<$ValOf>, + K4: $KeyOf<$ValOf<$ValOf, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K3>, K4>, K5>, + >( + keyPath: [K, K2, K3, K4, K5], + updater: (value: $ValOf<$ValOf<$ValOf<$ValOf, K3>, K4>, K5>) => S + ): this; +} + +declare function isList(maybeList: mixed): boolean %checks(maybeList instanceof + List); +declare class List<+T> + extends IndexedCollection + mixins UpdatableInCollection +{ + static (collection?: Iterable): List; static of(...values: T[]): List; static isList: typeof isList; + size: number; + set(index: number, value: U): List; delete(index: number): this; remove(index: number): this; @@ -553,195 +956,224 @@ declare class List<+T> extends IndexedCollection { unshift(...values: U[]): List; shift(): this; - update(updater: (value: this) => List): List; + update(updater: (value: this) => U): U; update(index: number, updater: (value: T) => U): List; - update(index: number, notSetValue: U, updater: (value: T) => U): List; - - merge(...iterables: ESIterable[]): List; - - mergeWith( - merger: (previous: T, next: U, key: number) => V, - ...iterables: ESIterable[] - ): List; - - mergeDeep(...iterables: ESIterable[]): List; + update( + index: number, + notSetValue: U, + updater: (value: T) => U + ): List; - mergeDeepWith( - merger: (previous: T, next: U, key: number) => V, - ...iterables: ESIterable[] - ): List; + merge(...collections: Iterable[]): List; setSize(size: number): this; - setIn(keyPath: ESIterable, value: mixed): this; - deleteIn(keyPath: ESIterable, value: mixed): this; - removeIn(keyPath: ESIterable, value: mixed): this; - updateIn( - keyPath: ESIterable, - notSetValue: mixed, - updater: (value: any) => mixed - ): this; - updateIn( - keyPath: ESIterable, - updater: (value: any) => mixed + mergeIn(keyPath: Iterable, ...collections: Iterable[]): this; + mergeDeepIn( + keyPath: Iterable, + ...collections: Iterable[] ): this; - mergeIn(keyPath: ESIterable, ...iterables: ESIterable[]): this; - mergeDeepIn(keyPath: ESIterable, ...iterables: ESIterable[]): this; - - withMutations(mutator: (mutable: this) => this | void): this; + withMutations(mutator: (mutable: this) => mixed): this; asMutable(): this; + wasAltered(): boolean; asImmutable(): this; // Override specialized return types + + concat(...iters: Array | C>): List; + + filter(predicate: typeof Boolean): List<$NonMaybeType>; + filter( + predicate: (value: T, index: number, iter: this) => mixed, + context?: mixed + ): List; + + partition( + predicate: (value: T, index: number, iter: this) => mixed, + context?: mixed + ): [this, this]; + map( mapper: (value: T, index: number, iter: this) => M, context?: mixed ): List; flatMap( - mapper: (value: T, index: number, iter: this) => ESIterable, + mapper: (value: T, index: number, iter: this) => Iterable, context?: mixed ): List; flatten(depth?: number): List; flatten(shallow?: boolean): List; - zip( - a: ESIterable, - _: empty - ): List<[T, A]>; - zip( - a: ESIterable, - b: ESIterable, - _: empty - ): List<[T, A, B]>; + zip(a: Iterable, ..._: []): List<[T, A]>; + zip(a: Iterable, b: Iterable, ..._: []): List<[T, A, B]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] ): List<[T, A, B, C]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] ): List<[T, A, B, C, D]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] ): List<[T, A, B, C, D, E]>; + zipAll(a: Iterable, ..._: []): List<[T | void, A | void]>; + zipAll( + a: Iterable, + b: Iterable, + ..._: [] + ): List<[T | void, A | void, B | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): List<[T | void, A | void, B | void, C | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): List<[T | void, A | void, B | void, C | void, D | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): List<[T | void, A | void, B | void, C | void, D | void, E | void]>; + zipWith( zipper: (value: T, a: A) => R, - a: ESIterable, - _: empty + a: Iterable, + ..._: [] ): List; zipWith( zipper: (value: T, a: A, b: B) => R, - a: ESIterable, - b: ESIterable, - _: empty + a: Iterable, + b: Iterable, + ..._: [] ): List; zipWith( zipper: (value: T, a: A, b: B, c: C) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] ): List; zipWith( zipper: (value: T, a: A, b: B, c: C, d: D) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] ): List; zipWith( zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] ): List; } -declare function isMap(maybeMap: mixed): boolean %checks(maybeMap instanceof Map); -declare class Map extends KeyedCollection { - static (obj?: {[key: K]: V}): Map; - static (iterable: ESIterable<[K, V]>): Map; +declare function isMap(maybeMap: mixed): boolean %checks(maybeMap instanceof + Map); +declare class Map + extends KeyedCollection + mixins UpdatableInCollection +{ + static (values?: Iterable<[K, V]> | PlainObjInput): Map; static isMap: typeof isMap; + size: number; + set(key: K_, value: V_): Map; delete(key: K): this; remove(key: K): this; clear(): this; - deleteAll(keys: ESIterable): Map; - removeAll(keys: ESIterable): Map; + deleteAll(keys: Iterable): Map; + removeAll(keys: Iterable): Map; - update(updater: (value: this) => Map): Map; + update(updater: (value: this) => U): U; update(key: K, updater: (value: V) => V_): Map; - update(key: K, notSetValue: V_, updater: (value: V) => V_): Map; + update( + key: K, + notSetValue: V_, + updater: (value: V) => V_ + ): Map; merge( - ...iterables: (ESIterable<[K_, V_]> | { [key: K_]: V_ })[] + ...collections: (Iterable<[K_, V_]> | PlainObjInput)[] + ): Map; + concat( + ...collections: (Iterable<[K_, V_]> | PlainObjInput)[] ): Map; mergeWith( - merger: (previous: V, next: W, key: K) => X, - ...iterables: (ESIterable<[K_, W]> | { [key: K_]: W })[] + merger: (oldVal: V, newVal: W, key: K) => X, + ...collections: (Iterable<[K_, W]> | PlainObjInput)[] ): Map; mergeDeep( - ...iterables: (ESIterable<[K_, V_]> | { [key: K_]: V_ })[] + ...collections: (Iterable<[K_, V_]> | PlainObjInput)[] ): Map; - mergeDeepWith( - merger: (previous: V, next: W, key: K) => X, - ...iterables: (ESIterable<[K_, W]> | { [key: K_]: W })[] - ): Map; - - setIn(keyPath: ESIterable, value: mixed): this; - deleteIn(keyPath: ESIterable, value: mixed): this; - removeIn(keyPath: ESIterable, value: mixed): this; - - updateIn( - keyPath: ESIterable, - notSetValue: mixed, - updater: (value: any) => mixed - ): this; - updateIn( - keyPath: ESIterable, - updater: (value: any) => mixed - ): this; + mergeDeepWith( + merger: (oldVal: any, newVal: any, key: any) => mixed, + ...collections: (Iterable<[K_, V_]> | PlainObjInput)[] + ): Map; mergeIn( - keyPath: ESIterable, - ...iterables: (ESIterable | { [key: string]: mixed })[] + keyPath: Iterable, + ...collections: (Iterable | PlainObjInput)[] ): this; mergeDeepIn( - keyPath: ESIterable, - ...iterables: (ESIterable | { [key: string]: mixed })[] + keyPath: Iterable, + ...collections: (Iterable | PlainObjInput)[] ): this; - withMutations(mutator: (mutable: this) => this | void): this; + withMutations(mutator: (mutable: this) => mixed): this; asMutable(): this; + wasAltered(): boolean; asImmutable(): this; // Override specialized return types + flip(): Map; + filter(predicate: typeof Boolean): Map>; + filter( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): Map; + + partition( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): [this, this]; + map( mapper: (value: V, key: K, iter: this) => M, context?: mixed @@ -758,7 +1190,7 @@ declare class Map extends KeyedCollection { ): Map; flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable<[KM, VM]>, + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: mixed ): Map; @@ -766,70 +1198,84 @@ declare class Map extends KeyedCollection { flatten(shallow?: boolean): Map; } -declare function isOrderedMap(maybeOrderedMap: mixed): boolean %checks(maybeOrderedMap instanceof OrderedMap); -declare class OrderedMap extends KeyedCollection { - static (obj?: {[key: K]: V}): OrderedMap; - static (iterable: ESIterable<[K, V]>): OrderedMap; +declare function isOrderedMap( + maybeOrderedMap: mixed +): boolean %checks(maybeOrderedMap instanceof OrderedMap); +declare class OrderedMap + extends Map + mixins UpdatableInCollection +{ + static ( + values?: Iterable<[K, V]> | PlainObjInput + ): OrderedMap; static isOrderedMap: typeof isOrderedMap; + size: number; + set(key: K_, value: V_): OrderedMap; delete(key: K): this; remove(key: K): this; clear(): this; - update(updater: (value: this) => OrderedMap): OrderedMap; + update(updater: (value: this) => U): U; update(key: K, updater: (value: V) => V_): OrderedMap; - update(key: K, notSetValue: V_, updater: (value: V) => V_): OrderedMap; + update( + key: K, + notSetValue: V_, + updater: (value: V) => V_ + ): OrderedMap; merge( - ...iterables: (ESIterable<[K_, V_]> | { [key: K_]: V_ })[] + ...collections: (Iterable<[K_, V_]> | PlainObjInput)[] + ): OrderedMap; + concat( + ...collections: (Iterable<[K_, V_]> | PlainObjInput)[] ): OrderedMap; mergeWith( - merger: (previous: V, next: W, key: K) => X, - ...iterables: (ESIterable<[K_, W]> | { [key: K_]: W })[] + merger: (oldVal: V, newVal: W, key: K) => X, + ...collections: (Iterable<[K_, W]> | PlainObjInput)[] ): OrderedMap; mergeDeep( - ...iterables: (ESIterable<[K_, V_]> | { [key: K_]: V_ })[] + ...collections: (Iterable<[K_, V_]> | PlainObjInput)[] ): OrderedMap; - mergeDeepWith( - merger: (previous: V, next: W, key: K) => X, - ...iterables: (ESIterable<[K_, W]> | { [key: K_]: W })[] - ): OrderedMap; - - setIn(keyPath: ESIterable, value: mixed): OrderedMap; - deleteIn(keyPath: ESIterable, value: mixed): this; - removeIn(keyPath: ESIterable, value: mixed): this; - - updateIn( - keyPath: ESIterable, - notSetValue: mixed, - updater: (value: any) => mixed - ): this; - updateIn( - keyPath: ESIterable, - updater: (value: any) => mixed - ): this; + mergeDeepWith( + merger: (oldVal: any, newVal: any, key: any) => mixed, + ...collections: (Iterable<[K_, V_]> | PlainObjInput)[] + ): OrderedMap; mergeIn( - keyPath: ESIterable, - ...iterables: (ESIterable | { [key: string]: mixed })[] + keyPath: Iterable, + ...collections: (Iterable | PlainObjInput)[] ): this; mergeDeepIn( - keyPath: ESIterable, - ...iterables: (ESIterable | { [key: string]: mixed })[] + keyPath: Iterable, + ...collections: (Iterable | PlainObjInput)[] ): this; - withMutations(mutator: (mutable: this) => this | void): this; + withMutations(mutator: (mutable: this) => mixed): this; asMutable(): this; + wasAltered(): boolean; asImmutable(): this; // Override specialized return types + flip(): OrderedMap; + filter(predicate: typeof Boolean): OrderedMap>; + filter( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): OrderedMap; + + partition( + predicate: (value: V, key: K, iter: this) => mixed, + context?: mixed + ): [this, this]; + map( mapper: (value: V, key: K, iter: this) => M, context?: mixed @@ -846,7 +1292,7 @@ declare class OrderedMap extends KeyedCollection { ): OrderedMap; flatMap( - mapper: (value: V, key: K, iter: this) => ESIterable<[KM, VM]>, + mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: mixed ): OrderedMap; @@ -854,37 +1300,58 @@ declare class OrderedMap extends KeyedCollection { flatten(shallow?: boolean): OrderedMap; } -declare function isSet(maybeSet: mixed): boolean %checks(maybeSet instanceof Set); +declare function isSet(maybeSet: mixed): boolean %checks(maybeSet instanceof + Set); declare class Set<+T> extends SetCollection { - static (iterable?: ESIterable): Set; + static (values?: Iterable): Set; static of(...values: T[]): Set; - static fromKeys(iter: ESIterable<[T, mixed]>): Set; - static fromKeys(object: { [key: K]: V }): Set; + static fromKeys( + values: Iterable<[T, mixed]> | PlainObjInput + ): Set; + + static intersect(sets: Iterable>): Set; + static union(sets: Iterable>): Set; static isSet: typeof isSet; + size: number; + add(value: U): Set; delete(value: T): this; remove(value: T): this; clear(): this; - union(...iterables: ESIterable[]): Set; - merge(...iterables: ESIterable[]): Set; - intersect(...iterables: ESIterable[]): Set; - subtract(...iterables: ESIterable[]): this; + union(...collections: Iterable[]): Set; + merge(...collections: Iterable[]): Set; + concat(...collections: Iterable[]): Set; + intersect(...collections: Iterable[]): Set; + subtract(...collections: Iterable[]): this; - withMutations(mutator: (mutable: this) => this | void): this; + withMutations(mutator: (mutable: this) => mixed): this; asMutable(): this; + wasAltered(): boolean; asImmutable(): this; // Override specialized return types + + filter(predicate: typeof Boolean): Set<$NonMaybeType>; + filter( + predicate: (value: T, value: T, iter: this) => mixed, + context?: mixed + ): Set; + + partition( + predicate: (value: T, value: T, iter: this) => mixed, + context?: mixed + ): [this, this]; + map( mapper: (value: T, value: T, iter: this) => M, context?: mixed ): Set; flatMap( - mapper: (value: T, value: T, iter: this) => ESIterable, + mapper: (value: T, value: T, iter: this) => Iterable, context?: mixed ): Set; @@ -893,21 +1360,37 @@ declare class Set<+T> extends SetCollection { } // Overrides except for `isOrderedSet` are for specialized return types -declare function isOrderedSet(maybeOrderedSet: mixed): boolean %checks(maybeOrderedSet instanceof OrderedSet); +declare function isOrderedSet( + maybeOrderedSet: mixed +): boolean %checks(maybeOrderedSet instanceof OrderedSet); declare class OrderedSet<+T> extends Set { - static (iterable: ESIterable): OrderedSet; - static (_: void): OrderedSet; + static (values?: Iterable): OrderedSet; static of(...values: T[]): OrderedSet; - static fromKeys(iter: ESIterable<[T, mixed]>): OrderedSet; - static fromKeys(object: { [key: K]: V }): OrderedSet; + static fromKeys( + values: Iterable<[T, mixed]> | PlainObjInput + ): OrderedSet; static isOrderedSet: typeof isOrderedSet; + size: number; + add(value: U): OrderedSet; - union(...iterables: ESIterable[]): OrderedSet; - merge(...iterables: ESIterable[]): OrderedSet; - intersect(...iterables: ESIterable[]): OrderedSet; + union(...collections: Iterable[]): OrderedSet; + merge(...collections: Iterable[]): OrderedSet; + concat(...collections: Iterable[]): OrderedSet; + intersect(...collections: Iterable[]): OrderedSet; + + filter(predicate: typeof Boolean): OrderedSet<$NonMaybeType>; + filter( + predicate: (value: T, value: T, iter: this) => mixed, + context?: mixed + ): OrderedSet; + + partition( + predicate: (value: T, value: T, iter: this) => mixed, + context?: mixed + ): [this, this]; map( mapper: (value: T, value: T, iter: this) => M, @@ -915,142 +1398,925 @@ declare class OrderedSet<+T> extends Set { ): OrderedSet; flatMap( - mapper: (value: T, value: T, iter: this) => ESIterable, + mapper: (value: T, value: T, iter: this) => Iterable, context?: mixed ): OrderedSet; flatten(depth?: number): OrderedSet; flatten(shallow?: boolean): OrderedSet; - zip( - a: ESIterable, - _: empty - ): OrderedSet<[T, A]>; - zip( - a: ESIterable, - b: ESIterable, - _: empty - ): OrderedSet<[T, A, B]>; + zip(a: Iterable, ..._: []): OrderedSet<[T, A]>; + zip(a: Iterable, b: Iterable, ..._: []): OrderedSet<[T, A, B]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] ): OrderedSet<[T, A, B, C]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] ): OrderedSet<[T, A, B, C, D]>; zip( - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] ): OrderedSet<[T, A, B, C, D, E]>; + zipAll(a: Iterable, ..._: []): OrderedSet<[T | void, A | void]>; + zipAll( + a: Iterable, + b: Iterable, + ..._: [] + ): OrderedSet<[T | void, A | void, B | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): OrderedSet<[T | void, A | void, B | void, C | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): OrderedSet<[T | void, A | void, B | void, C | void, D | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): OrderedSet<[T | void, A | void, B | void, C | void, D | void, E | void]>; + zipWith( zipper: (value: T, a: A) => R, - a: ESIterable, - _: empty + a: Iterable, + ..._: [] ): OrderedSet; zipWith( zipper: (value: T, a: A, b: B) => R, - a: ESIterable, - b: ESIterable, - _: empty + a: Iterable, + b: Iterable, + ..._: [] ): OrderedSet; zipWith( zipper: (value: T, a: A, b: B, c: C) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] ): OrderedSet; zipWith( zipper: (value: T, a: A, b: B, c: C, d: D) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] ): OrderedSet; zipWith( zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, - a: ESIterable, - b: ESIterable, - c: ESIterable, - d: ESIterable, - e: ESIterable, - _: empty + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] ): OrderedSet; } -declare function isStack(maybeStack: mixed): boolean %checks(maybeStack instanceof Stack); +declare function isStack( + maybeStack: mixed +): boolean %checks(maybeStack instanceof Stack); declare class Stack<+T> extends IndexedCollection { - static (iterable?: ESIterable): Stack; + static (collection?: Iterable): Stack; static isStack(maybeStack: mixed): boolean; static of(...values: T[]): Stack; static isStack: typeof isStack; + size: number; + peek(): T; clear(): this; unshift(...values: U[]): Stack; - unshiftAll(iter: ESIterable): Stack; + unshiftAll(iter: Iterable): Stack; shift(): this; push(...values: U[]): Stack; - pushAll(iter: ESIterable): Stack; + pushAll(iter: Iterable): Stack; pop(): this; - withMutations(mutator: (mutable: this) => this | void): this; + withMutations(mutator: (mutable: this) => mixed): this; asMutable(): this; + wasAltered(): boolean; asImmutable(): this; // Override specialized return types + + concat(...iters: Array | C>): Stack; + + filter(predicate: typeof Boolean): Stack<$NonMaybeType>; + filter( + predicate: (value: T, index: number, iter: this) => mixed, + context?: mixed + ): Stack; + map( mapper: (value: T, index: number, iter: this) => M, context?: mixed ): Stack; flatMap( - mapper: (value: T, index: number, iter: this) => ESIterable, + mapper: (value: T, index: number, iter: this) => Iterable, context?: mixed ): Stack; flatten(depth?: number): Stack; flatten(shallow?: boolean): Stack; + + zip(a: Iterable, ..._: []): Stack<[T, A]>; + zip(a: Iterable, b: Iterable, ..._: []): Stack<[T, A, B]>; + zip( + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): Stack<[T, A, B, C]>; + zip( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): Stack<[T, A, B, C, D]>; + zip( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): Stack<[T, A, B, C, D, E]>; + + zipAll(a: Iterable, ..._: []): Stack<[T | void, A | void]>; + zipAll( + a: Iterable, + b: Iterable, + ..._: [] + ): Stack<[T | void, A | void, B | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): Stack<[T | void, A | void, B | void, C | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): Stack<[T | void, A | void, B | void, C | void, D | void]>; + zipAll( + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): Stack<[T | void, A | void, B | void, C | void, D | void, E | void]>; + + zipWith( + zipper: (value: T, a: A) => R, + a: Iterable, + ..._: [] + ): Stack; + zipWith( + zipper: (value: T, a: A, b: B) => R, + a: Iterable, + b: Iterable, + ..._: [] + ): Stack; + zipWith( + zipper: (value: T, a: A, b: B, c: C) => R, + a: Iterable, + b: Iterable, + c: Iterable, + ..._: [] + ): Stack; + zipWith( + zipper: (value: T, a: A, b: B, c: C, d: D) => R, + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + ..._: [] + ): Stack; + zipWith( + zipper: (value: T, a: A, b: B, c: C, d: D, e: E) => R, + a: Iterable, + b: Iterable, + c: Iterable, + d: Iterable, + e: Iterable, + ..._: [] + ): Stack; } -declare function Range(start?: number, end?: number, step?: number): IndexedSeq; +declare function Range( + start?: number, + end?: number, + step?: number +): IndexedSeq; declare function Repeat(value: T, times?: number): IndexedSeq; -// TODO: Once flow can extend normal Objects we can change this back to actually reflect Record behavior. -// For now fallback to any to not break existing code -declare class Record { - static (spec: T, name?: string): /*T & Record*/any; +// The type of a Record factory function. +type RecordFactory = Class>; + +// The type of runtime Record instances. +type RecordOf = RecordInstance & $ReadOnly; + +// The values of a Record instance. +type _RecordValues | T> = R; +type RecordValues = _RecordValues<*, R>; + +declare function isRecord( + maybeRecord: any +): boolean %checks(maybeRecord instanceof RecordInstance); +declare class Record { + static (spec: Values, name?: string): typeof RecordInstance; + constructor( + spec: Values, + name?: string + ): typeof RecordInstance; - static getDescriptiveName(record: Record): string; + static isRecord: typeof isRecord; - get(key: $Keys): A; - set(key: $Keys, value: A): /*T & Record*/this; - remove(key: $Keys): /*T & Record*/this; + static getDescriptiveName(record: RecordInstance): string; } -declare function fromJS(json: mixed, reviver?: (k: any, v: Iterable) => any): any; +declare class RecordInstance { + static (values?: Iterable<[$Keys, $ValOf]> | $Shape): RecordOf; + // Note: a constructor can only create an instance of RecordInstance, + // it's encouraged to not use `new` when creating Records. + constructor(values?: Iterable<[$Keys, $ValOf]> | $Shape): void; + + size: number; + + has(key: string): boolean; + + get>(key: K, ..._: []): $ElementType; + get, NSV>(key: K, notSetValue: NSV): $ElementType | NSV; + + hasIn(keyPath: Iterable): boolean; + + getIn(keyPath: [], notSetValue?: mixed): this & $ReadOnly; + getIn>(keyPath: [K], notSetValue?: mixed): $ElementType; + getIn, K2: $KeyOf<$ValOf>>( + keyPath: [K, K2], + notSetValue: NSV + ): $ValOf<$ValOf, K2> | NSV; + getIn< + NSV, + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + >( + keyPath: [K, K2, K3], + notSetValue: NSV + ): $ValOf<$ValOf<$ValOf, K2>, K3> | NSV; + getIn< + NSV, + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + >( + keyPath: [K, K2, K3, K4], + notSetValue: NSV + ): $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4> | NSV; + getIn< + NSV, + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + >( + keyPath: [K, K2, K3, K4, K5], + notSetValue: NSV + ): $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5> | NSV; + + equals(other: any): boolean; + hashCode(): number; + + set>(key: K, value: $ElementType): this & $ReadOnly; + update>( + key: K, + updater: (value: $ElementType) => $ElementType + ): this & $ReadOnly; + merge( + ...collections: Array, $ValOf]> | $Shape> + ): this & $ReadOnly; + mergeDeep( + ...collections: Array, $ValOf]> | $Shape> + ): this & $ReadOnly; + + mergeWith( + merger: (oldVal: $ValOf, newVal: $ValOf, key: $Keys) => $ValOf, + ...collections: Array, $ValOf]> | $Shape> + ): this & $ReadOnly; + mergeDeepWith( + merger: (oldVal: any, newVal: any, key: any) => any, + ...collections: Array, $ValOf]> | $Shape> + ): this & $ReadOnly; + + delete>(key: K): this & $ReadOnly; + remove>(key: K): this & $ReadOnly; + clear(): this & $ReadOnly; + + setIn(keyPath: [], value: S): S; + setIn, S: $ValOf>( + keyPath: [K], + value: S + ): this & $ReadOnly; + setIn, K2: $KeyOf<$ValOf>, S: $ValOf<$ValOf, K2>>( + keyPath: [K, K2], + value: S + ): this & $ReadOnly; + setIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + S: $ValOf<$ValOf<$ValOf, K2>, K3>, + >( + keyPath: [K, K2, K3], + value: S + ): this & $ReadOnly; + setIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, + >( + keyPath: [K, K2, K3, K4], + value: S + ): this & $ReadOnly; + setIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5>, + >( + keyPath: [K, K2, K3, K4, K5], + value: S + ): this & $ReadOnly; + + deleteIn(keyPath: []): void; + deleteIn>(keyPath: [K]): this & $ReadOnly; + deleteIn, K2: $KeyOf<$ValOf>>( + keyPath: [K, K2] + ): this & $ReadOnly; + deleteIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + >( + keyPath: [K, K2, K3] + ): this & $ReadOnly; + deleteIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + >( + keyPath: [K, K2, K3, K4] + ): this & $ReadOnly; + deleteIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + >( + keyPath: [K, K2, K3, K4, K5] + ): this & $ReadOnly; + + removeIn(keyPath: []): void; + removeIn>(keyPath: [K]): this & $ReadOnly; + removeIn, K2: $KeyOf<$ValOf>>( + keyPath: [K, K2] + ): this & $ReadOnly; + removeIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + >( + keyPath: [K, K2, K3] + ): this & $ReadOnly; + removeIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + >( + keyPath: [K, K2, K3, K4] + ): this & $ReadOnly; + removeIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + >( + keyPath: [K, K2, K3, K4, K5] + ): this & $ReadOnly; + + updateIn( + keyPath: [], + notSetValue: mixed, + updater: (value: this & T) => U + ): U; + updateIn(keyPath: [], updater: (value: this & T) => U): U; + updateIn, S: $ValOf>( + keyPath: [K], + notSetValue: NSV, + updater: (value: $ValOf) => S + ): this & $ReadOnly; + updateIn, S: $ValOf>( + keyPath: [K], + updater: (value: $ValOf) => S + ): this & $ReadOnly; + updateIn< + NSV, + K: $Keys, + K2: $KeyOf<$ValOf>, + S: $ValOf<$ValOf, K2>, + >( + keyPath: [K, K2], + notSetValue: NSV, + updater: (value: $ValOf<$ValOf, K2> | NSV) => S + ): this & $ReadOnly; + updateIn, K2: $KeyOf<$ValOf>, S: $ValOf<$ValOf, K2>>( + keyPath: [K, K2], + updater: (value: $ValOf<$ValOf, K2>) => S + ): this & $ReadOnly; + updateIn< + NSV, + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + S: $ValOf<$ValOf<$ValOf, K2>, K3>, + >( + keyPath: [K, K2, K3], + notSetValue: NSV, + updater: (value: $ValOf<$ValOf<$ValOf, K2>, K3> | NSV) => S + ): this & $ReadOnly; + updateIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + S: $ValOf<$ValOf<$ValOf, K2>, K3>, + >( + keyPath: [K, K2, K3], + updater: (value: $ValOf<$ValOf<$ValOf, K2>, K3>) => S + ): this & $ReadOnly; + updateIn< + NSV, + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, + >( + keyPath: [K, K2, K3, K4], + notSetValue: NSV, + updater: ( + value: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4> | NSV + ) => S + ): this & $ReadOnly; + updateIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, + >( + keyPath: [K, K2, K3, K4], + updater: (value: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>) => S + ): this & $ReadOnly; + updateIn< + NSV, + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5>, + >( + keyPath: [K, K2, K3, K4, K5], + notSetValue: NSV, + updater: ( + value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5> | NSV + ) => S + ): this & $ReadOnly; + updateIn< + K: $Keys, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5>, + >( + keyPath: [K, K2, K3, K4, K5], + updater: ( + value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5> + ) => S + ): this & $ReadOnly; + + mergeIn( + keyPath: Iterable, + ...collections: Array + ): this & $ReadOnly; + mergeDeepIn( + keyPath: Iterable, + ...collections: Array + ): this & $ReadOnly; + + toSeq(): KeyedSeq<$Keys, any>; + + toJS(): { [key: $Keys]: mixed }; + toJSON(): T; + toObject(): T; + + withMutations(mutator: (mutable: this & T) => mixed): this & $ReadOnly; + asMutable(): this & $ReadOnly; + wasAltered(): boolean; + asImmutable(): this & $ReadOnly; + + @@iterator(): Iterator<[$Keys, $ValOf]>; +} + +declare function fromJS( + jsValue: mixed, + reviver?: ( + key: string | number, + sequence: KeyedCollection | IndexedCollection, + path?: Array + ) => mixed +): Collection; + declare function is(first: mixed, second: mixed): boolean; declare function hash(value: mixed): number; +declare function get>( + collection: C, + key: K, + notSetValue: mixed +): $ValOf; +declare function get, NSV>( + collection: C, + key: K, + notSetValue: NSV +): $ValOf | NSV; + +declare function has(collection: Object, key: mixed): boolean; +declare function remove(collection: C, key: $KeyOf): C; +declare function set, V: $ValOf>( + collection: C, + key: K, + value: V +): C; +declare function update, V: $ValOf, NSV>( + collection: C, + key: K, + notSetValue: NSV, + updater: ($ValOf | NSV) => V +): C; +declare function update, V: $ValOf>( + collection: C, + key: K, + updater: ($ValOf) => V +): C; + +declare function getIn(collection: C, keyPath: [], notSetValue?: mixed): C; +declare function getIn, NSV>( + collection: C, + keyPath: [K], + notSetValue: NSV +): $ValOf | NSV; +declare function getIn, K2: $KeyOf<$ValOf>, NSV>( + collection: C, + keyPath: [K, K2], + notSetValue: NSV +): $ValOf<$ValOf, K2> | NSV; +declare function getIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + NSV, +>( + collection: C, + keyPath: [K, K2, K3], + notSetValue: NSV +): $ValOf<$ValOf<$ValOf, K2>, K3> | NSV; +declare function getIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + NSV, +>( + collection: C, + keyPath: [K, K2, K3, K4], + notSetValue: NSV +): $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4> | NSV; +declare function getIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + NSV, +>( + collection: C, + keyPath: [K, K2, K3, K4, K5], + notSetValue: NSV +): $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5> | NSV; + +declare function hasIn(collection: Object, keyPath: Iterable): boolean; + +declare function removeIn(collection: C, keyPath: []): void; +declare function removeIn>(collection: C, keyPath: [K]): C; +declare function removeIn, K2: $KeyOf<$ValOf>>( + collection: C, + keyPath: [K, K2] +): C; +declare function removeIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, +>( + collection: C, + keyPath: [K, K2, K3] +): C; +declare function removeIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, +>( + collection: C, + keyPath: [K, K2, K3, K4] +): C; +declare function removeIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, +>( + collection: C, + keyPath: [K, K2, K3, K4, K5] +): C; + +declare function setIn(collection: Object, keyPath: [], value: S): S; +declare function setIn, S: $ValOf>( + collection: C, + keyPath: [K], + value: S +): C; +declare function setIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + S: $ValOf<$ValOf, K2>, +>( + collection: C, + keyPath: [K, K2], + value: S +): C; +declare function setIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + S: $ValOf<$ValOf<$ValOf, K2>, K3>, +>( + collection: C, + keyPath: [K, K2, K3], + value: S +): C; +declare function setIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, +>( + collection: C, + keyPath: [K, K2, K3, K4], + value: S +): C; +declare function setIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5>, +>( + collection: C, + keyPath: [K, K2, K3, K4, K5], + value: S +): C; + +declare function updateIn( + collection: C, + keyPath: [], + notSetValue: mixed, + updater: (value: C) => S +): S; +declare function updateIn( + collection: C, + keyPath: [], + updater: (value: C) => S +): S; +declare function updateIn, S: $ValOf, NSV>( + collection: C, + keyPath: [K], + notSetValue: NSV, + updater: (value: $ValOf | NSV) => S +): C; +declare function updateIn, S: $ValOf>( + collection: C, + keyPath: [K], + updater: (value: $ValOf) => S +): C; +declare function updateIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + S: $ValOf<$ValOf, K2>, + NSV, +>( + collection: C, + keyPath: [K, K2], + notSetValue: NSV, + updater: (value: $ValOf<$ValOf, K2> | NSV) => S +): C; +declare function updateIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + S: $ValOf<$ValOf, K2>, +>( + collection: C, + keyPath: [K, K2], + updater: (value: $ValOf<$ValOf, K2>) => S +): C; +declare function updateIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + S: $ValOf<$ValOf<$ValOf, K2>, K3>, + NSV, +>( + collection: C, + keyPath: [K, K2, K3], + notSetValue: NSV, + updater: (value: $ValOf<$ValOf<$ValOf, K2>, K3> | NSV) => S +): C; +declare function updateIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + S: $ValOf<$ValOf<$ValOf, K2>, K3>, +>( + collection: C, + keyPath: [K, K2, K3], + updater: (value: $ValOf<$ValOf<$ValOf, K2>, K3>) => S +): C; +declare function updateIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, + NSV, +>( + collection: C, + keyPath: [K, K2, K3, K4], + notSetValue: NSV, + updater: (value: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4> | NSV) => S +): C; +declare function updateIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + S: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, +>( + collection: C, + keyPath: [K, K2, K3, K4], + updater: (value: $ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>) => S +): C; +declare function updateIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5>, + NSV, +>( + collection: C, + keyPath: [K, K2, K3, K4, K5], + notSetValue: NSV, + updater: ( + value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5> | NSV + ) => S +): C; +declare function updateIn< + C, + K: $KeyOf, + K2: $KeyOf<$ValOf>, + K3: $KeyOf<$ValOf<$ValOf, K2>>, + K4: $KeyOf<$ValOf<$ValOf<$ValOf, K2>, K3>>, + K5: $KeyOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>>, + S: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5>, +>( + collection: C, + keyPath: [K, K2, K3, K4, K5], + updater: ( + value: $ValOf<$ValOf<$ValOf<$ValOf<$ValOf, K2>, K3>, K4>, K5> + ) => S +): C; + +declare function merge( + collection: C, + ...collections: Array< + | $IterableOf + | $Shape> + | PlainObjInput<$KeyOf, $ValOf>, + > +): C; +declare function mergeWith( + merger: (oldVal: $ValOf, newVal: $ValOf, key: $KeyOf) => $ValOf, + collection: C, + ...collections: Array< + | $IterableOf + | $Shape> + | PlainObjInput<$KeyOf, $ValOf>, + > +): C; +declare function mergeDeep( + collection: C, + ...collections: Array< + | $IterableOf + | $Shape> + | PlainObjInput<$KeyOf, $ValOf>, + > +): C; +declare function mergeDeepWith( + merger: (oldVal: any, newVal: any, key: any) => mixed, + collection: C, + ...collections: Array< + | $IterableOf + | $Shape> + | PlainObjInput<$KeyOf, $ValOf>, + > +): C; + export { - Iterable, Collection, Seq, - List, Map, OrderedMap, @@ -1060,14 +2326,34 @@ export { Record, Set, Stack, - fromJS, is, hash, -} + isImmutable, + isCollection, + isKeyed, + isIndexed, + isAssociative, + isOrdered, + isRecord, + isValueObject, + get, + has, + remove, + set, + update, + getIn, + hasIn, + removeIn, + setIn, + updateIn, + merge, + mergeWith, + mergeDeep, + mergeDeepWith, +}; export default { - Iterable, Collection, Seq, @@ -1075,6 +2361,7 @@ export default { Map, OrderedMap, OrderedSet, + PairSorting, Range, Repeat, Record, @@ -1084,16 +2371,44 @@ export default { fromJS, is, hash, -} + + isImmutable, + isCollection, + isKeyed, + isIndexed, + isAssociative, + isOrdered, + isRecord, + isValueObject, + + get, + has, + remove, + set, + update, + getIn, + hasIn, + removeIn, + setIn, + updateIn, + merge, + mergeWith, + mergeDeep, + mergeDeepWith, +}; export type { - KeyedIterable, - IndexedIterable, - SetIterable, + Comparator, KeyedCollection, IndexedCollection, SetCollection, KeyedSeq, IndexedSeq, SetSeq, -} + RecordFactory, + RecordOf, + RecordInstance, + ValueObject, + $KeyOf, + $ValOf, +}; diff --git a/type-definitions/tests/.flowconfig b/type-definitions/tests/.flowconfig deleted file mode 100644 index f0bc63a8f8..0000000000 --- a/type-definitions/tests/.flowconfig +++ /dev/null @@ -1,5 +0,0 @@ -[include] -../../ - -[options] -suppress_comment=\\(.\\|\n\\)*\\$ExpectError diff --git a/type-definitions/tests/es6-collections.js b/type-definitions/tests/es6-collections.js deleted file mode 100644 index 22b96507f1..0000000000 --- a/type-definitions/tests/es6-collections.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * @flow - */ - -import { - Map as ImmutableMap, - Set as ImmutableSet, -} from '../../' - -// Immutable.js collections -var mapImmutable: ImmutableMap = ImmutableMap() -var setImmutable: ImmutableSet = ImmutableSet() -var deleteResultImmutable: ImmutableMap = mapImmutable.delete('foo'); - -// ES6 collections -var mapES6: Map = new Map() -var setES6: Set = new Set() -var deleteResultES6: boolean = mapES6.delete('foo'); diff --git a/type-definitions/tests/immutable-flow.js b/type-definitions/tests/immutable-flow.js deleted file mode 100644 index ed085bff52..0000000000 --- a/type-definitions/tests/immutable-flow.js +++ /dev/null @@ -1,770 +0,0 @@ -/* - * @flow - */ - -// Some tests look like they are repeated in order to avoid false positives. -// Flow might not complain about an instance of (what it thinks is) T to be assigned to T - -import Immutable, { - List, - Map, - Stack, - Set, - Range, - Repeat, - OrderedMap, - OrderedSet, -} from '../../' -import * as Immutable2 from '../../' - -import type { - KeyedIterable, - IndexedIterable, - SetIterable, - KeyedCollection, - IndexedCollection, - SetCollection, - KeyedSeq, - IndexedSeq, - SetSeq, -} from '../../' - -/** - * Although this looks like dead code, importing `Immutable` and - * `Immutable2` tests: - * - * 1. that default import works -- `import Immutable, {...} from 'immutable' - * 2. that importing everything works -- `import * as X from 'immutable'` - * 3. that individual imports are supported - */ -const ImmutableList = Immutable.List -const ImmutableMap = Immutable.Map -const ImmutableStack = Immutable.Stack -const ImmutableSet = Immutable.Set -const ImmutableKeyedIterable: KeyedIterable<*, *> = Immutable.Iterable.Keyed() -const ImmutableRange = Immutable.Range -const ImmutableRepeat = Immutable.Repeat -const ImmutableIndexedSeq: IndexedSeq<*> = Immutable.Seq.Indexed() - -const Immutable2List = Immutable2.List -const Immutable2Map = Immutable2.Map -const Immutable2Stack = Immutable2.Stack -const Immutable2Set = Immutable2.Set -const Immutable2KeyedIterable: Immutable2.KeyedIterable<*, *> = Immutable2.Iterable.Keyed() -const Immutable2Range = Immutable2.Range -const Immutable2Repeat = Immutable2.Repeat -const Immutable2IndexedSeq: Immutable2.IndexedSeq<*> = Immutable2.Seq.Indexed() - -var defaultExport: List<*> = Immutable.List(); -var moduleExport: List<*> = Immutable2.List(); - -var numberList: List = List() -var numberOrStringList: List = List() -var nullableNumberList: List = List() -var stringToNumber: Map = Map() -var orderedStringToNumber: OrderedMap = OrderedMap() -var orderedStringToString: OrderedMap = OrderedMap() -var orderedStringToNumberOrString: OrderedMap = OrderedMap() -var orderedNumberToString: OrderedMap = OrderedMap() -var orderedNumberToNumber: OrderedMap = OrderedMap() -var stringToNumberOrString: Map = Map() -var numberToString: Map = Map() -var stringOrNumberToNumberOrString: Map = Map() -var anyMap: Map = Map() -var numberSet: Set = Set() -var orderedStringSet: OrderedSet = OrderedSet() -var orderedNumberSet: OrderedSet = OrderedSet() -var orderedNumberOrStringSet: OrderedSet = OrderedSet() -var numberOrStringSet: Set = Set() -var stringSet: Set = Set() -var numberStack: Stack = Stack() -var numberOrStringStack: Stack = Stack() -var number: number = 0 -var stringToNumberIterable: KeyedIterable = stringToNumber -var numberToStringIterable: KeyedIterable = numberToString - -numberList = List([1, 2]) -numberOrStringList = List(['a', 1]) -// $ExpectError -numberList = List(['a', 'b']) - -numberList = List.of(1, 2) -numberOrStringList = List.of('a', 1) -// $ExpectError -numberList = List.of('a', 1) - -numberList = List().set(0, 0) -numberOrStringList = List.of(0).set(1, 'a') -// $ExpectError -numberList = List().set(0, 'a') - -numberList = List.of(1, 2, 3) -// $ExpectError -var item: number = numberList.get(4) -var nullableItem: ?number = numberList.get(4) -var itemOrDefault: number = numberList.get(4, 10) - -numberList = List().insert(0, 0) -numberOrStringList = List.of(0).insert(1, 'a') -// $ExpectError -numberList = List().insert(0, 'a') - -numberList = List().push(1, 1) -numberOrStringList = List().push(1, 'a') -// $ExpectError -numberList = List().push(0, 'a') - -numberList = List().unshift(1, 1) -numberOrStringList = List().unshift(1, 'a') -// $ExpectError -numberList = List().unshift(0, 'a') - -numberList = List.of(1).delete(0) -// $ExpectError -numberList = List.of('a').delete(0) - -numberList = List.of(1).remove(0) -// $ExpectError -numberList = List.of('a').remove(0) - -numberList = List.of(1).clear() -// $ExpectError -numberList = List.of('a').clear() - -numberList = List.of(1).pop() -// $ExpectError -numberList = List.of('a').pop() - -numberList = List.of(1).shift() -// $ExpectError -numberList = List.of('a').shift() - -numberList = List.of('a').update((value) => List.of(1)) -// $ExpectError -numberList = List.of(1).update((value) => List.of('a')) - -numberOrStringList = List.of('a').update(0, (value) => 1) -// $ExpectError -numberList = List.of(1).update(0, (value) => 'a') - -numberOrStringList = List.of(1).update(1, 0, (value) => 'a') -// $ExpectError -numberList = List.of(1).update(1, 0, (value) => 'a') - -numberList = List.of(1).merge(List.of(2)) -numberOrStringList = List.of('a').merge(List.of(1)) -// $ExpectError -numberList = List.of('a').merge(List.of(1)) - -numberList = List.of(1).mergeWith((previous, next, key) => 1, [1]) -// $ExpectError -numberList = List.of(1).mergeWith((previous, next, key) => previous + next, ['a']) - -numberOrStringList = List.of(1).mergeDeep(['a']) -// $ExpectError -numberList = List.of(1).mergeDeep(['a']) - -numberList = List.of(1).mergeDeepWith((previous, next, key) => 1, [1]) -// $ExpectError -numberList = List.of(1).mergeDeepWith((previous, next, key) => previous + next, ['a']) - -nullableNumberList = List.of(1).setSize(2) - -numberList = List.of(1).setIn([], 0) - -numberList = List.of(1).deleteIn([], 0) -numberList = List.of(1).removeIn([], 0) - -numberList = List([1]).updateIn([0], val => val + 1) -// $ExpectError - 'a' in an invalid argument -numberList = List([1]).updateIn([0], 'a') - -numberList = List([1]).updateIn([0], 0, val => val + 1) -// $ExpectError - 'a' is an invalid argument -numberList = List([1]).updateIn([0], 0, 'a') - -numberList = List.of(1).mergeIn([], []) -numberList = List.of(1).mergeDeepIn([], []) - -numberList = List.of(1).withMutations(mutable => mutable) - -numberList = List.of(1).asMutable() -numberList = List.of(1).asImmutable() - -numberList = List.of(1).map((value, index, iter) => 1) -// $ExpectError -numberList = List.of(1).map((value, index, iter) => 'a') - -numberList = List.of(1).flatMap((value, index, iter) => [1]) -// $ExpectError -numberList = List.of(1).flatMap((value, index, iter) => ['a']) - -numberList = List.of(1).flatten() - -/* Map */ - -stringToNumber = Map() -stringToNumberOrString = Map() -numberToString = Map() - -stringToNumber = Map({'a': 1}) -// $ExpectError -stringToNumber = Map({'a': 'a'}) - -stringToNumber = Map([['a', 1]]) -// $ExpectError -stringToNumber = Map([['a', 'b']]) -// FIXME: this should trigger an error -- this is actually a Map -stringToNumber = Map(List.of(List(['a', 'b']))) - -stringOrNumberToNumberOrString = Map({'a': 'a'}).set('b', 1).set(2, 'c') -// $ExpectError -stringToNumber = Map({'a': 0}).set('b', '') -// $ExpectError -stringToNumber = Map().set(1, '') - -stringToNumber = Map({'a': 0}).delete('a') -stringToNumber = Map({'a': 0}).remove('a') -// $ExpectError -stringToNumber = Map({'a': 0}).delete(1) -// $ExpectError -stringToNumber = Map({'a': 0}).remove(1) - -stringToNumber = Map({'a': 0}).deleteAll(['a']) -stringToNumber = Map({'a': 0}).removeAll(['a']) -// $ExpectError -stringToNumber = Map({'a': 0}).deleteAll(1) -// $ExpectError -stringToNumber = Map({'a': 0}).deleteAll([1]) -// $ExpectError -stringToNumber = Map({'a': 0}).removeAll([1]) - -stringToNumber = Map({'a': 0}).clear() - -stringToNumber = Map({'a': 1}).update((value) => Map({'a': 1})) -// $ExpectError -stringToNumber = Map({'a': 1}).update((value) => Map({1: 'a'})) - -stringToNumberOrString = Map({'a': 1}).update('a', (value) => 'a') -// $ExpectError -stringToNumber = Map({'a': 1}).update('a', (value) => 'a') - -stringToNumberOrString = Map({'a': 1}).update('a', 'b', (value) => 'a') -// $ExpectError -stringToNumber = Map({'a': 1}).update('a', 'b', (value) => 'a') -// $ExpectError -stringToNumberOrString = Map({'a': 1}).merge({'a': {a: '1'}}) -// $ExpectError -stringToNumberOrString = Map({'a': 1}).update('a', 'b', (value) => {a: '1'}) - -stringToNumber = Map({'a': 1}).merge(Map({'a': 1})) -stringToNumberOrString = Map({'a': 1}).merge({'a': 'b'}) -// $ExpectError -stringToNumber = Map({a: 1}).merge({'a': 'b'}) -// $ExpectError -stringToNumber = Map({a: 1}).merge([[1, 'a']]) - -// FIXME: Simple `stringToNumber = ...` assignment shows an error at the declaration of stringToNumber and numberToString -// $ExpectError -const stringToNumber: Map = Map({a: 1}).merge(numberToString) - -stringToNumber = Map({'a': 1}).mergeWith((previous, next, key) => 1, {'a': 2, 'b': 2}) -// $ExpectError - this is actually a Map -stringToNumber = Map({'a': 1}).mergeWith((previous, next, key) => previous + next, {'a': '2', 'b': '2'}) -stringToNumberOrString = Map({'a': 1}).mergeWith((previous, next, key) => previous + next, {'a': '2', 'b': '2'}) -// $ExpectError - the array [1] is not a valid argument -stringToNumber = Map({'a': 1}).mergeWith((previous, next, key) => 1, [1]) - -stringToNumberOrString = Map({'a': 1}).mergeDeep({'a': 'b'}) -// $ExpectError -stringToNumber = Map({'a': 1}).mergeDeep({'a': 'b'}) - -stringToNumber = Map({'a': 1}).mergeDeepWith((previous, next, key) => 1, {'a': 2, 'b': 2}) -// $ExpectError - this is actually a Map -stringToNumber = Map({'a': 1}).mergeDeepWith((previous, next, key) => 1, {'a': '2', 'b': '2'}) -stringToNumberOrString = Map({'a': 1}).mergeDeepWith((previous, next, key) => 1, {'a': '2', 'b': '2'}) -// $ExpectError - the array [1] is not a valid argument -stringToNumber = Map({'a': 1}).mergeDeepWith((previous, next, key) => 1, [1]) - -stringToNumber = Map({'a': 1}).setIn([], 0) - -stringToNumber = Map({'a': 1}).deleteIn([], 0) -stringToNumber = Map({'a': 1}).removeIn([], 0) - -stringToNumber = Map({'a': 1}).mergeIn([], []) -stringToNumber = Map({'a': 1}).mergeDeepIn([], []) - -anyMap = Map({'a': {}}).mergeIn(['a'], Map({ 'b': 2 })) -anyMap = Map({'a': {}}).mergeDeepIn(['a'], Map({ 'b': 2 })) -anyMap = Map({'a': {}}).mergeIn(['a'], List([1, 2])) -anyMap = Map({'a': {}}).mergeDeepIn(['a'], List([1, 2])) -anyMap = Map({'a': {}}).mergeIn(['a'], { 'b': 2 }) -anyMap = Map({'a': {}}).mergeDeepIn(['a'], { 'b': 2 }) -// $ExpectError: not iterable / object -anyMap = Map({'a': {}}).mergeIn(['a'], 1) -// $ExpectError: not iterable / object -anyMap = Map({'a': {}}).mergeDeepIn(['a'], 1) -// $ExpectError: bad key type -stringToNumber = Map({'a': {}}).mergeIn([1], { 'b': 2 }) -// $ExpectError: bad key type -stringToNumber = Map({'a': {}}).mergeDeepIn([1], { 'b': 2 }) - -stringToNumber = Map({'a': 1}).withMutations(mutable => mutable) - -stringToNumber = Map({'a': 1}).asMutable() -stringToNumber = Map({'a': 1}).asImmutable() - -stringToNumber = Map({'a': 1}).map((value, index, iter) => 1) -// $ExpectError -stringToNumber = Map({'a': 1}).map((value, index, iter) => 'a') - -stringToNumber = Map({'a': 1}).flatMap((value, index, iter) => [['b', 1]]) -// $ExpectError -stringToNumber = Map({'a': 1}).flatMap((value, index, iter) => [['a', 'a']]) -// $ExpectError -stringToNumber = Map({'a': 1}).flatMap((value, index, iter) => Map({'a': 'a'})) - -numberToString= Map({'a': 1}).flip() -// $ExpectError -stringToNumber = Map({'a': 1}).flip() - -numberToString = Map({'a': 'a'}).mapKeys((key, value, iter) => 1) -// $ExpectError -stringToNumber = Map({'a': 1}).mapKeys((key, value, iter) => 1) - -anyMap = Map({'a': 1}).flatten() - -/* OrderedMap */ - -orderedStringToNumber = Map({'a': 1}).toOrderedMap() -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = Map({'a': 'b'}).toOrderedMap() -orderedStringToString = Map({'a': 'b'}).toOrderedMap() - -orderedStringToNumber = OrderedMap({'a': 1}) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': '1'}) -orderedStringToString = OrderedMap({'a': '1'}) - -orderedStringToNumber = OrderedMap(Map({'a': 1})) -// FIXME: this should trigger an error -- it's actually an OrderedMap -orderedStringToNumber = OrderedMap(Map({'a': '1'})) - -orderedStringToNumber = OrderedMap() - -orderedStringToNumber = OrderedMap().set('b', 2) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap().set('b', '2') -orderedStringToString = OrderedMap().set('b', '2') - -orderedStringToNumber = OrderedMap({'a': 1}).delete('a') -orderedStringToNumber = OrderedMap({'a': 1}).remove('a') -orderedStringToNumber = OrderedMap({'a': 1}).clear() - -orderedStringToNumber = OrderedMap({'a': 1}).update(() => OrderedMap({'b': 1})) -/** - * TODO: the following is valid but I question if it should be valid: - * - * ``` - * const x: OrderedMap = OrderedMap({'a': 1}) - * .update(() => OrderedMap({'b': '1'})) - * ``` - * - * In the above example, `update` is changing an OrderedMap to an OrderedMap - * This seems inconsistent with the typescript signature of - * - * ``` - * update(updater: (value: Map) => Map): Map - * ``` - */ -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).update(() => OrderedMap({'b': '1'})) -orderedStringToString = OrderedMap({'a': 1}).update(() => OrderedMap({'b': '1'})) - -orderedStringToNumber = OrderedMap({'a': 1}).update('a', value => value + 1) -/** - * TODO: is the below the intended functionality? The typescript signature looks like - * - * ``` - * update(key: K, updater: (value: V) => V): Map; - * ``` - * - * so it seems like in this case the updater should only be able to return numbers. - * This comment applies to all of the update / merge functions in Map and OrderedMap - */ -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).update('a', () => 'b') -orderedStringToNumberOrString = OrderedMap({'a': 1}).update('a', () => 'b') - -orderedStringToNumber = OrderedMap({'a': 1}).update('a', 0, value => value + 1) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).update('a', 0, () => 'b') -orderedStringToNumberOrString = OrderedMap({'a': 1}).update('a', 0, () => 'b') - -orderedStringToNumber = OrderedMap({'a': 1}).merge({'b': 2}) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).merge({'b': '2'}) -orderedStringToNumberOrString = OrderedMap({'a': 1}).merge({'b': '2'}) - -orderedStringToNumber = OrderedMap({'a': 1}).mergeWith((prev, next) => next, {'a': 2, 'b': 3}) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).mergeWith((prev, next) => next, {'a': '2', 'b': '3'}) -orderedStringToNumberOrString = OrderedMap({'a': 1}).mergeWith((prev, next) => next, {'a': '2', 'b': '3'}) -// $ExpectError - the array [1] is not a valid argument -orderedStringToNumber = OrderedMap({'a': 1}).mergeWith((prev, next) => next, [1]) - -orderedStringToNumber = OrderedMap({'a': 1}).mergeDeep({'a': 2}) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).mergeDeep({'a': '2'}) -orderedStringToNumberOrString = OrderedMap({'a': 1}).mergeDeep({'a': '2'}) - -orderedStringToNumber = OrderedMap({'a': 1}).mergeDeepWith((prev, next) => next, {'a': 2, 'b': 3}) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).mergeDeepWith((prev, next) => next, {'a': '2', 'b': '3'}) -orderedStringToNumberOrString = OrderedMap({'a': 1}).mergeDeepWith((prev, next) => next, {'a': '2', 'b': '3'}) -// $ExpectError - the array [1] is an invalid argument -orderedStringToNumber = OrderedMap({'a': 1}).mergeDeepWith((prev, next) => next, [1]) - -orderedStringToNumber = OrderedMap({'a': 1}).setIn([], 3) -orderedStringToNumber = OrderedMap({'a': 1}).deleteIn([]) -orderedStringToNumber = OrderedMap({'a': 1}).removeIn([]) - -orderedStringToNumber = OrderedMap({'a': 1}).updateIn([], val => val + 1) -// $ExpectError - 'a' in an invalid argument -orderedStringToNumber = OrderedMap({'a': 1}).updateIn([], 'a') - -orderedStringToNumber = OrderedMap({'a': 1}).updateIn([], 0, val => val + 1) -// $ExpectError - 'a' is an invalid argument -orderedStringToNumber = OrderedMap({'a': 1}).updateIn([], 0, 'a') - -orderedStringToNumber = OrderedMap({'a': 1}).mergeIn([], {'b': 2}) -orderedStringToNumber = OrderedMap({'a': 1}).mergeDeepIn([], {'b': 2}) -orderedStringToNumber = OrderedMap({'a': 1}).withMutations(mutable => mutable.set('b', 2)) -orderedStringToNumber = OrderedMap({'a': 1}).asMutable(); -orderedStringToNumber = OrderedMap({'a': 1}).asImmutable(); - -orderedStringToNumber = OrderedMap({'a': 1}).map(v => v + 1) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).map(() => 'a') -orderedStringToString = OrderedMap({'a': 1}).map(() => 'a') - -orderedStringToNumber = OrderedMap({'a': 1}).flatMap((v, k) => (OrderedMap({ [k]: v + 1 }))) -/** - * FIXME: this should throw an error, it's an OrderedMap - */ -orderedStringToNumber = OrderedMap({'a': 1}).flatMap((v, k) => (OrderedMap({ [k]: 'a' }))) - -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).flip() -orderedNumberToString = OrderedMap({'a': 1}).flip() - -orderedStringToNumber = OrderedMap({'a': 1}).mapKeys(x => x) -// $ExpectError - this is actually an OrderedMap -orderedStringToNumber = OrderedMap({'a': 1}).mapKeys(x => 1) -orderedNumberToNumber = OrderedMap({'a': 1}).mapKeys(x => 1) - -orderedStringToNumber = OrderedMap({'a': 1}).flatten() -orderedStringToNumber = OrderedMap({'a': 1}).flatten(1) -orderedStringToNumber = OrderedMap({'a': 1}).flatten(true) -// $ExpectError - 'a' is an invalid argument -orderedStringToNumber = OrderedMap({'a': 1}).flatten('a') - -/* Set */ - -numberSet = Set() -numberOrStringSet = Set() -stringSet = Set() - -numberSet = Set([1, 2, 3]) -// $ExpectError -numberSet = Set(['a', 'b']) - -numberSet = Set.of(1, 2) -// $ExpectError -numberSet = Set.of('a', 'b') - -numberSet = Set.fromKeys(Map().set(1, '')) -stringSet = Set.fromKeys({a: ''}) -// $ExpectError -numberSet = Set.fromKeys(Map({'a': 1})) -// $ExpectError -numberSet = Set.fromKeys({'a': 1}) - -numberOrStringSet = Set([1]).add('a') -// $ExpectError -numberSet = Set([1]).add('s') - -numberSet = Set([1]).delete(1) -// $ExpectError -numberSet = Set([1]).delete('a') -// $ExpectError -numberSet = Set(['a']).delete('a') - -numberSet = Set([1]).remove(1) -// $ExpectError -numberSet = Set([1]).remove('a') -// $ExpectError -numberSet = Set(['a']).remove('a') - -numberSet = Set([1]).clear() -// $ExpectError -numberSet = Set(['a']).clear() - -numberOrStringSet = Set(['a']).union([1]) -numberOrStringSet = Set(['a']).union(Set([1])) -numberSet = Set([1]).union([1]) -numberSet = Set([1]).union(Set([1])) -// $ExpectError -numberSet = Set([1]).union(['a']) -// $ExpectError -numberSet = Set([1]).union(Set(['a'])) - -numberOrStringSet = Set(['a']).merge([1]) -numberOrStringSet = Set(['a']).merge(Set([1])) -numberSet = Set([1]).merge([1]) -numberSet = Set([1]).merge(Set([1])) -// $ExpectError -numberSet = Set([1]).merge(['a']) -// $ExpectError -numberSet = Set([1]).merge(Set(['a'])) - -numberSet = Set([1]).intersect(Set([1])) -numberSet = Set([1]).intersect([1]) -numberSet = Set([1]).intersect(Set(['a'])) -numberSet = Set([1]).intersect(['a']) - -numberSet = Set([1]).subtract(Set([1])) -numberSet = Set([1]).subtract([1]) -numberSet = Set([1]).subtract(Set(['a'])) -numberSet = Set([1]).subtract(['a']) - -numberSet = Set([1]).withMutations(mutable => mutable) -// $ExpectError -stringSet = Set([1]).withMutations(mutable => mutable) - -numberSet = Set([1]).asMutable() -// $ExpectError -stringSet = Set([1]).asMutable() - -numberSet = Set([1]).asImmutable() -// $ExpectError -stringSet = Set([1]).asImmutable() - -stringSet = Set([1]).map((value, index, iter) => 'a') -// $ExpectError -numberSet = Set([1]).map((value, index, iter) => 'a') - -stringSet = Set([1]).flatMap((value, index, iter) => ['a']) -// $ExpectError -numberSet = Set([1]).flatMap((value, index, iter) => ['a']) - -numberSet = Set([1]).flatten() - -/* OrderedSet */ - -orderedStringSet = Set(['a']).toOrderedSet() -// $ExpectError - this is actually an OrderedSet -orderedStringSet = Set([1]).toOrderedSet() -orderedNumberSet = Set([1]).toOrderedSet() - -orderedStringSet = OrderedSet(['a']) -// $ExpectError - this is actually an OrderedSet -orderedStringSet = OrderedSet([1]) -orderedNumberSet = OrderedSet([1]) - -orderedStringSet = OrderedSet(List.of('a')) -// $ExpectError - this is actually an OrderedSet -orderedStringSet = OrderedSet(List.of(1)) -orderedNumberSet = OrderedSet(List.of(1)) - -orderedStringSet = OrderedSet.of('a', 'b', 'c') -// $ExpectError - this is actually an OrderedSet -orderedStringSet = OrderedSet.of(1) -orderedNumberSet = OrderedSet.of(1) - -orderedStringSet = OrderedSet.fromKeys(Map({'a': 1})) -// $ExpectError - this is actually an OrderedSet -orderedNumberSet = OrderedSet.fromKeys(Map({'a': 1})) - -orderedStringSet = OrderedSet.fromKeys({ 'a': 1 }) -// $ExpectError - this is actually an OrderedSet -orderedNumberSet = OrderedSet.fromKeys({ 'a': 1 }) - -orderedStringSet = OrderedSet() - -orderedStringSet = OrderedSet.of('a').add('b') -/** - * TODO: in typescript definitions, add looks like - * - * ``` - * add(value: T): Set - * ``` - * - * so we shouldn't be able to add a number to a set of strings - */ -// $ExpectError - this is actually an OrderedSet -orderedStringSet = OrderedSet('a').add(1) -orderedNumberOrStringSet = OrderedSet('a').add(1) - -orderedStringSet = OrderedSet.of('a').delete('a') -// $ExpectError - 1 is an invalid arg -orderedStringSet = OrderedSet.of('a').delete(1) - -orderedStringSet = OrderedSet.of('a').remove('a') -// $ExpectError - 1 is an invalid arg -orderedStringSet = OrderedSet.of('a').remove(1) - -orderedStringSet = OrderedSet.of('a').clear() - -orderedStringSet = OrderedSet.of('a').union(OrderedSet.of('b')) -/** - * TODO: typescript def looks like - * - * ``` - * union(...iterables: Array[]): Set - * ``` - * - * so we shouldn't be able to merge strings and numbers - */ -// $ExpectError - this is actually an OrderedSet -orderedStringSet = OrderedSet.of('a').union(OrderedSet.of(1)) -orderedNumberOrStringSet = OrderedSet.of('a').union(OrderedSet.of(1)) - -orderedStringSet = OrderedSet.of('a').merge(OrderedSet.of('b')) -/** - * TODO: typescript def looks like - * - * ``` - * merge(...iterables: Array[]): Set - * ``` - * - * so we shouldn't be able to merge strings and numbers - */ -// $ExpectError - this is actually an OrderedSet -orderedStringSet = OrderedSet.of('a').merge(OrderedSet.of(1)) -orderedNumberOrStringSet = OrderedSet.of('a').merge(OrderedSet.of(1)) - -orderedStringSet = OrderedSet.of('a', 'b').intersect(OrderedSet.of('a')) -/** - * TODO: typescript def looks like - * - * ``` - * intersect(...iterables: Array[]): Set - * ``` - * - * so we shouldn't be able to intersect strings and numbers - */ -orderedStringSet = OrderedSet.of('a', 'b').intersect(OrderedSet.of(1)) - -orderedStringSet = OrderedSet.of('a', 'b').subtract(OrderedSet.of('a')) -/** - * TODO: typescript def looks like - * - * ``` - * subtract(...iterables: Array[]): Set - * ``` - * - * so we shouldn't be able to intersect strings and numbers - */ -orderedStringSet = OrderedSet.of('a', 'b').subtract(OrderedSet.of(1)) - -orderedStringSet = OrderedSet().withMutations(mutable => mutable.add('a')) -orderedStringSet = OrderedSet.of('a').asMutable() -orderedStringSet = OrderedSet.of('a').asImmutable() - -orderedStringSet = OrderedSet.of('a', 'b').map(m => m) -// $ExpectError - this is an OrderedSet -orderedStringSet = OrderedSet.of('a', 'b').map(() => 1) -orderedNumberSet = OrderedSet.of('a', 'b').map(() => 1) - -orderedStringSet = OrderedSet.of('a', 'b').flatMap(m => [m]) -// $ExpectError - this is an OrderedSet -orderedStringSet = OrderedSet.of('a', 'b').flatMap(m => [1]) -orderedNumberSet = OrderedSet.of('a', 'b').flatMap(m => [1]) - -orderedStringSet = OrderedSet.of('a', 'b').flatten(1) -orderedStringSet = OrderedSet.of('a', 'b').flatten(false) -// $ExpectError - invalid arg for flatten -orderedStringSet = OrderedSet.of('a', 'b').flatten('a') - -/* Stack */ - -numberStack = Stack([1, 2]) -numberOrStringStack = Stack(['a', 1]) -// $ExpectError -numberStack = Stack(['a', 'b']) - -numberStack = Stack.of(1, 2) -numberOrStringStack = Stack.of('a', 1) -// $ExpectError -numberStack = Stack.of('a', 1) - -number = Stack([1]).peek() -// $ExpectError -number = Stack(['a']).peek() - -numberStack = Stack([1]).unshift(1) -numberOrStringStack = Stack([1]).unshift('a') -// $ExpectError -numberStack = Stack([1]).unshift('a') - -numberStack = Stack([1]).unshiftAll([1]) -numberOrStringStack = Stack([1]).unshiftAll(['a']) -// $ExpectError -numberStack = Stack([1]).unshiftAll(['a']) - -numberStack = Stack.of(1).shift() -// $ExpectError -numberStack = Stack.of('a').shift() - -numberStack = Stack().push(1) -numberOrStringStack = Stack([1]).push('a') -// $ExpectError -numberStack = Stack().push('a') - -numberStack = Stack().pushAll([1]) -numberOrStringStack = Stack([1]).pushAll(['a']) -// $ExpectError -numberStack = Stack().push(['a']) - -numberStack = Stack.of(1).pop() -// $ExpectError -numberStack = Stack.of('a').pop() - -numberStack = Stack([1]).withMutations(mutable => mutable) -// $ExpectError -numberStack = Stack(['a']).withMutations(mutable => mutable) - -numberStack = Stack([1]).asMutable() -// $ExpectError -numberStack = Stack(['a']).asMutable() - -numberStack = Stack([1]).asImmutable() -// $ExpectError -numberStack = Stack(['a']).asImmutable() - -numberStack = Stack([1]).map((value, index, iter) => 1) -// $ExpectError -numberStack = Stack([1]).map((value, index, iter) => 'a') - -numberStack = Stack([1]).flatMap((value, index, iter) => [1]) -// $ExpectError -numberStack = Stack([1]).flatMap((value, index, iter) => ['a']) - -numberStack = Stack([1]).flatten() -numberStack = Stack(['a']).flatten() - -/* Range & Repeat */ - -// `{}` provide namespaces -{ const numberSequence: IndexedSeq = Range(0, 0, 0) } -{ const numberSequence: IndexedSeq = Repeat(1, 5) } - -{ const stringSequence: IndexedSeq = Repeat('a', 5) } -// $ExpectError -{ const stringSequence: IndexedSeq = Repeat(0, 1) } -// $ExpectError -{ const stringSequence: IndexedSeq = Range(0, 0, 0) } - -/* Record */ -// TODO diff --git a/type-definitions/ts-tests/covariance.ts b/type-definitions/ts-tests/covariance.ts new file mode 100644 index 0000000000..b4c01e50e9 --- /dev/null +++ b/type-definitions/ts-tests/covariance.ts @@ -0,0 +1,87 @@ +import { expect, test } from 'tstyche'; +import { + List, + Map, + MapOf, + OrderedMap, + OrderedSet, + Set, + Stack, +} from 'immutable'; + +class A { + x: number; + + constructor() { + this.x = 1; + } +} + +class B extends A { + y: string; + + constructor() { + super(); + this.y = 'B'; + } +} + +class C { + z: string; + + constructor() { + this.z = 'C'; + } +} + +test('List covariance', () => { + expect>().type.toBeAssignableWith(List()); + + expect(List([new B()])).type.toBe>(); + + expect>().type.not.toBeAssignableWith(List()); +}); + +test('Map covariance', () => { + expect>().type.toBeAssignableWith>(); + + expect(Map({ b: new B() })).type.toBe>(); + + expect>().type.not.toBeAssignableWith>(); +}); + +test('Set covariance', () => { + expect>().type.toBeAssignableWith>(); + + expect(Set([new B()])).type.toBe>(); + + expect>().type.not.toBeAssignableWith>(); +}); + +test('Stack covariance', () => { + expect>().type.toBeAssignableWith>(); + + expect(Stack([new B()])).type.toBe>(); + + expect>().type.not.toBeAssignableWith>(); +}); + +test('OrderedMap covariance', () => { + expect>().type.toBeAssignableWith< + OrderedMap + >(); + + expect(OrderedMap({ b: new B() })).type.toBe>(); + + expect>().type.not.toBeAssignableWith< + OrderedMap + >(); +}); + +test('OrderedSet covariance', () => { + expect>().type.toBeAssignableWith>(); + + expect(OrderedSet([new B()])).type.toBe>(); + + expect>().type.not.toBeAssignableWith>(); +}); diff --git a/type-definitions/ts-tests/deepCopy.ts b/type-definitions/ts-tests/deepCopy.ts new file mode 100644 index 0000000000..25e262fd81 --- /dev/null +++ b/type-definitions/ts-tests/deepCopy.ts @@ -0,0 +1,112 @@ +import { describe, expect, test } from 'tstyche'; +import { List, Map, Record, Set, Seq, DeepCopy, Collection } from 'immutable'; + +describe('DeepCopy', () => { + test('basic types', () => { + expect< + DeepCopy<{ + a: number; + b: number; + }> + >().type.toBe<{ + a: number; + b: number; + }>(); + }); + + test('iterables', () => { + expect>().type.toBe(); + + expect>>().type.toBe(); + }); + + test('immutable first-level types', () => { + expect>>().type.toBe<{ + [x: string]: string; + }>(); + + // should be `{ [x: string]: object }`, but there is an issue with circular references + expect>>().type.toBe<{ + [x: string]: unknown; + }>(); + + // should be `{ [x: string]: object; [x: number]: object }`, but there is an issue with circular references + expect>>().type.toBe<{ + [x: string]: unknown; + [x: number]: unknown; + }>(); + + expect>>().type.toBe(); + + expect>>().type.toBe(); + }); + + test('keyed', () => { + expect>>().type.toBe<{ + [x: string]: number; + }>(); + + expect>>().type.toBe<{ + [x: string]: number; + [x: number]: number; + }>(); + + expect>>().type.toBe<{ + [x: string]: number; + [x: number]: number; + }>(); + + expect>>().type.toBe<{ + [x: string]: number; + [x: number]: number; + }>(); + }); + + test('nested', () => { + // should be `{ map: { [x: string]: string }; list: string[]; set: string[] }`, but there is an issue with circular references + expect< + DeepCopy<{ + map: Map; + list: List; + set: Set; + }> + >().type.toBe<{ map: unknown; list: unknown; set: unknown }>(); + + // should be `{ map: { [x: string]: string } }`, but there is an issue with circular references + expect>>>().type.toBe<{ + map: unknown; + }>(); + }); + + test('circular references', () => { + type Article = Record<{ title: string; tag: Tag }>; + type Tag = Record<{ name: string; article: Article }>; + + // should handle circular references here somehow + expect>().type.toBe<{ title: string; tag: unknown }>(); + }); + + test('circular references #1957', () => { + class Foo1 extends Record<{ foo: undefined | Foo1 }>({ + foo: undefined, + }) {} + + class Foo2 extends Record<{ foo?: Foo2 }>({ + foo: undefined, + }) {} + + class Foo3 extends Record<{ foo: null | Foo3 }>({ + foo: null, + }) {} + + expect>().type.toBe<{ foo: unknown }>(); + expect>().type.toBe<{ foo?: unknown }>(); + expect>().type.toBe<{ foo: unknown }>(); + + class FooWithList extends Record<{ foo: undefined | List }>({ + foo: undefined, + }) {} + + expect>().type.toBe<{ foo: unknown }>(); + }); +}); diff --git a/type-definitions/ts-tests/empty.ts b/type-definitions/ts-tests/empty.ts new file mode 100644 index 0000000000..e9425c6eb5 --- /dev/null +++ b/type-definitions/ts-tests/empty.ts @@ -0,0 +1,40 @@ +import { expect, test } from 'tstyche'; +import { Seq, Collection } from 'immutable'; + +test('typed empty Seq', () => { + expect(Seq()).type.toBe>(); + + expect(Seq()).type.toBe>(); + + expect(Seq.Indexed()).type.toBe>(); + + expect(Seq.Indexed()).type.toBe>(); + + expect(Seq.Keyed()).type.toBe>(); + + expect(Seq.Keyed()).type.toBe>(); + + expect(Seq.Set()).type.toBe>(); + + expect(Seq.Set()).type.toBe>(); +}); + +test('typed empty Collection', () => { + expect(Collection()).type.toBe>(); + + expect(Collection()).type.toBe>(); + + expect(Collection.Indexed()).type.toBe>(); + + expect(Collection.Indexed()).type.toBe>(); + + expect(Collection.Keyed()).type.toBe>(); + + expect(Collection.Keyed()).type.toBe< + Collection.Keyed + >(); + + expect(Collection.Set()).type.toBe>(); + + expect(Collection.Set()).type.toBe>(); +}); diff --git a/type-definitions/ts-tests/es6-collections.ts b/type-definitions/ts-tests/es6-collections.ts new file mode 100644 index 0000000000..790bc3cf2b --- /dev/null +++ b/type-definitions/ts-tests/es6-collections.ts @@ -0,0 +1,21 @@ +import { expect, test } from 'tstyche'; +import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable'; + +test('immutable.js collections', () => { + const mapImmutable: ImmutableMap = ImmutableMap< + string, + number + >(); + const setImmutable: ImmutableSet = ImmutableSet(); + + expect(mapImmutable.delete('foo')).type.toBe>(); + expect(setImmutable.delete('bar')).type.toBe>(); +}); + +test('ES6 collections', () => { + const mapES6: Map = new Map(); + const setES6: Set = new Set(); + + expect(mapES6.delete('foo')).type.toBe(); + expect(setES6.delete('bar')).type.toBe(); +}); diff --git a/type-definitions/ts-tests/exports.ts b/type-definitions/ts-tests/exports.ts new file mode 100644 index 0000000000..39f9d2fe49 --- /dev/null +++ b/type-definitions/ts-tests/exports.ts @@ -0,0 +1,112 @@ +// Some tests look like they are repeated in order to avoid false positives. + +import { expect, test } from 'tstyche'; +import * as Immutable from 'immutable'; +import { + List, + Map, + OrderedMap, + OrderedSet, + Range, + Repeat, + Seq, + Set, + Stack, + Collection, +} from 'immutable'; + +test('named imports', () => { + expect(List).type.toBe(); + + expect(Map).type.toBe(); + + expect(OrderedMap).type.toBe(); + + expect(OrderedSet).type.toBe(); + + expect(Range).type.toBe< + ( + start: number, + end: number, + step?: number | undefined + ) => Seq.Indexed + >(); + + expect(Repeat).type.toBe< + (value: T, times?: number | undefined) => Seq.Indexed + >(); + + expect(Seq).type.toBe(); + + expect(Set).type.toBe(); + + expect(Stack).type.toBe(); + + expect(Collection).type.toBe(); + + expect(Collection.Set).type.toBe< + ( + collection?: Iterable | ArrayLike | undefined + ) => Collection.Set + >(); + + expect(Collection.Keyed).type.toBe<{ + (collection?: Iterable<[K, V]> | undefined): Collection.Keyed; + (obj: { [key: string]: V }): Collection.Keyed; + }>(); + + expect(Collection.Indexed).type.toBe< + ( + collection?: Iterable | ArrayLike | undefined + ) => Collection.Indexed + >(); +}); + +test('namespace import', () => { + expect(Immutable.List).type.toBe(); + + expect(Immutable.Map).type.toBe(); + + expect(Immutable.OrderedMap).type.toBe(); + + expect(Immutable.OrderedSet).type.toBe(); + + expect(Immutable.Range).type.toBe< + ( + start: number, + end: number, + step?: number | undefined + ) => Immutable.Seq.Indexed + >(); + + expect(Immutable.Repeat).type.toBe< + (value: T, times?: number | undefined) => Immutable.Seq.Indexed + >(); + + expect(Immutable.Seq).type.toBe(); + + expect(Immutable.Set).type.toBe(); + + expect(Immutable.Stack).type.toBe(); + + expect(Immutable.Collection).type.toBe(); + + expect(Immutable.Collection.Set).type.toBe< + ( + collection?: Iterable | ArrayLike | undefined + ) => Immutable.Collection.Set + >(); + + expect(Immutable.Collection.Keyed).type.toBe<{ + ( + collection?: Iterable<[K, V]> | undefined + ): Immutable.Collection.Keyed; + (obj: { [key: string]: V }): Immutable.Collection.Keyed; + }>(); + + expect(Immutable.Collection.Indexed).type.toBe< + ( + collection?: Iterable | ArrayLike | undefined + ) => Immutable.Collection.Indexed + >(); +}); diff --git a/type-definitions/ts-tests/from-js.ts b/type-definitions/ts-tests/from-js.ts new file mode 100644 index 0000000000..f04a1e78f8 --- /dev/null +++ b/type-definitions/ts-tests/from-js.ts @@ -0,0 +1,46 @@ +import { expect, test } from 'tstyche'; +import { fromJS, Collection, List, Map, MapOf } from 'immutable'; + +test('fromJS', () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + expect(fromJS({}, (a: any, b: any) => b)).type.toBe< + Collection + >(); + + expect(fromJS('abc')).type.toBe(); + + expect(fromJS([0, 1, 2])).type.toBe>(); + + expect(fromJS(List([0, 1, 2]))).type.toBe>(); + + expect(fromJS({ a: 0, b: 1, c: 2 })).type.toBe< + Map<'b' | 'a' | 'c', number> + >(); + + expect(fromJS(Map({ a: 0, b: 1, c: 2 }))).type.toBe< + MapOf<{ a: number; b: number; c: number }> + >(); + + expect(fromJS([{ a: 0 }])).type.toBe>>(); + + expect(fromJS({ a: [0] })).type.toBe>>(); + + expect(fromJS([[[0]]])).type.toBe>>>(); + + expect(fromJS({ a: { b: { c: 0 } } })).type.toBe< + Map<'a', Map<'b', Map<'c', number>>> + >(); +}); + +test('fromJS in an array of function', () => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const create = [(data: any) => data, fromJS][1]; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + expect(create({ a: 'A' })).type.toBe(); + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const createConst = ([(data: any) => data, fromJS] as const)[1]; + + expect(createConst({ a: 'A' })).type.toBe>(); +}); diff --git a/type-definitions/ts-tests/functional.ts b/type-definitions/ts-tests/functional.ts new file mode 100644 index 0000000000..01a8636c50 --- /dev/null +++ b/type-definitions/ts-tests/functional.ts @@ -0,0 +1,174 @@ +import { expect, test } from 'tstyche'; +import { + get, + getIn, + has, + hasIn, + set, + remove, + update, + Map, + List, + MapOf, +} from 'immutable'; + +test('get', () => { + expect(get([1, 2, 3], 0)).type.toBe(); + + expect(get([1, 2, 3], 0, 'a')).type.toBe(); + + expect(get({ x: 10, y: 20 }, 'x')).type.toBe(); + + expect(get({ x: 10, y: 20 }, 'z', 'missing')).type.toBe(); +}); + +test('getIn', () => { + expect(getIn('a', ['length' as const])).type.toBe(); + + expect(getIn([1, 2, 3], [0])).type.toBe(); + + // first parameter type is Array so we can not detect that the number will be invalid + expect(getIn([1, 2, 3], [99])).type.toBe(); + + // We do not handle List in getIn TS type yet (hard to convert to a tuple) + expect(getIn([1, 2, 3], List([0]))).type.toBe(); + + expect(getIn([1, 2, 3], [0], 'a' as const)).type.toBe(); + + expect(getIn(List([1, 2, 3]), [0])).type.toBe(); + + // first parameter type is Array so we can not detect that the number will be invalid + expect(getIn(List([1, 2, 3]), [99])).type.toBe(); + + expect(getIn(List([1, 2, 3]), ['a' as const])).type.toBe(); + + expect( + getIn(List([1, 2, 3]), ['a' as const], 'missing') + ).type.toBe<'missing'>(); + + expect(getIn({ x: 10, y: 20 }, ['x' as const])).type.toBe(); + + expect( + getIn({ x: 10, y: 20 }, ['z' as const], 'missing') + ).type.toBe<'missing'>(); + + expect(getIn({ x: { y: 20 } }, ['x' as const])).type.toBe<{ y: number }>(); + + expect(getIn({ x: { y: 20 } }, ['z' as const])).type.toBe(); + + expect( + getIn({ x: { y: 20 } }, ['x' as const, 'y' as const]) + ).type.toBe(); + + expect( + getIn({ x: Map({ y: 20 }) }, ['x' as const, 'y' as const]) + ).type.toBe(); + + expect( + getIn(Map({ x: Map({ y: 20 }) }), ['x' as const, 'y' as const]) + ).type.toBe(); + + const o = Map({ x: List([Map({ y: 20 })]) }); + + expect(getIn(o, ['x' as const, 'y' as const])).type.toBe(); + + expect(getIn(o, ['x' as const])).type.toBe>>(); + + expect(getIn(o, ['x' as const, 0])).type.toBe>(); + + expect(getIn(o, ['x' as const, 0, 'y' as const])).type.toBe(); +}); + +test('has', () => { + expect(has([1, 2, 3], 0)).type.toBe(); + + expect(has({ x: 10, y: 20 }, 'x')).type.toBe(); +}); + +test('hasIn', () => { + expect(hasIn('a', ['length' as const])).type.toBe(); + + expect(hasIn(123, [])).type.toBe(); + + expect(hasIn(true, [])).type.toBe(); + + expect(hasIn([1, 2, 3], [0])).type.toBe(); + + // first parameter type is Array so we can not detect that the number will be invalid + expect(hasIn([1, 2, 3], [99])).type.toBe(); + + // We do not handle List in hasIn TS type yet (hard to convert to a tuple) + expect(hasIn([1, 2, 3], List([0]))).type.toBe(); + + expect(hasIn(List([1, 2, 3]), [0])).type.toBe(); + + // first parameter type is Array so we can not detect that the number will be invalid + expect(hasIn(List([1, 2, 3]), [99])).type.toBe(); + + expect(hasIn(List([1, 2, 3]), ['a' as const])).type.toBe(); + + expect(hasIn({ x: 10, y: 20 }, ['x' as const])).type.toBe(); + + expect(hasIn({ x: { y: 20 } }, ['z' as const])).type.toBe(); + + expect( + hasIn({ x: { y: 20 } }, ['x' as const, 'y' as const]) + ).type.toBe(); + + expect( + hasIn({ x: Map({ y: 20 }) }, ['x' as const, 'y' as const]) + ).type.toBe(); + + expect( + hasIn(Map({ x: Map({ y: 20 }) }), ['x' as const, 'y' as const]) + ).type.toBe(); + + const o = Map({ x: List([Map({ y: 20 })]) }); + + expect(hasIn(o, ['x' as const, 'y' as const])).type.toBe(); + + expect(hasIn(o, ['x' as const, 0, 'y' as const])).type.toBe(); +}); + +test('set', () => { + expect(set([1, 2, 3], 0, 10)).type.toBe(); + + expect(set([1, 2, 3], 0, 'a')).type.toRaiseError(); + + expect(set([1, 2, 3], 'a', 0)).type.toRaiseError(); + + expect(set({ x: 10, y: 20 }, 'x', 100)).type.toBe<{ + x: number; + y: number; + }>(); + + expect(set({ x: 10, y: 20 }, 'x', 'a')).type.toRaiseError(); +}); + +test('remove', () => { + expect(remove([1, 2, 3], 0)).type.toBe(); + + expect(remove({ x: 10, y: 20 }, 'x')).type.toBe<{ + x: number; + y: number; + }>(); +}); + +test('update', () => { + expect(update([1, 2, 3], 0, (v: number) => v + 1)).type.toBe(); + + expect(update([1, 2, 3], 0, 1)).type.toRaiseError(); + + expect(update([1, 2, 3], 0, (v: string) => v + 'a')).type.toRaiseError(); + + expect(update([1, 2, 3], 'a', (v: number) => v + 1)).type.toRaiseError(); + + expect(update({ x: 10, y: 20 }, 'x', (v: number) => v + 1)).type.toBe<{ + x: number; + y: number; + }>(); + + expect( + update({ x: 10, y: 20 }, 'x', (v: string) => v + 'a') + ).type.toRaiseError(); +}); diff --git a/type-definitions/ts-tests/groupBy.ts b/type-definitions/ts-tests/groupBy.ts new file mode 100644 index 0000000000..141bfc2912 --- /dev/null +++ b/type-definitions/ts-tests/groupBy.ts @@ -0,0 +1,59 @@ +import { expect, test } from 'tstyche'; +import { + Collection, + List, + Map, + OrderedMap, + Set, + OrderedSet, + Seq, + Stack, + MapOf, +} from 'immutable'; + +test('groupBy', () => { + expect(Collection(['a', 'b', 'c', 'a']).groupBy((v) => v)).type.toBe< + Map> + >(); + + expect( + Collection({ a: 1, b: 2, c: 3, d: 1 }).groupBy((v) => `key-${v}`) + ).type.toBe>>(); + + expect(List(['a', 'b', 'c', 'a']).groupBy((v) => v)).type.toBe< + Map> + >(); + + expect(Seq(['a', 'b', 'c', 'a']).groupBy((v) => v)).type.toBe< + Map> + >(); + + expect(Seq({ a: 1, b: 2, c: 3, d: 1 }).groupBy((v) => `key-${v}`)).type.toBe< + Map> + >(); + + expect(Set(['a', 'b', 'c', 'a']).groupBy((v) => v)).type.toBe< + Map> + >(); + + expect(Stack(['a', 'b', 'c', 'a']).groupBy((v) => v)).type.toBe< + Map> + >(); + + expect(OrderedSet(['a', 'b', 'c', 'a']).groupBy((v) => v)).type.toBe< + Map> + >(); + + expect( + Map({ a: 1, b: 2, c: 3, d: 1 }).groupBy((v) => `key-${v}`) + ).type.toBe>>(); + + // type should be something like Map>> but groupBy returns a wrong type with `this` + expect(Map({ a: 1, b: 2, c: 3, d: 1 }).groupBy((v) => `key-${v}`)).type.toBe< + Map> + >(); + + expect( + OrderedMap({ a: 1, b: 2, c: 3, d: 1 }).groupBy((v) => `key-${v}`) + ).type.toBe>>(); +}); diff --git a/type-definitions/ts-tests/list.ts b/type-definitions/ts-tests/list.ts new file mode 100644 index 0000000000..2b86dca369 --- /dev/null +++ b/type-definitions/ts-tests/list.ts @@ -0,0 +1,403 @@ +import { expect, pick, test } from 'tstyche'; +import { + List, + get, + set, + remove, + update, + setIn, + removeIn, + updateIn, + merge, +} from 'immutable'; + +test('#constructor', () => { + expect(List()).type.toBe>(); + + expect>().type.toBeAssignableWith(List()); + + expect>().type.toBeAssignableWith(List([1, 'a'])); + expect>().type.not.toBeAssignableWith(List([1, 'a'])); +}); + +test('#size', () => { + expect(pick(List(), 'size')).type.toBe<{ readonly size: number }>(); +}); + +test('#setSize', () => { + expect(List().setSize(10)).type.toBe>(); + + expect(List().setSize('foo')).type.toRaiseError(); +}); + +test('.of', () => { + expect(List.of(1, 2, 3)).type.toBe>(); + + expect(List.of('a', 1)).type.toRaiseError(); + + expect(List.of('a', 1)).type.toBe>(); +}); + +test('#get', () => { + expect(List().get(4)).type.toBe(); + + expect(List().get(4, 'a')).type.toBe(); + + expect(List().get(4, 'a')).type.toRaiseError(); + + expect(get(List(), 4)).type.toBe(); + + expect(get(List(), 4, 'a')).type.toBe(); +}); + +test('#set', () => { + expect(List().set(0, 0)).type.toBe>(); + + expect(List().set(1, 'a')).type.toRaiseError(); + + expect(List().set('a', 1)).type.toRaiseError(); + + expect(List().set(0, 1)).type.toBe>(); + + expect(List().set(0, 'a')).type.toBe< + List + >(); + + expect(set(List(), 0, 0)).type.toBe>(); +}); + +test('#first', () => { + const a = List().first(); + // ^? + expect(List().first()).type.toBe(); + expect(List().first('first')).type.toBe(); +}); + +test('#last', () => { + expect(List().last()).type.toBe(); + expect(List().last('last')).type.toBe(); +}); + +test('#set', () => { + expect(set(List(), 1, 'a')).type.toRaiseError(); + + expect(set(List(), 'a', 1)).type.toRaiseError(); +}); + +test('#setIn', () => { + expect(List().setIn([], 0)).type.toBe>(); + + expect(setIn(List(), [], 0)).type.toBe>(); +}); + +test('#insert', () => { + expect(List().insert(0, 0)).type.toBe>(); + + expect(List().insert(1, 'a')).type.toRaiseError(); + + expect(List().insert('a', 1)).type.toRaiseError(); + + expect(List().insert(0, 1)).type.toBe< + List + >(); + + expect(List().insert(0, 'a')).type.toBe< + List + >(); +}); + +test('#push', () => { + expect(List().push(0, 0)).type.toBe>(); + + expect(List().push(1, 'a')).type.toRaiseError(); + + expect(List().push('a', 1)).type.toRaiseError(); + + expect(List().push(0, 1)).type.toBe>(); + + expect(List().push(0, 'a')).type.toBe< + List + >(); +}); + +test('#unshift', () => { + expect(List().unshift(0, 0)).type.toBe>(); + + expect(List().unshift(1, 'a')).type.toRaiseError(); + + expect(List().unshift('a', 1)).type.toRaiseError(); + + expect(List().unshift(0, 1)).type.toBe< + List + >(); + + expect(List().unshift(0, 'a')).type.toBe< + List + >(); +}); + +test('#delete', () => { + expect(List().delete(0)).type.toBe>(); + + expect(List().delete('a')).type.toRaiseError(); +}); + +test('#deleteIn', () => { + expect(List().deleteIn([])).type.toBe>(); +}); + +test('#remove', () => { + expect(List().remove(0)).type.toBe>(); + + expect(List().remove('a')).type.toRaiseError(); + + expect(remove(List(), 0)).type.toBe>(); +}); + +test('#removeIn', () => { + expect(List().removeIn([])).type.toBe>(); + + expect(removeIn(List(), [])).type.toBe>(); +}); + +test('#clear', () => { + expect(List().clear()).type.toBe>(); + + expect(List().clear(10)).type.toRaiseError(); +}); + +test('#pop', () => { + expect(List().pop()).type.toBe>(); + + expect(List().pop(10)).type.toRaiseError(); +}); + +test('#shift', () => { + expect(List().shift()).type.toBe>(); + + expect(List().shift(10)).type.toRaiseError(); +}); + +test('#update', () => { + expect(List().update((v) => 1)).type.toBe(); + + expect( + List().update((v: List | undefined) => v) + ).type.toRaiseError(); + + expect(List().update(0, (v: number | undefined) => 0)).type.toBe< + List + >(); + + expect( + List().update(0, (v: number | undefined) => v + 'a') + ).type.toRaiseError(); + + expect(List().update(1, 10, (v: number | undefined) => 0)).type.toBe< + List + >(); + + expect( + List().update(1, 'a', (v: number | undefined) => 0) + ).type.toRaiseError(); + + expect( + List().update(1, 10, (v: number | undefined) => v + 'a') + ).type.toRaiseError(); + + expect(List().update(1, (v) => v?.toUpperCase())).type.toBe< + List + >(); + + expect(update(List(), 0, (v: number | undefined) => 0)).type.toBe< + List + >(); + + expect( + update(List(), 1, 10, (v: number) => v + 'a') + ).type.toRaiseError(); +}); + +test('#updateIn', () => { + expect(List().updateIn([], (v) => v)).type.toBe>(); + + expect(List().updateIn([], 10)).type.toRaiseError(); + + expect(updateIn(List(), [], (v) => v)).type.toBe>(); +}); + +test('#map', () => { + expect( + List().map((value: number, key: number, iter: List) => 1) + ).type.toBe>(); + + expect( + List().map((value: number, key: number, iter: List) => 'a') + ).type.toBe>(); + + expect( + List().map( + (value: number, key: number, iter: List) => 1 + ) + ).type.toBe>(); + + expect( + List().map( + (value: number, key: number, iter: List) => 1 + ) + ).type.toRaiseError(); + + expect( + List().map( + (value: string, key: number, iter: List) => 1 + ) + ).type.toRaiseError(); + + expect( + List().map( + (value: number, key: string, iter: List) => 1 + ) + ).type.toRaiseError(); + + expect( + List().map( + (value: number, key: number, iter: List) => 1 + ) + ).type.toRaiseError(); + + expect( + List().map( + (value: number, key: number, iter: List) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#flatMap', () => { + expect( + List().flatMap((value: number, key: number, iter: List) => [ + 1, + ]) + ).type.toBe>(); + + expect( + List().flatMap((value: number, key: number, iter: List) => [ + 'a', + ]) + ).type.toBe>(); + + expect(List>().flatMap((list) => list)).type.toBe< + List + >(); + + expect( + List().flatMap( + (value: number, key: number, iter: List) => [1] + ) + ).type.toBe>(); + + expect( + List().flatMap( + (value: number, key: number, iter: List) => [1] + ) + ).type.toRaiseError(); + + expect( + List().flatMap( + (value: string, key: number, iter: List) => [1] + ) + ).type.toRaiseError(); + + expect( + List().flatMap( + (value: number, key: string, iter: List) => [1] + ) + ).type.toRaiseError(); + + expect( + List().flatMap( + (value: number, key: number, iter: List) => [1] + ) + ).type.toRaiseError(); + + expect( + List().flatMap( + (value: number, key: number, iter: List) => ['a'] + ) + ).type.toRaiseError(); +}); + +test('#merge', () => { + expect(List().merge(List())).type.toBe>(); + + expect(List().merge(List())).type.toBe< + List + >(); + + expect(List().merge(List())).type.toBe< + List + >(); + + expect(List().merge(List())).type.toBe< + List + >(); + + expect(merge(List(), List())).type.toBe>(); +}); + +test('#mergeIn', () => { + expect(List().mergeIn([], [])).type.toBe>(); +}); + +test('#mergeDeepIn', () => { + expect(List().mergeDeepIn([], [])).type.toBe>(); +}); + +test('#flatten', () => { + expect(List().flatten()).type.toBe< + Immutable.Collection + >(); + + expect(List().flatten(10)).type.toBe< + Immutable.Collection + >(); + + expect(List().flatten(false)).type.toBe< + Immutable.Collection + >(); + + expect(List().flatten('a')).type.toRaiseError(); +}); + +test('#withMutations', () => { + expect(List().withMutations((mutable) => mutable)).type.toBe< + List + >(); + + expect( + List().withMutations((mutable: List) => mutable) + ).type.toRaiseError(); +}); + +test('#asMutable', () => { + expect(List().asMutable()).type.toBe>(); +}); + +test('#asImmutable', () => { + expect(List().asImmutable()).type.toBe>(); +}); + +test('#toJS', () => { + expect(List>().toJS()).type.toBe(); +}); + +test('#toJSON', () => { + expect(List>().toJSON()).type.toBe[]>(); +}); + +test('for of loops', () => { + const list = List([1, 2, 3, 4]); + + for (const val of list) { + expect(val).type.toBe(); + } +}); diff --git a/type-definitions/ts-tests/map.ts b/type-definitions/ts-tests/map.ts new file mode 100644 index 0000000000..59f39eb36c --- /dev/null +++ b/type-definitions/ts-tests/map.ts @@ -0,0 +1,668 @@ +import { expect, pick, test } from 'tstyche'; +import { Map, List, MapOf, OrderedMap } from 'immutable'; + +test('#constructor', () => { + expect(Map()).type.toBe>(); + + expect(Map()).type.toBe>(); + + expect(Map([[1, 'a']])).type.toBe>(); + + expect(Map([['a', 'a']])).type.toBe>(); + + expect(Map(List<[number, string]>([[1, 'a']]))).type.toBe< + Map + >(); + + expect(Map({ a: 1 })).type.toBe>(); + + expect(Map({ a: 1, b: 'b' })).type.toBe>(); + + expect(Map({ a: Map({ b: Map({ c: 3 }) }) })).type.toBe< + MapOf<{ a: MapOf<{ b: MapOf<{ c: number }> }> }> + >(); + + expect(Map<{ a: string }>({ a: 1 })).type.toRaiseError(); + + expect(Map<{ a: string }>({ a: 'a', b: 'b' })).type.toRaiseError(); + + // TODO this type is really weird, it should be `Map` or MapOf<{ a: string }> See https://github.com/immutable-js/immutable-js/pull/1991#discussion_r1510863932 + expect(Map(List([List(['a', 'b'])]))).type.toBe>>>(); + + expect(Map([[1, 'a']])).type.not.toBeAssignableTo>(); + + expect(Map<'status', string>({ status: 'paid' })).type.toBe< + Map<'status', string> + >(); + + expect(Map<'status' | 'amount', string>({ status: 'paid' })).type.toBe< + Map<'status' | 'amount', string> + >(); + + expect( + Map<'status', string>({ status: 'paid', amount: 10 }) + ).type.toRaiseError(); +}); + +test('#size', () => { + expect(pick(Map(), 'size')).type.toBe<{ readonly size: number }>(); +}); + +test('#get', () => { + expect(Map().get(4)).type.toBe(); + + expect(Map().get(4, 'a')).type.toBe(); + + expect(Map().get(4, 'a')).type.toRaiseError(); + + expect(Map({ a: 4, b: true }).get('a')).type.toBe(); + + expect(Map({ a: 4, b: true }).get('b')).type.toBe(); + + expect( + Map({ a: Map({ b: true }) }) + .get('a') + .get('b') + ).type.toBe(); + + expect(Map({ a: 4 }).get('b')).type.toRaiseError(); + + expect(Map({ a: 4 }).get('b', undefined)).type.toBe(); + + expect(Map({ 1: 4 }).get(1)).type.toBe(); + + expect(Map({ 1: 4 }).get(2)).type.toRaiseError(); + + expect(Map({ 1: 4 }).get(2, 3)).type.toBe<3>(); + + const s1 = Symbol('s1'); + + expect(Map({ [s1]: 4 }).get(s1)).type.toBe(); + + const s2 = Symbol('s2'); + + expect(Map({ [s2]: 4 }).get(s1)).type.toRaiseError(); +}); + +test('#getIn', () => { + const result = Map({ a: 4, b: true }).getIn(['a']); + + expect(result).type.toBe(); + + expect(Map({ a: 4, b: true }).getIn(['a' as const])).type.toBe(); + + expect( + Map({ a: Map({ b: Map({ c: Map({ d: 4 }) }) }) }).getIn([ + 'a' as const, + 'b' as const, + 'c' as const, + 'd' as const, + ]) + ).type.toBe(); + + expect(Map({ a: [1] }).getIn(['a' as const, 0])).type.toBe(); + + expect(Map({ a: List([1]) }).getIn(['a' as const, 0])).type.toBe(); +}); + +test('#set', () => { + expect(Map().set(0, 0)).type.toBe>(); + + expect(Map().set(1, 'a')).type.toRaiseError(); + + expect(Map().set('a', 1)).type.toRaiseError(); + + expect(Map().set(0, 1)).type.toBe< + Map + >(); + + expect(Map().set(0, 'a')).type.toBe< + Map + >(); + + expect(Map({ a: 1 }).set('b', 'b')).type.toRaiseError(); + + expect(Map<{ a: number; b?: string }>({ a: 1 }).set('b', 'b')).type.toBe< + MapOf<{ a: number; b?: string | undefined }> + >(); + + expect( + Map<{ a: number; b?: string }>({ a: 1 }).set('b', undefined) + ).type.toBe>(); + + expect( + Map<{ a: number; b?: string }>({ a: 1 }).set('b', 'b').get('a') + ).type.toBe(); + + expect( + Map<{ a: number; b?: string }>({ a: 1 }).set('b', 'b').get('b') + ).type.toBe(); + + const customer = Map<{ phone: string | number }>({ + phone: 'bar', + }); + + expect(customer).type.toBeAssignableWith(customer.set('phone', 8)); +}); + +test('#setIn', () => { + expect(Map().setIn([], 0)).type.toBe>(); +}); + +test('#delete', () => { + expect(Map().delete(0)).type.toBe>(); + + expect(Map().delete('a')).type.toRaiseError(); + + expect(Map({ a: 1, b: 'b' }).delete('b')).type.toBe(); + + expect( + Map<{ a: number; b?: string }>({ a: 1, b: 'b' }).delete('b') + ).type.toBe>(); + + expect( + Map<{ a?: number; b?: string }>({ a: 1, b: 'b' }).remove('b').delete('a') + ).type.toBe>(); + + expect( + Map<{ a: number; b?: string }>({ a: 1, b: 'b' }).remove('b').get('a') + ).type.toBe(); + + expect( + Map<{ a: number; b?: string }>({ a: 1, b: 'b' }).remove('b').get('b') + ).type.toBe(); +}); + +test('#deleteAll', () => { + expect(Map().deleteAll([0])).type.toBe>(); + + expect(Map().deleteAll([0, 'a'])).type.toRaiseError(); +}); + +test('#deleteIn', () => { + expect(Map().deleteIn([])).type.toBe>(); +}); + +test('#remove', () => { + expect(Map().remove(0)).type.toBe>(); + + expect(Map().remove('a')).type.toRaiseError(); +}); + +test('#removeAll', () => { + expect(Map().removeAll([0])).type.toBe>(); + + expect(Map().removeAll([0, 'a'])).type.toRaiseError(); +}); + +test('#removeIn', () => { + expect(Map().removeIn([])).type.toBe>(); +}); + +test('#clear', () => { + expect(Map().clear()).type.toBe>(); + + expect(Map().clear(10)).type.toRaiseError(); +}); + +test('#update', () => { + expect(Map().update((v) => 1)).type.toBe(); + + expect( + Map().update((v: Map | undefined) => v) + ).type.toRaiseError(); + + expect( + Map().update(0, (v: number | undefined) => 0) + ).type.toBe>(); + + expect( + Map().update(0, (v: number | undefined) => v + 'a') + ).type.toRaiseError(); + + expect( + Map().update(1, 10, (v: number | undefined) => 0) + ).type.toBe>(); + + expect( + Map().update(1, 'a', (v: number | undefined) => 0) + ).type.toRaiseError(); + + expect( + Map().update(1, 10, (v: number | undefined) => v + 'a') + ).type.toRaiseError(); + + expect(Map({ a: 1, b: 'b' }).update('c', (v) => v)).type.toRaiseError(); + + expect(Map({ a: 1, b: 'b' }).update('b', (v) => v.toUpperCase())).type.toBe< + MapOf<{ a: number; b: string }> + >(); + + expect( + Map({ a: 1, b: 'b' }).update('b', 'NSV', (v) => v.toUpperCase()) + ).type.toBe>(); + + expect(Map({ a: 1, b: 'b' }).update((v) => ({ a: 'a' }))).type.toRaiseError(); + + expect( + Map({ a: 1, b: 'b' }).update((v) => v.set('a', 2).set('b', 'B')) + ).type.toBe>(); + + expect( + Map({ a: 1, b: 'b' }).update((v) => v.set('c', 'c')) + ).type.toRaiseError(); + + expect( + Map().update('noKey', (ls) => ls?.toUpperCase()) + ).type.toBe>(); +}); + +test('#updateIn', () => { + expect(Map().updateIn([], (v) => v)).type.toBe< + Map + >(); + + expect(Map().updateIn([], 10)).type.toRaiseError(); +}); + +test('#map', () => { + expect( + Map().map( + (value: number, key: number, iter: Map) => 1 + ) + ).type.toBe>(); + + expect( + Map().map( + (value: number, key: number, iter: Map) => 'a' + ) + ).type.toBe>(); + + expect( + Map().map( + (value: number, key: number, iter: Map) => 1 + ) + ).type.toBe>(); + + expect( + Map().map( + (value: number, key: number, iter: Map) => 1 + ) + ).type.toRaiseError(); + + expect( + Map().map( + (value: string, key: number, iter: Map) => 1 + ) + ).type.toRaiseError(); + + expect( + Map().map( + (value: number, key: string, iter: Map) => 1 + ) + ).type.toRaiseError(); + + expect( + Map().map( + (value: number, key: number, iter: Map) => 1 + ) + ).type.toRaiseError(); + + expect( + Map().map( + (value: number, key: number, iter: Map) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#mapKeys', () => { + expect( + Map().mapKeys( + (value: number, key: number, iter: Map) => 1 + ) + ).type.toBe>(); + + expect( + Map().mapKeys( + (value: number, key: number, iter: Map) => 'a' + ) + ).type.toBe>(); + + expect( + Map().mapKeys( + (value: number, key: number, iter: Map) => 1 + ) + ).type.toBe>(); + + expect( + Map().mapKeys( + (value: number, key: number, iter: Map) => 1 + ) + ).type.toRaiseError(); + + expect( + Map().mapKeys( + (value: string, key: number, iter: Map) => 1 + ) + ).type.toRaiseError(); + + expect( + Map().mapKeys( + (value: number, key: string, iter: Map) => 1 + ) + ).type.toRaiseError(); + + expect( + Map().mapKeys( + (value: number, key: number, iter: Map) => 1 + ) + ).type.toRaiseError(); + + expect( + Map().mapKeys( + (value: number, key: number, iter: Map) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#flatMap', () => { + expect( + Map().flatMap( + (value: number, key: number, iter: Map) => [[0, 1]] + ) + ).type.toBe>(); + + expect( + Map().flatMap( + (value: number, key: number, iter: Map) => [['a', 'b']] + ) + ).type.toBe>(); + + expect( + Map().flatMap( + (value: number, key: number, iter: Map) => [[0, 1]] + ) + ).type.toBe>(); + + expect( + Map().flatMap( + (value: number, key: number, iter: Map) => [[0, 1]] + ) + ).type.toRaiseError(); + + expect( + Map().flatMap( + (value: string, key: number, iter: Map) => [[0, 1]] + ) + ).type.toRaiseError(); + + expect( + Map().flatMap( + (value: number, key: string, iter: Map) => [[0, 1]] + ) + ).type.toRaiseError(); + + expect( + Map().flatMap( + (value: number, key: number, iter: Map) => [[0, 1]] + ) + ).type.toRaiseError(); + + expect( + Map().flatMap( + (value: number, key: number, iter: Map) => [[0, 'a']] + ) + ).type.toRaiseError(); +}); + +test('#merge', () => { + expect(Map().merge({ a: 1 })).type.toBe< + Map + >(); + + expect(Map().merge({ a: { b: 1 } })).type.toBe< + Map + >(); + + expect(Map().merge(Map())).type.toBe< + Map + >(); + + expect(Map().merge(Map())).type.toBe< + Map + >(); + + expect(Map().merge(Map())).type.toBe< + Map + >(); + + expect(Map().merge(Map())).type.toBe< + Map + >(); + + expect(Map({ a: 1 }).merge(Map({ b: 2 }))).type.toBe< + Map<'b' | 'a', number> + >(); +}); + +test('#mergeIn', () => { + expect(Map().mergeIn([], [])).type.toBe< + Map + >(); +}); + +test('#mergeWith', () => { + expect( + Map().mergeWith( + (prev: number, next: number, key: number) => 1, + Map() + ) + ).type.toBe>(); + + expect( + Map().mergeWith( + (prev: string, next: number, key: number) => 1, + Map() + ) + ).type.toRaiseError(); + + expect( + Map().mergeWith( + (prev: number, next: string, key: number) => 1, + Map() + ) + ).type.toRaiseError(); + + expect( + Map().mergeWith( + (prev: number, next: number, key: string) => 1, + Map() + ) + ).type.toRaiseError(); + + expect( + Map().mergeWith( + (prev: number, next: number, key: number) => 'a', + Map() + ) + ).type.toBe>(); + + expect( + Map().mergeWith( + (prev: number, next: number, key: number) => 1, + Map() + ) + ).type.toRaiseError(); + + expect( + Map().mergeWith( + (prev: number, next: number, key: string) => 1, + { a: 1 } + ) + ).type.toBe>(); + + expect( + Map().mergeWith( + (prev: number, next: number, key: string) => 1, + { a: 'a' } + ) + ).type.toRaiseError(); + + expect( + Map().mergeWith( + (prev: number, next: number | string, key: string) => 1, + { a: 'a' } + ) + ).type.toBe>(); + + expect( + Map().mergeWith( + (prev: number | string, next: number | string, key: number) => 1, + Map() + ) + ).type.toBe>(); +}); + +test('#mergeDeep', () => { + expect(Map().mergeDeep({ a: 1 })).type.toBe< + Map + >(); + + expect(Map().mergeDeep({ a: { b: 1 } })).type.toBe< + Map + >(); + + expect(Map().mergeDeep(Map({ a: { b: 1 } }))).type.toBe< + Map + >(); + + expect(Map().mergeDeep(Map())).type.toBe< + Map + >(); + + expect(Map().mergeDeep(Map())).type.toBe< + Map + >(); + + expect( + Map().mergeDeep(Map()) + ).type.toBe>(); + + expect( + Map().mergeDeep(Map()) + ).type.toBe>(); +}); + +test('#mergeDeepIn', () => { + expect(Map().mergeDeepIn([], [])).type.toBe< + Map + >(); +}); + +test('#mergeDeepWith', () => { + expect( + Map().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + Map() + ) + ).type.toBe>(); + + expect( + Map().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + Map() + ) + ).type.toRaiseError(); + + expect( + Map().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + { a: 1 } + ) + ).type.toBe>(); + + expect( + Map().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + { a: 'a' } + ) + ).type.toRaiseError(); + + expect( + Map().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + Map() + ) + ).type.toBe>(); +}); + +test('#flip', () => { + expect(Map().flip()).type.toBe>(); +}); + +test('#sort', () => { + expect(Map().sort()).type.toBe< + Map & OrderedMap + >(); + expect(Map().sort((a, b) => 1)).type.toBe< + Map & OrderedMap + >(); + + expect(Map({ a: 'a' }).sort()).type.toBe< + MapOf<{ a: string }> & OrderedMap<'a', string> + >(); +}); + +test('#sortBy', () => { + expect(Map().sortBy((v) => v)).type.toBe< + Map & OrderedMap + >(); + + expect( + Map().sortBy( + (v) => v, + (a, b) => 1 + ) + ).type.toBe & OrderedMap>(); + expect(Map({ a: 'a' }).sortBy((v) => v)).type.toBe< + MapOf<{ a: string }> & OrderedMap<'a', string> + >(); +}); + +test('#withMutations', () => { + expect(Map().withMutations((mutable) => mutable)).type.toBe< + Map + >(); + + expect( + Map().withMutations((mutable: Map) => mutable) + ).type.toRaiseError(); +}); + +test('#asMutable', () => { + expect(Map().asMutable()).type.toBe>(); +}); + +test('#asImmutable', () => { + expect(Map().asImmutable()).type.toBe>(); +}); + +test('#toJS', () => { + expect(Map().toJS()).type.toBe<{ + [x: string]: number; + [x: number]: number; + [x: symbol]: number; + }>(); + + expect(Map({ a: 'A' }).toJS()).type.toBe<{ a: string }>(); + + expect(Map({ a: Map({ b: 'b' }) }).toJS()).type.toBe<{ + a: { b: string }; + }>(); +}); + +test('#toJSON', () => { + expect(Map({ a: Map({ b: 'b' }) }).toJSON()).type.toBe<{ + a: MapOf<{ b: string }>; + }>(); +}); diff --git a/type-definitions/ts-tests/ordered-map.ts b/type-definitions/ts-tests/ordered-map.ts new file mode 100644 index 0000000000..56341ff76e --- /dev/null +++ b/type-definitions/ts-tests/ordered-map.ts @@ -0,0 +1,504 @@ +import { expect, pick, test } from 'tstyche'; +import { OrderedMap, List } from 'immutable'; + +test('#constructor', () => { + expect(OrderedMap()).type.toBe>(); + + expect(OrderedMap()).type.toBe>(); + + expect(OrderedMap([[1, 'a']])).type.toBe>(); + + expect(OrderedMap(List<[number, string]>([[1, 'a']]))).type.toBe< + OrderedMap + >(); + + expect(OrderedMap({ a: 1 })).type.toBe>(); + + // No longer works in typescript@>=3.9 + // // $ExpectError - TypeScript does not support Lists as tuples + // OrderedMap(List([List(['a', 'b'])])); +}); + +test('#size', () => { + expect(pick(OrderedMap(), 'size')).type.toBe<{ readonly size: number }>(); +}); + +test('#get', () => { + expect(OrderedMap().get(4)).type.toBe(); + + expect(OrderedMap().get(4, 'a')).type.toBe(); + + expect(OrderedMap().get(4, 'a')).type.toRaiseError(); +}); + +test('#set', () => { + expect(OrderedMap().set(0, 0)).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().set(1, 'a')).type.toRaiseError(); + + expect(OrderedMap().set('a', 1)).type.toRaiseError(); + + expect(OrderedMap().set(0, 1)).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().set(0, 'a')).type.toBe< + OrderedMap + >(); +}); + +test('#setIn', () => { + expect(OrderedMap().setIn([], 0)).type.toBe< + OrderedMap + >(); +}); + +test('#delete', () => { + expect(OrderedMap().delete(0)).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().delete('a')).type.toRaiseError(); +}); + +test('#deleteAll', () => { + expect(OrderedMap().deleteAll([0])).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().deleteAll([0, 'a'])).type.toRaiseError(); +}); + +test('#deleteIn', () => { + expect(OrderedMap().deleteIn([])).type.toBe< + OrderedMap + >(); +}); + +test('#remove', () => { + expect(OrderedMap().remove(0)).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().remove('a')).type.toRaiseError(); +}); + +test('#removeAll', () => { + expect(OrderedMap().removeAll([0])).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().removeAll([0, 'a'])).type.toRaiseError(); +}); + +test('#removeIn', () => { + expect(OrderedMap().removeIn([])).type.toBe< + OrderedMap + >(); +}); + +test('#clear', () => { + expect(OrderedMap().clear()).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().clear(10)).type.toRaiseError(); +}); + +test('#update', () => { + expect(OrderedMap().update((v) => 1)).type.toBe(); + + expect( + OrderedMap().update( + (v: OrderedMap | undefined) => v + ) + ).type.toRaiseError(); + + expect( + OrderedMap().update(0, (v: number | undefined) => 0) + ).type.toBe>(); + + expect( + OrderedMap().update(0, (v: number | undefined) => v + 'a') + ).type.toRaiseError(); + + expect( + OrderedMap().update(1, 10, (v: number | undefined) => 0) + ).type.toBe>(); + + expect( + OrderedMap().update(1, 'a', (v: number | undefined) => 0) + ).type.toRaiseError(); + + expect( + OrderedMap().update( + 1, + 10, + (v: number | undefined) => v + 'a' + ) + ).type.toRaiseError(); +}); + +test('#updateIn', () => { + expect(OrderedMap().updateIn([], (v) => v)).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().updateIn([], 10)).type.toRaiseError(); +}); + +test('#map', () => { + expect( + OrderedMap().map( + (value: number, key: number, iter: OrderedMap) => 1 + ) + ).type.toBe>(); + + expect( + OrderedMap().map( + (value: number, key: number, iter: OrderedMap) => 'a' + ) + ).type.toBe>(); + + expect( + OrderedMap().map( + (value: number, key: number, iter: OrderedMap) => 1 + ) + ).type.toBe>(); + + expect( + OrderedMap().map( + (value: number, key: number, iter: OrderedMap) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedMap().map( + (value: string, key: number, iter: OrderedMap) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedMap().map( + (value: number, key: string, iter: OrderedMap) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedMap().map( + (value: number, key: number, iter: OrderedMap) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedMap().map( + (value: number, key: number, iter: OrderedMap) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#mapKeys', () => { + expect( + OrderedMap().mapKeys( + (value: number, key: number, iter: OrderedMap) => 1 + ) + ).type.toBe>(); + + expect( + OrderedMap().mapKeys( + (value: number, key: number, iter: OrderedMap) => 'a' + ) + ).type.toBe>(); + + expect( + OrderedMap().mapKeys( + (value: number, key: number, iter: OrderedMap) => 1 + ) + ).type.toBe>(); + + expect( + OrderedMap().mapKeys( + (value: number, key: number, iter: OrderedMap) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mapKeys( + (value: string, key: number, iter: OrderedMap) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mapKeys( + (value: number, key: string, iter: OrderedMap) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mapKeys( + (value: number, key: number, iter: OrderedMap) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mapKeys( + (value: number, key: number, iter: OrderedMap) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#flatMap', () => { + expect( + OrderedMap().flatMap( + (value: number, key: number, iter: OrderedMap) => [[0, 1]] + ) + ).type.toBe>(); + + expect( + OrderedMap().flatMap( + (value: number, key: number, iter: OrderedMap) => [ + ['a', 'b'], + ] + ) + ).type.toBe>(); + + expect( + OrderedMap().flatMap( + (value: number, key: number, iter: OrderedMap) => [[0, 1]] + ) + ).type.toBe>(); + + expect( + OrderedMap().flatMap( + (value: number, key: number, iter: OrderedMap) => [[0, 1]] + ) + ).type.toRaiseError(); + + expect( + OrderedMap().flatMap( + (value: string, key: number, iter: OrderedMap) => [[0, 1]] + ) + ).type.toRaiseError(); + + expect( + OrderedMap().flatMap( + (value: number, key: string, iter: OrderedMap) => [[0, 1]] + ) + ).type.toRaiseError(); + + expect( + OrderedMap().flatMap( + (value: number, key: number, iter: OrderedMap) => [[0, 1]] + ) + ).type.toRaiseError(); + + expect( + OrderedMap().flatMap( + (value: number, key: number, iter: OrderedMap) => [ + [0, 'a'], + ] + ) + ).type.toRaiseError(); +}); + +test('#merge', () => { + expect(OrderedMap().merge({ a: 1 })).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().merge({ a: { b: 1 } })).type.toBe< + OrderedMap + >(); + + expect( + OrderedMap().merge(OrderedMap()) + ).type.toBe>(); + + expect( + OrderedMap().merge(OrderedMap()) + ).type.toBe>(); + + expect( + OrderedMap().merge(OrderedMap()) + ).type.toBe>(); + + expect( + OrderedMap().merge(OrderedMap()) + ).type.toBe>(); +}); + +test('#mergeIn', () => { + expect(OrderedMap().mergeIn([], [])).type.toBe< + OrderedMap + >(); +}); + +test('#mergeWith', () => { + expect( + OrderedMap().mergeWith( + (prev: number, next: number, key: number) => 1, + OrderedMap() + ) + ).type.toBe>(); + + expect( + OrderedMap().mergeWith( + (prev: string, next: number, key: number) => 1, + OrderedMap() + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mergeWith( + (prev: number, next: string, key: number) => 1, + OrderedMap() + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mergeWith( + (prev: number, next: number, key: string) => 1, + OrderedMap() + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mergeWith( + (prev: number, next: number, key: number) => 'a', + OrderedMap() + ) + ).type.toBe>(); + + expect( + OrderedMap().mergeWith( + (prev: number, next: number, key: number) => 1, + OrderedMap() + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mergeWith( + (prev: number, next: number, key: string) => 1, + { a: 1 } + ) + ).type.toBe>(); + + expect( + OrderedMap().mergeWith( + (prev: number, next: number, key: string) => 1, + { a: 'a' } + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mergeWith( + (prev: number | string, next: number | string, key: number) => 1, + OrderedMap() + ) + ).type.toBe>(); +}); + +test('#mergeDeep', () => { + expect(OrderedMap().mergeDeep({ a: 1 })).type.toBe< + OrderedMap + >(); + + expect(OrderedMap().mergeDeep({ a: { b: 1 } })).type.toBe< + OrderedMap + >(); + + expect( + OrderedMap().mergeDeep(OrderedMap()) + ).type.toBe>(); + + expect( + OrderedMap().mergeDeep(OrderedMap()) + ).type.toBe>(); + + expect( + OrderedMap().mergeDeep( + OrderedMap() + ) + ).type.toBe>(); + + expect( + OrderedMap().mergeDeep( + OrderedMap() + ) + ).type.toBe>(); +}); + +test('#mergeDeepIn', () => { + expect(OrderedMap().mergeDeepIn([], [])).type.toBe< + OrderedMap + >(); +}); + +test('#mergeDeepWith', () => { + expect( + OrderedMap().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + OrderedMap() + ) + ).type.toBe>(); + + expect( + OrderedMap().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + OrderedMap() + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + { a: 1 } + ) + ).type.toBe>(); + + expect( + OrderedMap().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + { a: 'a' } + ) + ).type.toRaiseError(); + + expect( + OrderedMap().mergeDeepWith( + (prev: unknown, next: unknown, key: unknown) => 1, + OrderedMap() + ) + ).type.toBe>(); +}); + +test('#flip', () => { + expect(OrderedMap().flip()).type.toBe< + OrderedMap + >(); +}); + +test('#withMutations', () => { + expect( + OrderedMap().withMutations((mutable) => mutable) + ).type.toBe>(); + + expect( + OrderedMap().withMutations( + (mutable: OrderedMap) => mutable + ) + ).type.toRaiseError(); +}); + +test('#asMutable', () => { + expect(OrderedMap().asMutable()).type.toBe< + OrderedMap + >(); +}); + +test('#asImmutable', () => { + expect(OrderedMap().asImmutable()).type.toBe< + OrderedMap + >(); +}); diff --git a/type-definitions/ts-tests/ordered-set.ts b/type-definitions/ts-tests/ordered-set.ts new file mode 100644 index 0000000000..b753c09a53 --- /dev/null +++ b/type-definitions/ts-tests/ordered-set.ts @@ -0,0 +1,278 @@ +import { expect, pick, test } from 'tstyche'; +import { Collection, OrderedSet, Map } from 'immutable'; + +test('#constructor', () => { + expect(OrderedSet()).type.toBe>(); + + expect(OrderedSet()).type.toBe>(); + + expect(OrderedSet([1, 'a'])).type.toBe>(); + + expect(OrderedSet([1, 'a'])).type.not.toBeAssignableTo(OrderedSet()); +}); + +test('#size', () => { + expect(pick(OrderedSet(), 'size')).type.toBe<{ readonly size: number }>(); +}); + +test('.of', () => { + expect(OrderedSet.of(1, 2, 3)).type.toBe>(); + + expect(OrderedSet.of('a', 1)).type.toRaiseError(); + + expect(OrderedSet.of('a', 1)).type.toBe< + OrderedSet + >(); +}); + +test('.fromKeys', () => { + expect(OrderedSet.fromKeys(Map())).type.toBe< + OrderedSet + >(); + + expect(OrderedSet.fromKeys(Map())).type.toBe< + OrderedSet + >(); + + expect(OrderedSet.fromKeys({ a: 1 })).type.toBe>(); + + expect( + OrderedSet.fromKeys(Map()) + ).type.toRaiseError(); + + expect( + OrderedSet.fromKeys(Map()) + ).type.toBe>(); +}); + +test('#get', () => { + expect(OrderedSet().get(4)).type.toBe(); + + expect(OrderedSet().get(4, 'a')).type.toBe(); + + expect(OrderedSet().get(4, 'a')).type.toRaiseError(); +}); + +test('#delete', () => { + expect(OrderedSet().delete(0)).type.toBe>(); + + expect(OrderedSet().delete('a')).type.toRaiseError(); +}); + +test('#remove', () => { + expect(OrderedSet().remove(0)).type.toBe>(); + + expect(OrderedSet().remove('a')).type.toRaiseError(); +}); + +test('#clear', () => { + expect(OrderedSet().clear()).type.toBe>(); + + expect(OrderedSet().clear(10)).type.toRaiseError(); +}); + +test('#map', () => { + expect( + OrderedSet().map( + (value: number, key: number, iter: OrderedSet) => 1 + ) + ).type.toBe>(); + + expect( + OrderedSet().map( + (value: number, key: number, iter: OrderedSet) => 'a' + ) + ).type.toBe>(); + + expect( + OrderedSet().map( + (value: number, key: number, iter: OrderedSet) => 1 + ) + ).type.toBe>(); + + expect( + OrderedSet().map( + (value: number, key: number, iter: OrderedSet) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedSet().map( + (value: string, key: number, iter: OrderedSet) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedSet().map( + (value: number, key: string, iter: OrderedSet) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedSet().map( + (value: number, key: number, iter: OrderedSet) => 1 + ) + ).type.toRaiseError(); + + expect( + OrderedSet().map( + (value: number, key: number, iter: OrderedSet) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#flatMap', () => { + expect( + OrderedSet().flatMap( + (value: number, key: number, iter: OrderedSet) => [1] + ) + ).type.toBe>(); + + expect( + OrderedSet().flatMap( + (value: number, key: number, iter: OrderedSet) => ['a'] + ) + ).type.toBe>(); + + expect( + OrderedSet().flatMap( + (value: number, key: number, iter: OrderedSet) => [1] + ) + ).type.toBe>(); + + expect( + OrderedSet().flatMap( + (value: number, key: number, iter: OrderedSet) => [1] + ) + ).type.toRaiseError(); + + expect( + OrderedSet().flatMap( + (value: string, key: number, iter: OrderedSet) => [1] + ) + ).type.toRaiseError(); + + expect( + OrderedSet().flatMap( + (value: number, key: string, iter: OrderedSet) => [1] + ) + ).type.toRaiseError(); + + expect( + OrderedSet().flatMap( + (value: number, key: number, iter: OrderedSet) => [1] + ) + ).type.toRaiseError(); + + expect( + OrderedSet().flatMap( + (value: number, key: number, iter: OrderedSet) => ['a'] + ) + ).type.toRaiseError(); +}); + +test('#union', () => { + expect(OrderedSet().union(OrderedSet())).type.toBe< + OrderedSet + >(); + + expect(OrderedSet().union(OrderedSet())).type.toBe< + OrderedSet + >(); + + expect(OrderedSet().union(OrderedSet())).type.toBe< + OrderedSet + >(); + + expect(OrderedSet().union(OrderedSet())).type.toBe< + OrderedSet + >(); +}); + +test('#merge', () => { + expect(OrderedSet().merge(OrderedSet())).type.toBe< + OrderedSet + >(); + + expect(OrderedSet().merge(OrderedSet())).type.toBe< + OrderedSet + >(); + + expect(OrderedSet().merge(OrderedSet())).type.toBe< + OrderedSet + >(); + + expect(OrderedSet().merge(OrderedSet())).type.toBe< + OrderedSet + >(); +}); + +test('#intersect', () => { + expect(OrderedSet().intersect(OrderedSet())).type.toBe< + OrderedSet + >(); + + expect( + OrderedSet().intersect(OrderedSet()) + ).type.toRaiseError(); + + expect( + OrderedSet().intersect(OrderedSet()) + ).type.toBe>(); + + expect( + OrderedSet().intersect(OrderedSet()) + ).type.toBe>(); +}); + +test('#subtract', () => { + expect(OrderedSet().subtract(OrderedSet())).type.toBe< + OrderedSet + >(); + + expect( + OrderedSet().subtract(OrderedSet()) + ).type.toRaiseError(); + + expect( + OrderedSet().subtract(OrderedSet()) + ).type.toBe>(); + + expect( + OrderedSet().subtract(OrderedSet()) + ).type.toBe>(); +}); + +test('#flatten', () => { + expect(OrderedSet().flatten()).type.toBe< + Collection + >(); + + expect(OrderedSet().flatten(10)).type.toBe< + Collection + >(); + + expect(OrderedSet().flatten(false)).type.toBe< + Collection + >(); + + expect(OrderedSet().flatten('a')).type.toRaiseError(); +}); + +test('#withMutations', () => { + expect(OrderedSet().withMutations((mutable) => mutable)).type.toBe< + OrderedSet + >(); + + expect( + OrderedSet().withMutations((mutable: OrderedSet) => mutable) + ).type.toRaiseError(); +}); + +test('#asMutable', () => { + expect(OrderedSet().asMutable()).type.toBe>(); +}); + +test('#asImmutable', () => { + expect(OrderedSet().asImmutable()).type.toBe>(); +}); diff --git a/type-definitions/ts-tests/partition.ts b/type-definitions/ts-tests/partition.ts new file mode 100644 index 0000000000..a9d4871e94 --- /dev/null +++ b/type-definitions/ts-tests/partition.ts @@ -0,0 +1,184 @@ +/* eslint-disable @typescript-eslint/no-unused-expressions */ +import { expect, test } from 'tstyche'; +import { + Collection, + List, + Map, + OrderedMap, + OrderedSet, + Seq, + Set, +} from 'immutable'; + +abstract class A {} +class B extends A {} + +test('Collection', () => { + type Indexed = Collection.Indexed; + type Keyed = Collection.Keyed; + type Set = Collection.Set; + + (c: Collection) => { + expect(c.partition((x) => x % 2)).type.toBe< + [Collection, Collection] + >(); + }; + + (c: Collection) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Collection, Collection] + >(); + }; + + (c: Keyed) => { + expect(c.partition((x) => x % 2)).type.toBe< + [Keyed, Keyed] + >(); + }; + + (c: Keyed) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Keyed, Keyed] + >(); + }; + + (c: Indexed) => { + expect(c.partition((x) => x % 2)).type.toBe< + [Indexed, Indexed] + >(); + }; + + (c: Indexed) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Indexed, Indexed] + >(); + }; + + (c: Set) => { + expect(c.partition((x) => x % 2)).type.toBe<[Set, Set]>(); + }; + + (c: Set) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Set, Set] + >(); + }; +}); + +test('Seq', () => { + type Indexed = Seq.Indexed; + type Keyed = Seq.Keyed; + type Set = Seq.Set; + + (c: Seq) => { + expect(c.partition((x) => x % 2)).type.toBe< + [Seq, Seq] + >(); + }; + + (c: Seq) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Seq, Seq] + >(); + }; + + (c: Keyed) => { + expect(c.partition((x) => x % 2)).type.toBe< + [Keyed, Keyed] + >(); + }; + + (c: Keyed) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Keyed, Keyed] + >(); + }; + + (c: Indexed) => { + expect(c.partition((x) => x % 2)).type.toBe< + [Indexed, Indexed] + >(); + }; + + (c: Indexed) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Indexed, Indexed] + >(); + }; + + (c: Set) => { + expect(c.partition((x) => x % 2)).type.toBe<[Set, Set]>(); + }; + + (c: Set) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Set, Set] + >(); + }; +}); + +test('Map', () => { + (c: Map) => { + expect(c.partition((x) => x % 2)).type.toBe< + [Map, Map] + >(); + }; + + (c: Map) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Map, Map] + >(); + }; +}); + +test('OrderedMap', () => { + (c: OrderedMap) => { + expect(c.partition((x) => x % 2)).type.toBe< + [OrderedMap, OrderedMap] + >(); + }; + + (c: OrderedMap) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [OrderedMap, OrderedMap] + >(); + }; +}); + +test('List', () => { + (c: List) => { + expect(c.partition((x) => x % 2)).type.toBe<[List, List]>(); + }; + + (c: List) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [List, List] + >(); + }; +}); + +test('Set', () => { + (c: Set) => { + expect(c.partition((x) => x % 2)).type.toBe<[Set, Set]>(); + }; + + (c: Set) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [Set, Set] + >(); + }; +}); + +test('OrderedSet', () => { + (c: OrderedSet) => { + expect(c.partition((x) => x % 2)).type.toBe< + [OrderedSet, OrderedSet] + >(); + }; + + (c: OrderedSet) => { + expect(c.partition((x): x is B => x instanceof B)).type.toBe< + [OrderedSet, OrderedSet] + >(); + }; +}); diff --git a/type-definitions/ts-tests/range.ts b/type-definitions/ts-tests/range.ts new file mode 100644 index 0000000000..79db184113 --- /dev/null +++ b/type-definitions/ts-tests/range.ts @@ -0,0 +1,12 @@ +import { expect, test } from 'tstyche'; +import { Range, Seq } from 'immutable'; + +test('#constructor', () => { + expect(Range(0, 0, 1)).type.toBe>(); + + expect(Range('a', 0, 0)).type.toRaiseError(); + + expect(Range()).type.toRaiseError(); + + expect(Range(1)).type.toRaiseError(); +}); diff --git a/type-definitions/ts-tests/record.ts b/type-definitions/ts-tests/record.ts new file mode 100644 index 0000000000..bb2db4ee3a --- /dev/null +++ b/type-definitions/ts-tests/record.ts @@ -0,0 +1,110 @@ +import { expect, pick, test } from 'tstyche'; +import { List, Map, MapOf, Record, RecordOf, Set } from 'immutable'; + +test('Factory', () => { + const PointXY = Record({ x: 0, y: 0 }); + + expect(PointXY).type.toBe>(); + + expect(PointXY({ x: 'a' })).type.toRaiseError(); + + const pointXY = PointXY(); + + expect(pointXY).type.toBe< + Record<{ x: number; y: number }> & Readonly<{ x: number; y: number }> + >(); + + expect(pick(pointXY, 'x')).type.toBe<{ readonly x: number }>(); + + expect(pick(pointXY, 'y')).type.toBe<{ readonly y: number }>(); + + expect(pointXY.toJS()).type.toBe<{ x: number; y: number }>(); + + class PointClass extends PointXY { + setX(x: number) { + return this.set('x', x); + } + + setY(y: number) { + return this.set('y', y); + } + } + + const point = new PointClass(); + + expect(point).type.toBe(); + + expect(point.x).type.toBe(); + + expect(point.y).type.toBe(); + + expect(point.setX(10)).type.toBe(); + + expect(point.setY(10)).type.toBe(); + + expect(point.toJSON()).type.toBe<{ x: number; y: number }>(); + + expect(point.toJS()).type.toBe<{ x: number; y: number }>(); +}); + +test('.getDescriptiveName', () => { + const PointXY = Record({ x: 0, y: 0 }); + + expect(Record.getDescriptiveName(PointXY())).type.toBe(); + + expect(Record.getDescriptiveName({})).type.toRaiseError(); +}); + +test('Factory', () => { + const WithMap = Record({ + map: Map({ a: 'A' }), + list: List(['a']), + set: Set(['a']), + }); + + const withMap = WithMap(); + + expect(withMap.toJSON()).type.toBe<{ + map: MapOf<{ a: string }>; + list: List; + set: Set; + }>(); + + // should be `{ map: { a: string; }; list: string[]; set: string[]; }` but there is an issue with circular references + expect(withMap.toJS()).type.toBe<{ + map: unknown; + list: unknown; + set: unknown; + }>(); +}); + +test('optional properties', () => { + interface Size { + distance: string; + } + + const Line = Record<{ size?: Size; color?: string }>({ + size: undefined, + color: 'red', + }); + + const line = Line({}); + + // should be { size?: { distance: string; } | undefined; color?: string | undefined; } but there is an issue with circular references + expect(line.toJS()).type.toBe<{ + size?: unknown; + color?: string | undefined; + }>(); +}); + +test('similar properties, but one is optional', () => { + // see https://github.com/immutable-js/immutable-js/issues/1930 + + interface Id { + value: string; + } + + expect>().type.toBeAssignableWith< + RecordOf<{ id: Id }> + >(); +}); diff --git a/type-definitions/ts-tests/repeat.ts b/type-definitions/ts-tests/repeat.ts new file mode 100644 index 0000000000..9506b753f1 --- /dev/null +++ b/type-definitions/ts-tests/repeat.ts @@ -0,0 +1,10 @@ +import { expect, test } from 'tstyche'; +import { Repeat, Seq } from 'immutable'; + +test('#constructor', () => { + expect(Repeat(0, 0)).type.toBe>(); + + expect(Repeat('a', 0)).type.toBe>(); + + expect(Repeat('a', 'b')).type.toRaiseError(); +}); diff --git a/type-definitions/ts-tests/seq.ts b/type-definitions/ts-tests/seq.ts new file mode 100644 index 0000000000..d967acaade --- /dev/null +++ b/type-definitions/ts-tests/seq.ts @@ -0,0 +1,26 @@ +import { expect, pick, test } from 'tstyche'; +import { Seq } from 'immutable'; + +test('#constructor', () => { + expect(Seq([1, 2, 3])).type.toBe>(); +}); + +test('#size', () => { + expect(pick(Seq(), 'size')).type.toBe<{ + readonly size: number | undefined; + }>(); +}); + +test('Set.Indexed concat', () => { + const s: Seq.Indexed = Seq([1]); + expect(s).type.toBe>(); + expect(s.concat([4, 5, 6])).type.toBe>(); + expect(s.concat(Seq([4, 5, 6]))).type.toBe>(); +}); + +test('Set concat', () => { + const s: Seq = Seq([1]); + expect(s).type.toBe>(); + expect(s.concat([4, 5, 6])).type.toBe>(); + expect(s.concat(Seq([4, 5, 6]))).type.toBe>(); +}); diff --git a/type-definitions/ts-tests/set.ts b/type-definitions/ts-tests/set.ts new file mode 100644 index 0000000000..9149417986 --- /dev/null +++ b/type-definitions/ts-tests/set.ts @@ -0,0 +1,274 @@ +import { expect, pick, test } from 'tstyche'; +import { Set, Map, Collection, OrderedSet } from 'immutable'; + +test('#constructor', () => { + expect(Set()).type.toBe>(); + + expect(Set()).type.toBe>(); + + expect(Set([1, 'a'])).type.toBe>(); + + expect>().type.not.toBeAssignableWith(Set([1, 'a'])); +}); + +test('#size', () => { + expect(pick(Set(), 'size')).type.toBe<{ readonly size: number }>(); +}); + +test('.of', () => { + expect(Set.of(1, 2, 3)).type.toBe>(); + + expect(Set.of('a', 1)).type.toRaiseError(); + + expect(Set.of('a', 1)).type.toBe>(); +}); + +test('.fromKeys', () => { + expect(Set.fromKeys(Map())).type.toBe>(); + + expect(Set.fromKeys(Map())).type.toBe>(); + + expect(Set.fromKeys({ a: 1 })).type.toBe>(); + + expect(Set.fromKeys(Map())).type.toRaiseError(); + + expect( + Set.fromKeys(Map()) + ).type.toBe>(); +}); + +test('#get', () => { + expect(Set().get(4)).type.toBe(); + + expect(Set().get(4, 'a')).type.toBe(); + + expect(Set().get(4, 'a')).type.toRaiseError(); +}); + +test('#delete', () => { + expect(Set().delete(0)).type.toBe>(); + + expect(Set().delete('a')).type.toRaiseError(); +}); + +test('#remove', () => { + expect(Set().remove(0)).type.toBe>(); + + expect(Set().remove('a')).type.toRaiseError(); +}); + +test('#clear', () => { + expect(Set().clear()).type.toBe>(); + + expect(Set().clear(10)).type.toRaiseError(); +}); + +test('#map', () => { + expect( + Set().map((value: number, key: number, iter: Set) => 1) + ).type.toBe>(); + + expect( + Set().map((value: number, key: number, iter: Set) => 'a') + ).type.toBe>(); + + expect( + Set().map( + (value: number, key: number, iter: Set) => 1 + ) + ).type.toBe>(); + + expect( + Set().map( + (value: number, key: number, iter: Set) => 1 + ) + ).type.toRaiseError(); + + expect( + Set().map( + (value: string, key: number, iter: Set) => 1 + ) + ).type.toRaiseError(); + + expect( + Set().map( + (value: number, key: string, iter: Set) => 1 + ) + ).type.toRaiseError(); + + expect( + Set().map( + (value: number, key: number, iter: Set) => 1 + ) + ).type.toRaiseError(); + + expect( + Set().map( + (value: number, key: number, iter: Set) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#flatMap', () => { + expect( + Set().flatMap((value: number, key: number, iter: Set) => [ + 1, + ]) + ).type.toBe>(); + + expect( + Set().flatMap((value: number, key: number, iter: Set) => [ + 'a', + ]) + ).type.toBe>(); + + expect( + Set().flatMap( + (value: number, key: number, iter: Set) => [1] + ) + ).type.toBe>(); + + expect( + Set().flatMap( + (value: number, key: number, iter: Set) => [1] + ) + ).type.toRaiseError(); + + expect( + Set().flatMap( + (value: string, key: number, iter: Set) => [1] + ) + ).type.toRaiseError(); + + expect( + Set().flatMap( + (value: number, key: string, iter: Set) => [1] + ) + ).type.toRaiseError(); + + expect( + Set().flatMap( + (value: number, key: number, iter: Set) => [1] + ) + ).type.toRaiseError(); + + expect( + Set().flatMap( + (value: number, key: number, iter: Set) => ['a'] + ) + ).type.toRaiseError(); +}); + +test('#union', () => { + expect(Set().union(Set())).type.toBe>(); + + expect(Set().union(Set())).type.toBe>(); + + expect(Set().union(Set())).type.toBe< + Set + >(); + + expect(Set().union(Set())).type.toBe< + Set + >(); +}); + +test('#merge', () => { + expect(Set().merge(Set())).type.toBe>(); + + expect(Set().merge(Set())).type.toBe>(); + + expect(Set().merge(Set())).type.toBe< + Set + >(); + + expect(Set().merge(Set())).type.toBe< + Set + >(); +}); + +test('#intersect', () => { + expect(Set().intersect(Set())).type.toBe>(); + + expect(Set().intersect(Set())).type.toRaiseError(); + + expect(Set().intersect(Set())).type.toBe< + Set + >(); + + expect(Set().intersect(Set())).type.toBe< + Set + >(); +}); + +test('#subtract', () => { + expect(Set().subtract(Set())).type.toBe>(); + + expect(Set().subtract(Set())).type.toRaiseError(); + + expect(Set().subtract(Set())).type.toBe< + Set + >(); + + expect(Set().subtract(Set())).type.toBe< + Set + >(); +}); + +test('#flatten', () => { + expect(Set().flatten()).type.toBe>(); + + expect(Set().flatten(10)).type.toBe>(); + + expect(Set().flatten(false)).type.toBe< + Collection + >(); + + expect(Set().flatten('a')).type.toRaiseError(); +}); + +test('#sort', () => { + expect(Set().sort()).type.toBe & OrderedSet>(); + expect(Set().sort((a, b) => 1)).type.toBe< + Set & OrderedSet + >(); +}); + +test('#sortBy', () => { + expect(Set().sortBy((v) => v)).type.toBe< + Set & OrderedSet + >(); + + expect( + Set().sortBy( + (v) => v, + (a, b) => 1 + ) + ).type.toBe & OrderedSet>(); +}); + +test('#withMutations', () => { + expect(Set().withMutations((mutable) => mutable)).type.toBe< + Set + >(); + + expect( + Set().withMutations((mutable: Set) => mutable) + ).type.toRaiseError(); +}); + +test('#asMutable', () => { + expect(Set().asMutable()).type.toBe>(); +}); + +test('#asImmutable', () => { + expect(Set().asImmutable()).type.toBe>(); +}); + +test('#toJS', () => { + expect(Set>().toJS()).type.toBe(); +}); + +test('#toJSON', () => { + expect(Set>().toJSON()).type.toBe[]>(); +}); diff --git a/type-definitions/ts-tests/stack.ts b/type-definitions/ts-tests/stack.ts new file mode 100644 index 0000000000..d261b1152a --- /dev/null +++ b/type-definitions/ts-tests/stack.ts @@ -0,0 +1,226 @@ +import { expect, pick, test } from 'tstyche'; +import { Collection, Stack } from 'immutable'; + +test('#constructor', () => { + expect(Stack()).type.toBe>(); + + expect(Stack()).type.toBe>(); + + expect(Stack([1, 'a'])).type.toBe>(); +}); + +test('#size', () => { + expect(pick(Stack(), 'size')).type.toBe<{ readonly size: number }>(); +}); + +test('.of', () => { + expect(Stack.of(1, 2, 3)).type.toBe>(); + + expect(Stack.of('a', 1)).type.toRaiseError(); + + expect(Stack.of('a', 1)).type.toBe>(); +}); + +test('#peek', () => { + expect(Stack().peek()).type.toBe(); +}); + +test('#push', () => { + expect(Stack().push(0)).type.toBe>(); + + expect(Stack().push('a')).type.toRaiseError(); + + expect(Stack().push(0)).type.toBe>(); + + expect(Stack().push('a')).type.toBe< + Stack + >(); +}); + +test('#pushAll', () => { + expect(Stack().pushAll([0])).type.toBe>(); + + expect(Stack().pushAll(['a'])).type.toRaiseError(); + + expect(Stack().pushAll([0])).type.toBe< + Stack + >(); + + expect(Stack().pushAll(['a'])).type.toBe< + Stack + >(); +}); + +test('#unshift', () => { + expect(Stack().unshift(0)).type.toBe>(); + + expect(Stack().unshift('a')).type.toRaiseError(); + + expect(Stack().unshift(0)).type.toBe< + Stack + >(); + + expect(Stack().unshift('a')).type.toBe< + Stack + >(); +}); + +test('#unshiftAll', () => { + expect(Stack().unshiftAll([0])).type.toBe>(); + + expect(Stack().unshiftAll(['a'])).type.toRaiseError(); + + expect(Stack().unshiftAll([1])).type.toBe< + Stack + >(); + + expect(Stack().unshiftAll(['a'])).type.toBe< + Stack + >(); +}); + +test('#clear', () => { + expect(Stack().clear()).type.toBe>(); + + expect(Stack().clear(10)).type.toRaiseError(); +}); + +test('#pop', () => { + expect(Stack().pop()).type.toBe>(); + + expect(Stack().pop(10)).type.toRaiseError(); +}); + +test('#shift', () => { + expect(Stack().shift()).type.toBe>(); + + expect(Stack().shift(10)).type.toRaiseError(); +}); + +test('#map', () => { + expect( + Stack().map((value: number, key: number, iter: Stack) => 1) + ).type.toBe>(); + + expect( + Stack().map( + (value: number, key: number, iter: Stack) => 'a' + ) + ).type.toBe>(); + + expect( + Stack().map( + (value: number, key: number, iter: Stack) => 1 + ) + ).type.toBe>(); + + expect( + Stack().map( + (value: number, key: number, iter: Stack) => 1 + ) + ).type.toRaiseError(); + + expect( + Stack().map( + (value: string, key: number, iter: Stack) => 1 + ) + ).type.toRaiseError(); + + expect( + Stack().map( + (value: number, key: string, iter: Stack) => 1 + ) + ).type.toRaiseError(); + + expect( + Stack().map( + (value: number, key: number, iter: Stack) => 1 + ) + ).type.toRaiseError(); + + expect( + Stack().map( + (value: number, key: number, iter: Stack) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#flatMap', () => { + expect( + Stack().flatMap( + (value: number, key: number, iter: Stack) => [1] + ) + ).type.toBe>(); + + expect( + Stack().flatMap( + (value: number, key: number, iter: Stack) => 'a' + ) + ).type.toBe>(); + + expect( + Stack().flatMap( + (value: number, key: number, iter: Stack) => [1] + ) + ).type.toBe>(); + + expect( + Stack().flatMap( + (value: number, key: number, iter: Stack) => 1 + ) + ).type.toRaiseError(); + + expect( + Stack().flatMap( + (value: string, key: number, iter: Stack) => 1 + ) + ).type.toRaiseError(); + + expect( + Stack().flatMap( + (value: number, key: string, iter: Stack) => 1 + ) + ).type.toRaiseError(); + + expect( + Stack().flatMap( + (value: number, key: number, iter: Stack) => 1 + ) + ).type.toRaiseError(); + + expect( + Stack().flatMap( + (value: number, key: number, iter: Stack) => 'a' + ) + ).type.toRaiseError(); +}); + +test('#flatten', () => { + expect(Stack().flatten()).type.toBe>(); + + expect(Stack().flatten(10)).type.toBe>(); + + expect(Stack().flatten(false)).type.toBe< + Collection + >(); + + expect(Stack().flatten('a')).type.toRaiseError(); +}); + +test('#withMutations', () => { + expect(Stack().withMutations((mutable) => mutable)).type.toBe< + Stack + >(); + + expect( + Stack().withMutations((mutable: Stack) => mutable) + ).type.toRaiseError(); +}); + +test('#asMutable', () => { + expect(Stack().asMutable()).type.toBe>(); +}); + +test('#asImmutable', () => { + expect(Stack().asImmutable()).type.toBe>(); +}); diff --git a/type-definitions/ts-tests/tsconfig.json b/type-definitions/ts-tests/tsconfig.json new file mode 100644 index 0000000000..12fa9cfb76 --- /dev/null +++ b/type-definitions/ts-tests/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "target": "es2015", + "module": "commonjs", + "sourceMap": true, + "strict": true, + "types": [], + "noEmit": true, + "lib": ["es2015"], + "baseUrl": "./", + "paths": { + "immutable": ["../immutable.d.ts"] + } + }, + "exclude": ["node_modules"] +} diff --git a/type-definitions/tsconfig.json b/type-definitions/tsconfig.json new file mode 100644 index 0000000000..18735e2da8 --- /dev/null +++ b/type-definitions/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "target": "es2015", + "module": "commonjs", + "sourceMap": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "lib": ["es2015"], + "types": [] + }, + "files": ["immutable.d.ts"] +} diff --git a/website/.eslintrc b/website/.eslintrc new file mode 100644 index 0000000000..97a2bb84ef --- /dev/null +++ b/website/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": ["next", "next/core-web-vitals"] +} diff --git a/website/docs/Collection.Indexed.mdx b/website/docs/Collection.Indexed.mdx new file mode 100644 index 0000000000..a412d811a3 --- /dev/null +++ b/website/docs/Collection.Indexed.mdx @@ -0,0 +1,793 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Collection.Indexed + +Indexed Collections have incrementing numeric keys. They exhibit +slightly different behavior than `Collection.Keyed` for some methods in order +to better mirror the behavior of JavaScript's `Array`, and add methods +which do not make sense on non-indexed Collections such as `indexOf`. + +Unlike JavaScript arrays, `Collection.Indexed`s are always dense. "Unset" +indices and `undefined` indices are indistinguishable, and all indices from +0 to `size` are visited when iterated. + +All Collection.Indexed methods return re-indexed Collections. In other words, +indices always start at 0 and increment until size. If you wish to +preserve indices, using them as keys, convert to a Collection.Keyed by +calling `toKeyedSeq`. + +## Construction + + + +Creates a new Collection.Indexed. + +(collection?: Iterable | ArrayLike): Collection.Indexed;`} +/> + +Note: `Collection.Indexed` is a conversion function and not a class, and does not use the `new` keyword during construction. + +## Reading values + + + +Returns the value associated with the provided index, or notSetValue if the index is beyond the bounds of the Collection. + +(index: number, notSetValue: NSV): T | NSV; +get(index: number): T | undefined;`} +/> + +`index` may be a negative number, which indexes back from the end of the Collection. `s.get(-1)` gets the last item in the Collection. + + + +True if a key exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +In case the `Collection` is not empty returns the first element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): T | NSV; +first(): T | undefined;`} +/> + + + +In case the `Collection` is not empty returns the last element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): T | NSV; +last(): T | undefined;`} +/> + +## Conversion to JavaScript types + + + +Deeply converts this Indexed collection to equivalent native JavaScript Array. + +>;`} /> + + + +Shallowly converts this Indexed collection to equivalent native JavaScript Array. + +;`} /> + + + +Shallowly converts this collection to an Array. + +;`} /> + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Seq + + + +Returns Seq.Indexed. + +;`} /> + + + +If this is a collection of [key, value] entry tuples, it will return a Seq.Keyed of those entries. + +;`} /> + + + +Returns a Seq.Keyed with the same key-value entries as this Collection.Indexed. + +;`} /> + + + +Returns a Seq.Indexed with the same values as this Collection.Indexed. + +;`} /> + + + +Returns a Seq.Set with the same values as this Collection.Indexed. + +;`} /> + +## Combination + + + +Returns a Collection of the same type with `separator` between each item in this Collection. + + + + + +Returns a Collection of the same type with the provided `collections` interleaved into this collection. + +>): this;`} +/> + +The resulting Collection includes the first item from each, then the second from each, etc. + + + +The shortest Collection stops interleave. + + + +Since `interleave()` re-indexes values, it produces a complete copy, which has `O(N)` complexity. + +Note: `interleave` _cannot_ be used in `withMutations`. + + + +Splice returns a new indexed Collection by replacing a region of this Collection with new values. If values are not provided, it only skips the region to be removed. + +): this;`} +/> + +`index` may be a negative number, which indexes back from the end of the Collection. `s.splice(-2)` splices after the second to last item. + + + +Since `splice()` re-indexes values, it produces a complete copy, which has `O(N)` complexity. + +Note: `splice` _cannot_ be used in `withMutations`. + + + +Returns a Collection of the same type "zipped" with the provided collections. + +(other: Collection): Collection.Indexed<[T, U]>;`} +/> +(other: Collection, other2: Collection): Collection.Indexed<[T, U, V]>;`} +/> +>): Collection.Indexed;`} +/> + +Like `zipWith`, but using the default `zipper`: creating an `Array`. + + + + + +Returns a Collection "zipped" with the provided collections. Unlike `zip`, `zipAll` continues zipping until the longest collection is exhausted. Missing values from shorter collections are filled with `undefined`. + +(other: Collection): Collection.Indexed<[T, U]>;`} +/> +(other: Collection, other2: Collection): Collection.Indexed<[T, U, V]>;`} +/> +>): Collection.Indexed;`} +/> + + + + + +Returns a Collection of the same type "zipped" with the provided collections by using a custom `zipper` function. + +(zipper: (value: T, otherValue: U) => Z, otherCollection: Collection): Collection.Indexed;`} +/> +(zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection): Collection.Indexed;`} +/> +(zipper: (...values: Array) => Z, ...collections: Array>): Collection.Indexed;`} +/> + + a + b, b);`} +/> + + + +Flattens nested Collections. + +;`} /> +;`} /> + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only others Collection, not Arrays or Objects. + +Note: `flatten(true)` operates on `Collection>` and returns `Collection` + +## Search for value + + + +Returns the first index at which a given value can be found in the Collection, or -1 if it is not present. + + + + + +Returns the last index at which a given value can be found in the Collection, or -1 if it is not present. + + + + + +Returns the first index in the Collection where a value satisfies the provided predicate function. Otherwise -1 is returned. + + boolean, context?: unknown): number;`} +/> + + + +Returns the last index in the Collection where a value satisfies the provided predicate function. Otherwise -1 is returned. + + boolean, context?: unknown): number;`} +/> + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined;`} +/> + + + +Returns the last value for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined;`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown): [number, T] | undefined;`} +/> + + + +Returns the last [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown): [number, T] | undefined;`} +/> + + + +Returns the key for which the `predicate` returns true. + + boolean, context?: unknown): number | undefined;`} +/> + + + +Returns the last key for which the `predicate` returns true. + + boolean, context?: unknown): number | undefined;`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined;`} /> + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +(comparatorValueMapper: (value: T, key: number, iter: this) => C, comparator?: Comparator): T | undefined;`} +/> + + i.avgHit);`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined;`} /> + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +(comparatorValueMapper: (value: T, key: number, iter: this) => C, comparator?: Comparator): T | undefined;`} +/> + + i.avgHit);`} +/> + +## Sequence algorithms + + + +Returns a new Collection with other collections concatenated to this one. + +(...valuesOrCollections: Array | C>): Collection.Indexed;`} +/> + + + +Returns a new Collection.Indexed with values passed through a `mapper` function. + +(mapper: (value: T, key: number, iter: this) => M, context?: unknown): Collection.Indexed;`} +/> + + 10 * x)`} /> + +Note: `map()` always returns a new instance, even if it produced the same value at every step. + + + +Flat-maps the Collection, returning a Collection of the same type. + +(mapper: (value: T, key: number, iter: this) => Iterable, context?: unknown): Collection.Indexed;`} +/> + +Similar to `collection.map(...).flatten(true)`. + + + +Returns a new Collection with only the values for which the `predicate` function returns true. + +(predicate: (value: T, index: number, iter: this) => value is F, context?: unknown): Collection.Indexed;`} +/> + unknown, context?: unknown): this;`} +/> + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new indexed Collection with the values for which the `predicate` function returns false and another for which is returns true. + +(predicate: (this: C, value: T, index: number, iter: this) => value is F, context?: C): [Collection.Indexed, Collection.Indexed];`} +/> +(predicate: (this: C, value: T, index: number, iter: this) => unknown, context?: C): [this, this];`} +/> + + + +;`} /> + + + +Returns a new Collection with only the values for which the `predicate` function returns false. + + unknown, context?: unknown): this;`} +/> + + x > 2)`} /> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Collection with the values in reverse order. + + + + + +Returns a new sorted Collection, sorted by the natural order of the values. + +;`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +Note: `sort()` always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a new sorted Collection, sorted by the provided `comparator` function. + +(comparator: (value: T) => R): Collection.Indexed;`} +/> + +Note: `sortBy()` always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Groups the values by the return value of the `mapper` function, and returns a Collection.Indexed of Arrays of grouped values. + +(mapper: (value: T) => K): Collection.Indexed>;`} +/> + +## Value equality + + + +Returns true if the Collections are of the same size and all values are equal. + + + + + +Returns a hash code for this Collection. + + + +## Reading deep values + + + +Returns the value at the given nested path, or notSetValue if any key in the path is not present. + +(path: Array, notSetValue: NSV): T | NSV;`} +/> +): T | undefined;`} /> + + + +Returns a boolean if the given nested path exists. + +): boolean;`} /> + +## Persistent changes + + + +Returns a new Collection.Indexed with the value at the given index updated to the new value. + + T): this;`} /> + +## Conversion to Collections + + + +Converts this Collection.Indexed to a Map. The first value of each entry is used as the key. + +;`} /> + + + +Converts this Collection.Indexed to an OrderedMap. The first value of each entry is used as the key. + +;`} /> + + + +Converts this Collection.Indexed to a Set. + +;`} /> + + + +Converts this Collection.Indexed to an OrderedSet. + +;`} /> + + + +Converts this Collection.Indexed to a List. + +;`} /> + + + +Converts this Collection.Indexed to a Stack. + +;`} /> + +## Iterators + + + +Returns an Iterable of the keys in the Collection. + +;`} /> + + + +Returns an Iterable of the values in the Collection. + +;`} /> + + + +Returns an Iterable of the [key, value] entries in the Collection. + +;`} /> + +## Collections (Seq) + + + +Returns a Seq of the keys in the Collection. + +;`} /> + + + +Returns a Seq of the values in the Collection. + +;`} /> + + + +Returns a Seq of the [key, value] entries in the Collection. + +;`} /> + +## Side effects + + + +Calls the provided function for each value in the Collection. Returns the Collection. + + void, context?: unknown): this;`} +/> + +## Creating subsets + + + +Returns a new Collection.Indexed with the values between the given start and end indices. + + + + + +Returns a new Collection.Indexed with all but the first value. + + + + + +Returns a new Collection.Indexed with all but the last value. + + + + + +Returns a new Collection.Indexed with the first `n` values removed. + + + + + +Returns a new Collection.Indexed with the last `n` values removed. + + + + + +Returns a new Collection.Indexed with values skipped while the `predicate` function returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection.Indexed with values skipped until the `predicate` function returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection.Indexed with the first `n` values. + + + + + +Returns a new Collection.Indexed with the last `n` values. + + + + + +Returns a new Collection.Indexed with values taken while the `predicate` function returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection.Indexed with values taken until the `predicate` function returns true. + + boolean, context?: unknown): this;`} +/> + +## Reducing a value + + + +Returns the accumulated result of calling the provided reducer function for each value in the Collection, from left to right. + +(reducer: (previousValue: R | T, currentValue: T, index: number, iter: this) => R, initialValue?: R): R;`} +/> + + + +Returns the accumulated result of calling the provided reducer function for each value in the Collection, from right to left. + +(reducer: (previousValue: R | T, currentValue: T, index: number, iter: this) => R, initialValue?: R): R;`} +/> + + + +Returns true if the `predicate` function returns a truthy value for every value in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +Returns true if the `predicate` function returns a truthy value for any value in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +Returns the concatenated string result of calling `String(value)` on every value in the Collection, separated by the given separator string. + + + + + +Returns true if the Collection has no values. + + + + + +Returns the number of values in the Collection. + + + + + +Returns a new Collection.Indexed with the number of times each value occurs in the Collection. + +;`} /> + +## Comparison + + + +Returns true if this Collection.Indexed is a subset of the other Collection (i.e. all values in this Collection.Indexed are also in the other). + + + + + +Returns true if this Collection.Indexed is a superset of the other Collection (i.e. this Collection.Indexed contains all values of the other). diff --git a/website/docs/Collection.Keyed.mdx b/website/docs/Collection.Keyed.mdx new file mode 100644 index 0000000000..d932babb17 --- /dev/null +++ b/website/docs/Collection.Keyed.mdx @@ -0,0 +1,883 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Collection.Keyed + +Keyed Collections have discrete keys tied to each value. + + + +When iterating `Collection.Keyed`, each iteration will yield a [K, V] tuple, in other words, `Collection#entries` is the default iterator for Keyed Collections. + +## Construction + + + +Creates a Collection.Keyed + +Similar to `Collection()`, however it expects collection-likes of [K, V] +tuples if not constructed from a Collection.Keyed or JS Object. + +Note: `Collection.Keyed` is a conversion function and not a class, and +does not use the `new` keyword during construction. + +## Conversion to JavaScript types + + + +Deeply converts this Keyed collection to equivalent native JavaScript Object. + + };`} /> +Converts keys to Strings. + + + +Shallowly converts this Keyed collection to equivalent native JavaScript Object. + + +Converts keys to Strings. + + + +Shallowly converts this collection to an Array of [key, value] pairs. + +;`} /> + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Seq + + + +Returns Seq.Keyed. + + + +Returns a Seq.Keyed from this Collection where indices are treated as keys. + +;`} /> + +This is useful if you want to operate on an Collection.Indexed and preserve the [index, value] pairs. + +The returned Seq will have identical iteration order as this Collection. + +```js +const indexedSeq = Seq(['A', 'B', 'C']); +// Seq [ "A", "B", "C" ] +indexedSeq.filter((v) => v === 'B'); +// Seq [ "B" ] +const keyedSeq = indexedSeq.toKeyedSeq(); +// Seq { 0: "A", 1: "B", 2: "C" } +keyedSeq.filter((v) => v === 'B'); +``` + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +;`} /> + + + +Returns a Seq.Set of the values of this Collection, discarding keys. + +;`} /> + +## Sequence functions + + + +Returns a new Collection.Keyed of the same type where the keys and values have been flipped. + + + +```js +const { Map } = require('immutable'); +Map({ a: 'z', b: 'y' }).flip(); +// Map { "z": "a", "y": "b" } +``` + + + +Returns a new Collection with other collections concatenated to this one. + +(...collections: Array>): Collection.Keyed;`} +/> +(...collections: Array<{ [key: string]: C }>): Collection.Keyed;`} +/> + + + +Returns a new Collection.Keyed with values passed through a `mapper` function. + +(mapper: (value: V, key: K, iter: this) => M, context?: unknown): Collection.Keyed;`} +/> + +```js +const { Collection } = require('immutable'); +Collection.Keyed({ a: 1, b: 2 }).map((x) => 10 * x); +// Seq { "a": 10, "b": 20 } +``` + +Note: `map()` always returns a new instance, even if it produced the same value at every step. + + + +Returns a new Collection.Keyed of the same type with keys passed through a `mapper` function. + +(mapper: (key: K, value: V, iter: this) => M, context?: unknown): Collection.Keyed;`} +/> + +```js +const { Map } = require('immutable'); +Map({ a: 1, b: 2 }).mapKeys((x) => x.toUpperCase()); +// Map { "A": 1, "B": 2 } +``` + +Note: `mapKeys()` always returns a new instance, even if it produced the same key at every step. + + + +Returns a new Collection.Keyed of the same type with entries ([key, value] tuples) passed through a `mapper` function. + +(mapper: (entry: [K, V], index: number, iter: this) => [KM, VM] | undefined, context?: unknown): Collection.Keyed;`} +/> + +```js +const { Map } = require('immutable'); +Map({ a: 1, b: 2 }).mapEntries(([k, v]) => [k.toUpperCase(), v * 2]); +// Map { "A": 2, "B": 4 } +``` + +Note: `mapEntries()` always returns a new instance, even if it produced the same entry at every step. +If the mapper function returns `undefined`, then the entry will be filtered. + + + +Flat-maps the Collection, returning a Collection of the same type. + +(mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: unknown): Collection.Keyed;`} +/> + +Similar to `collection.map(...).flatten(true)`. + + + +Returns a new Collection with only the values for which the `predicate` function returns true. + +(predicate: (value: V, key: K, iter: this) => value is F, context?: unknown): Collection.Keyed;`} +/> + unknown, context?: unknown): this;`} +/> + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + + +(predicate: (this: C, value: V, key: K, iter: this) => value is F, context?: C): [Collection.Keyed, Collection.Keyed];`} +/> +(predicate: (this: C, value: V, key: K, iter: this) => unknown, context?: C): [this, this];`} +/> + +Returns a new keyed Collection with the values for which the `predicate` function returns false and another for which it returns true. + + + +;`} /> + +Yields [key, value] pairs. + +## Value equality + + + +Returns true if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: this is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + + + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + +```js +const a = List([1, 2, 3]); +const b = List([1, 2, 3]); +assert.notStrictEqual(a, b); // different instances +const set = Set([a]); +assert.equal(set.has(b), true); +``` + +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading values + + + +Returns the value associated with the provided key, or notSetValue if the Collection does not contain this key. + +(key: K, notSetValue: NSV): V | NSV;`} /> + + +Note: it is possible a key may be associated with an `undefined` value, so if `notSetValue` is not provided and this method returns `undefined`, that does not guarantee the key was not found. + + + +True if a key exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +In case the `Collection` is not empty returns the first element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): V | NSV;`} /> + + + + +In case the `Collection` is not empty returns the last element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): V | NSV;`} /> + + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown;`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean;`} /> + +## Persistent changes + + + +This can be very useful as a way to "chain" a normal function into a sequence of methods. RxJS calls this "let" and lodash calls it "thru". + +(updater: (value: this) => R): R;`} /> + +For example, to sum a Seq after mapping and filtering: + + sum + x, 0); +} + +Seq([1, 2, 3]) +.map((x) => x + 1) +.filter((x) => x % 2 === 0) +.update(sum);`} +/> + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +;`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +;`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Set, discarding keys. Throws if values are not hashable. + +;`} /> + +Note: This is equivalent to Set(this), but provided to allow for chained expressions. + + + +Converts this Collection to a Set, maintaining the order of iteration and discarding keys. + +;`} /> + +Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List, discarding keys. + +;`} /> + +This is similar to `List(collection)`, but provided to allow for chained expressions. However, when called on `Map` or other keyed collections, `collection.toList()` ignores the keys and creates a list of just the values, whereas `List(collection)` creates a list of entry tuples. + + + + + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +;`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Iterators + + + +An iterator of this `Collection`'s keys. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `keySeq` instead if you want an Immutable.js Seq. + + + +An iterator of this `Collection`'s values. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `valueSeq` instead if you want an Immutable.js Seq. + + + +An iterator of this `Collection`'s entries as `[ key, value ]` tuples. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `entrySeq` instead if you want an Immutable.js Seq. + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, discarding values. + +;`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +;`} /> + + + +Returns a new Seq.Indexed of [key, value] tuples. + +;`} /> + +## Sequence algorithms + + + +Returns a new Collection of the same type with only the entries for which the `predicate` function returns false. + + boolean, context?: unknown): this;`} +/> + +```js +const { Map } = require('immutable'); +Map({ a: 1, b: 2, c: 3, d: 4 }).filterNot((x) => x % 2 === 0); +// Map { "a": 1, "c": 3 } +``` + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Collection of the same type in reverse order. + + + + + +Returns a new Collection of the same type which includes the same entries, stably sorted by using a `comparator`. + +): this;`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +```js +const { Map } = require('immutable'); +Map({ c: 3, a: 1, b: 2 }).sort((a, b) => { + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + if (a === b) { + return 0; + } +}); +// OrderedMap { "a": 1, "b": 2, "c": 3 } +``` + +Note: `sort()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means: + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number): this;`} +/> + + member.name);`} +/> + +Note: `sortBy()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a `Map` of `Collection`, grouped by the return value of the `grouper` function. + +(grouper: (value: V, key: K, iter: this) => G, context?: unknown): Map;`} +/> + +Note: This is always an eager operation. + + x.get('v'));`} +/> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Collection. + + unknown, context?: unknown): number;`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned false). + +## Creating subsets + + + +Returns a new Collection of the same type representing a portion of this Collection from start up to but not including end. + + + +If begin is negative, it is offset from the end of the Collection. e.g. slice(-2) returns a Collection of the last two entries. If it is not provided the new Collection will begin at the beginning of this Collection. + +If end is negative, it is offset from the end of the Collection. e.g. slice(0, -1) returns a Collection of everything but the last entry. If it is not provided, the new Collection will continue through the end of this Collection. + +If the requested slice is equivalent to the current Collection, then it will return itself. + + + +Returns a new Collection of the same type containing all entries except the first. + + + + + +Returns a new Collection of the same type containing all entries except the last. + + + + + +Returns a new Collection of the same type which excludes the first `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which excludes the last `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): this;`} +/> + + x.match(/g/)) +// List [ "cat", "hat", "god" ] +`} +/> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): this;`} +/> + + x.match(/hat/)) +// List [ "hat", "god" ] +`} +/> + + + +Returns a new Collection of the same type which includes the first `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes the last `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns true. + + boolean, context?: unknown): this;`} +/> + +```js +const { List } = require('immutable'); +List(['dog', 'frog', 'cat', 'hat', 'god']).takeWhile((x) => x.match(/o/)); +// List [ "dog", "frog" ] +``` + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns false. + + boolean, context?: unknown): this;`} +/> + +```js +const { List } = require('immutable'); +List(['dog', 'frog', 'cat', 'hat', 'god']).takeUntil((x) => x.match(/at/)); +// List [ "dog", "frog" ] +``` + +## Combination + + + +Flattens nested Collections. + +; +flatten(shallow?: boolean): Collection;`} +/> + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only other Collections, not Arrays or Objects. + +Note: `flatten(true)` operates on `Collection>` and returns `Collection`. + +## Reducing a value + + + +Reduces the Collection to a value by calling the `reducer` for every entry in the Collection and passing along the reduced value. + +If `initialReduction` is not provided, the first item in the Collection will be used. + +(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: unknown): R; +reduce(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R;`} +/> + + + +Reduces the Collection in reverse (from the right side). + +(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: unknown): R; +reduceRight(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R;`} +/> + + + +True if `predicate` returns true for all entries in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +True if `predicate` returns true for any entry in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +Joins values together as a string, inserting a separator between each. The default separator is `","`. + + + + + +Returns true if this Collection includes no values. + +For some lazy `Seq`, `isEmpty` might need to iterate to determine emptiness. At most one iteration will occur. + + + + + +Returns the size of this Collection. + +Regardless of if this Collection can describe its size lazily (some Seqs cannot), this method will always return the correct size. E.g. it evaluates a lazy `Seq` if necessary. + +If `predicate` is provided, then this returns the count of entries in the Collection for which the `predicate` returns true. + + boolean, context?: unknown): number;`} +/> + + + +Returns a `Seq.Keyed` of counts, grouped by the return value of the `grouper` function. + +(grouper: (value: V, key: K, iter: this) => G, context?: unknown): Map;`} +/> + +Note: This is not a lazy operation. + +## Search for value + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: V): V | undefined;`} +/> + + + +Returns the last value for which the `predicate` returns true. + +Note: `predicate` will be called for each entry in reverse. + + boolean, context?: unknown, notSetValue?: V): V | undefined;`} +/> + + + +Returns the first [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: V): [K, V] | undefined;`} +/> + + + +Returns the last [key, value] entry for which the `predicate` returns true. + +Note: `predicate` will be called for each entry in reverse. + + boolean, context?: unknown, notSetValue?: V): [K, V] | undefined;`} +/> + + + +Returns the key for which the `predicate` returns true. + + boolean, context?: unknown): K | undefined;`} +/> + + + +Returns the last key for which the `predicate` returns true. + +Note: `predicate` will be called for each entry in reverse. + + boolean, context?: unknown): K | undefined;`} +/> + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + +): V | undefined;`} /> + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: Comparator): V | undefined;`} +/> + +```js +const { List } = require('immutable'); +const l = List([ + { name: 'Bob', avgHit: 1 }, + { name: 'Max', avgHit: 3 }, + { name: 'Lili', avgHit: 2 }, +]); +l.maxBy((i) => i.avgHit); // will output { name: 'Max', avgHit: 3 +``` + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): V | undefined;`} /> + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: Comparator): V | undefined;`} +/> + +```js +const { List } = require('immutable'); +const l = List([ + { name: 'Bob', avgHit: 1 }, + { name: 'Max', avgHit: 3 }, + { name: 'Lili', avgHit: 2 }, +]); +l.minBy((i) => i.avgHit); // will output { name: 'Bob', avgHit: 1 } +``` + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean;`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean;`} /> diff --git a/website/docs/Collection.Set.mdx b/website/docs/Collection.Set.mdx new file mode 100644 index 0000000000..b9056ad458 --- /dev/null +++ b/website/docs/Collection.Set.mdx @@ -0,0 +1,765 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Collection.Set + +Set Collections only represent values. They have no associated keys or indices. Duplicate values are possible in the lazy s, however the concrete Collection does not allow duplicate values. + + + +Collection methods on Collection.Set such as and will provide the value as both the first and second arguments to the provided function. + +```js +const seq = Collection.Set(['A', 'B', 'C']); +// Seq { "A", "B", "C" } +seq.forEach((v, k) => { + assert.equal(v, k); +}); +``` + +## Construction + + + +Similar to Collection(), but always returns a `Collection.Set`. + + + +Note: `Collection.Set` is a factory function and not a class, and does not use the `new` keyword during construction. + +## Sequence algorithms + + + +Returns a new `Collection.Set` with values passed through a `mapper` function. + +(mapper: (value: T, key: T, iter: this) => M, context?: unknown): Collection.Set`} +/> + + 10 * x)`} /> + +Note: `map()` always returns a new instance, even if it produced the same value at every step. + + + +Flat-maps the Collection, returning a Collection of the same type. + +Similar to `collection.map(...).flatten(true)`. + +(mapper: (value: T, key: T, iter: this) => Iterable, context?: unknown): Collection.Set`} +/> + + + +Returns a new Collection with only the values for which the `predicate` function returns true. + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + boolean, context?: unknown): Collection.Set`} +/> + + + +Returns a new Collection with only the values for which the `predicate` function returns false. + + boolean, context?: unknown): Collection.Set`} +/> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Collection with the values for which the `predicate` function returns false and another for which is returns true. + + boolean, context?: C): [Collection.Set, Collection.Set]`} +/> + + + +Returns a Collection of the same type which includes the same entries, stably sorted by using a `comparator`. + +): this`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +When sorting collections which have no defined order, their ordered equivalents will be returned. e.g. `map.sort()` returns OrderedMap. + + { + if (a < b) { return -1; } + if (a > b) { return 1; } + if (a === b) { return 0; } + });`} +/> + +Note: `sort()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: Comparator): this`} +/> + + person.age)`} +/> + +Note: `sortBy()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a new Set with the order of the values reversed. + +`} /> + + + +Returns a `Map` of `Set`, grouped by the return value of the `grouper` function. + +(grouper: (value: T, key: T, iter: this) => G, context?: unknown): Map>`} +/> + +Note: This is not a lazy operation. + +## Conversion to JavaScript types + + + +Deeply converts this Set to equivalent native JavaScript Array. + +>`} /> + + + +Shallowly converts this Set to equivalent native JavaScript Array. + +`} /> + + + +Shallowly converts this collection to an Array. + +`} /> + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Seq + + + +Returns itself. + +`} /> + + + +Returns a Seq.Keyed from this Collection where indices are treated as keys. + +This is useful if you want to operate on a Collection and preserve the [value, value] pairs. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a Seq.Set of the values of this Collection, discarding keys. + +`} /> + +## Value equality + + + +True if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + + + + + +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading values + + + +Returns the value associated with the provided key, or notSetValue if the Collection does not contain this key. + +Note: it is possible a key may be associated with an `undefined` value, so if `notSetValue` is not provided and this method returns `undefined`, that does not guarantee the key was not found. + +(key: T, notSetValue: NSV): T | NSV +get(key: T): T | undefined`} +/> + + + +True if a key exists within this Collection, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +Returns the first value in this Collection. + +(notSetValue: NSV): T | NSV +first(): T | undefined`} +/> + + + +Returns the last value in this Collection. + +(notSetValue: NSV): T | NSV +last(): T | undefined`} +/> + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean`} /> + +## Persistent changes + + + +This can be very useful as a way to "chain" a normal function into a sequence of methods. RxJS calls this "let" and lodash calls it "thru". + + + +For example, to sum a Seq after mapping and filtering: + + sum + x, 0) + } + + Collection.Set([ 1, 2, 3 ]) + .map(x => x + 1) + .filter(x => x % 2 === 0) + .update(sum)`} +/> + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Returns itself. + +`} /> + + + +Converts this Collection to a Set, maintaining the order of iteration. + +`} /> + +Note: This is equivalent to `OrderedSet(this)`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List. + +`} /> + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Iterators + + + +An iterator of this `Set`'s keys. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `keySeq` instead, if this is what you want. + + + +An iterator of this `Set`'s values. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `valueSeq` instead, if this is what you want. + + + +An iterator of this `Set`'s entries as `[value, value]` tuples. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `entrySeq` instead, if this is what you want. + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, discarding values. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a new Seq.Indexed of [value, value] tuples. + +`} /> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Collection. + + unknown, context?: unknown): number`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned false). + +## Creating subsets + + + +Returns a new Set of the same type representing a portion of this Set from start up to but not including end. + +`} /> + +If begin is negative, it is offset from the end of the Collection. e.g. `slice(-2)` returns a Collection of the last two entries. If it is not provided the new Collection will begin at the beginning of this Collection. + +If end is negative, it is offset from the end of the Collection. e.g. `slice(0, -1)` returns a Collection of everything but the last entry. If it is not provided, the new Collection will continue through the end of this Collection. + +If the requested slice is equivalent to the current Collection, then it will return itself. + + + +Returns a new Collection of the same type containing all entries except the first. + +`} /> + + + +Returns a new Collection of the same type containing all entries except the last. + +`} /> + + + +Returns a new Collection of the same type which excludes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which excludes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): Set`} +/> + + x.match(/g/))`} +/> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): Set`} +/> + + x.match(/hat/))`} +/> + + + +Returns a new Collection of the same type which includes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns true. + + boolean, context?: unknown): Set`} +/> + + x.match(/o/))`} +/> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns false. + + boolean, context?: unknown): Set`} +/> + + x.match(/at/))`} +/> + +## Combination + + + +Returns a new Set with other collections concatenated to this one. + +(...valuesOrCollections: Array | C>): Set`} +/> + + + +Flattens nested Collections. + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only others Collection, not Arrays or Objects. + + + + + +Flat-maps the Set, returning a new Set. + +Similar to `set.map(...).flatten(true)`. + +(mapper: (value: T, key: T, iter: this) => Iterable, context?: unknown): Set`} +/> + +## Reducing a value + + + +Reduces the Iterable to a value by calling the `reducer` for every entry in the Iterable and passing along the reduced value. + +(reducer: (reduced: R, value: T, key: T, iter: this) => R, initialValue: R): R`} +/> + +If initialValue is not provided, the first entry in the Iterable will be used as the initial value. + + + +Reduces the Iterable to a value by calling the `reducer` for every entry in the Iterable and passing along the reduced value. + +(reducer: (reduced: R, value: T, key: T, iter: this) => R, initialValue: R): R`} +/> + +Note: Similar to this.reverse().reduce(), and provided for parity with `Array#reduceRight`. + + + +Returns true if the `predicate` returns true for every entry in the Iterable. + + boolean, context?: unknown): boolean`} +/> + + + +Returns true if the `predicate` returns true for any entry in the Iterable. + + boolean, context?: unknown): boolean`} +/> + + + +Returns a string of all the entries in the Iterable, separated by `separator`. + + + + + +Returns true if the Iterable is empty. + + + + + +Returns the number of entries in the Iterable. + + + + + +Returns a Map of the number of occurrences of each value in the Iterable. + +(grouper: (value: T, key: T, iter: this) => G, context?: unknown): Map`} +/> + +## Search for value + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): T | undefined`} +/> + + + +Returns the last value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): T | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first [value, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): [T, T] | undefined`} +/> + + + +Returns the last [value, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): [T, T] | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first key for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined`} +/> + + + +Returns the last key for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined`} /> + +The comparator is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: Comparator): T | undefined`} +/> + + person.age)`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined`} /> + +The comparator is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: Comparator): T | undefined`} +/> + + person.age)`} +/> + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean`} /> diff --git a/website/docs/Collection.mdx b/website/docs/Collection.mdx new file mode 100644 index 0000000000..1611904da8 --- /dev/null +++ b/website/docs/Collection.mdx @@ -0,0 +1,817 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Collection + +The `Collection` is a set of (key, value) entries which can be iterated, and is the base class for all collections in `immutable`, allowing them to make use of all the Collection methods (such as and ). + +Note: A collection is always iterated in the same order, however that order may not always be well defined, as is the case for the and . + +Collection is the abstract base class for concrete data structures. It cannot be constructed directly. + +Implementations should extend one of the subclasses, , , or . + +## Construction + + + +Creates a Collection. + +The type of Collection created is based on the input. + +- If an `Collection`, that same `Collection`. +- If an Array-like, an `Collection.Indexed`. +- If an Object with an Iterator defined, an `Collection.Indexed`. +- If an Object, an `Collection.Keyed`. + +This methods forces the conversion of Objects and Strings to Collections. +If you want to ensure that a Collection of one item is returned, use +`Seq.of`. + +Note: An Iterator itself will be treated as an object, becoming a `Seq.Keyed`, +which is usually not what you want. You should turn your Iterator Object into +an iterable object by defining a `Symbol.iterator` (or `@@iterator`) method which +returns `this`. + +Note: `Collection` is a conversion function and not a class, and does not +use the `new` keyword during construction. + +(collection: Iterable | ArrayLike): Collection.Indexed; +function Collection(obj: { [key: string]: V; }): Collection.Keyed; +function Collection(): Collection; +`} +/> + +## Value equality + + + +True if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + + + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + +```js +const a = List([1, 2, 3]); +const b = List([1, 2, 3]); +assert.notStrictEqual(a, b); // different instances +const set = Set([a]); +assert.equal(set.has(b), true); +``` + +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading values + + + +Returns the value associated with the provided key, or notSetValue if the Collection does not contain this key. + +(key: K, notSetValue: NSV): V | NSV;`} /> + + +Note: it is possible a key may be associated with an `undefined` value, so if `notSetValue` is not provided and this method returns `undefined`, that does not guarantee the key was not found. + + + +True if a key exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +In case the `Collection` is not empty returns the first element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): V | NSV;`} /> + + + + +In case the `Collection` is not empty returns the last element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): V | NSV;`} /> + + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown;`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean;`} /> + +## Persistent changes + + + +This can be very useful as a way to "chain" a normal function into a sequence of methods. RxJS calls this "let" and lodash calls it "thru". + +(updater: (value: this) => R): R;`} /> + +For example, to sum a Seq after mapping and filtering: + + sum + x, 0); +} + +Seq([1, 2, 3]) +.map((x) => x + 1) +.filter((x) => x % 2 === 0) +.update(sum); +`} /> + +## Conversion to JavaScript types + + + +Deeply converts this Collection to equivalent native JavaScript Array or Object. + +> | { [key in PropertyKey]: DeepCopy };`} +/> + +`Collection.Indexed`, and `Collection.Set` become `Array`, while `Collection.Keyed` become `Object`, converting keys to Strings. + + + +Shallowly converts this Collection to equivalent native JavaScript Array or Object. + + | { [key in PropertyKey]: V };`} /> + +`Collection.Indexed`, and `Collection.Set` become `Array`, while `Collection.Keyed` become `Object`, converting keys to Strings. + + + +Shallowly converts this collection to an Array. + + | Array<[K, V]>;`} /> + +`Collection.Indexed`, and `Collection.Set` produce an Array of values. `Collection.Keyed` produce an Array of [key, value] tuples. + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +;`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +;`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Set, discarding keys. Throws if values are not hashable. + +;`} /> + +Note: This is equivalent to `Set(this)`, but provided to allow for chained expressions. + + + +Converts this Collection to a Set, maintaining the order of iteration and discarding keys. + +;`} /> + +Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List, discarding keys. + +;`} /> + +This is similar to `List(collection)`, but provided to allow for chained expressions. However, when called on `Map` or other keyed collections, `collection.toList()` discards the keys and creates a list of only the values, whereas `List(collection)` creates a list of entry tuples. + + + + + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +;`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Conversion to Seq + + + +Converts this Collection to a Seq of the same kind (indexed, keyed, or set). + +;`} /> + + + +Returns a Seq.Keyed from this Collection where indices are treated as keys. + +;`} /> + +This is useful if you want to operate on an Collection.Indexed and preserve the [index, value] pairs. + +The returned Seq will have identical iteration order as this Collection. + + v === 'B'); +// Seq [ "B" ] +const keyedSeq = indexedSeq.toKeyedSeq(); +// Seq { 0: "A", 1: "B", 2: "C" } +keyedSeq.filter((v) => v === 'B');`} +/> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +;`} /> + + + +Returns a Seq.Set of the values of this Collection, discarding keys. + +;`} /> + +## Iterators + + + +An iterator of this `Collection`'s keys. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `keySeq` instead, if this is what you want. + + + +An iterator of this `Collection`'s values. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `valueSeq` instead, if this is what you want. + + + +An iterator of this `Collection`'s entries as `[ key, value ]` tuples. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `entrySeq` instead, if this is what you want. + + + +;`} /> + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, discarding values. + +;`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +;`} /> + + + +Returns a new Seq.Indexed of [key, value] tuples. + +;`} /> + +## Sequence algorithms + + + +Returns a new Collection of the same type with values passed through a `mapper` function. + +(mapper: (value: V, key: K, iter: this) => M, context?: unknown): Collection;`} +/> + +Note: `map()` always returns a new instance, even if it produced the same value at every step. + + + +Returns a new Collection of the same type with only the entries for which the `predicate` function returns true. + +(predicate: (value: V, key: K, iter: this) => value is F, context?: unknown): Collection;`} +/> + unknown, context?: unknown): this;`} +/> + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Collection of the same type with only the entries for which the `predicate` function returns false. + + boolean, context?: unknown): this;`} +/> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Collection with the values for which the `predicate` function returns false and another for which is returns true. + +(predicate: (this: C, value: V, key: K, iter: this) => value is F, context?: C): [Collection, Collection];`} +/> +(predicate: (this: C, value: V, key: K, iter: this) => unknown, context?: C): [this, this];`} +/> + + + +Returns a new Collection of the same type in reverse order. + + + + + +Returns a new Collection of the same type which includes the same entries, stably sorted by using a `comparator`. + +): this;`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +When sorting collections which have no defined order, their ordered equivalents will be returned. e.g. `map.sort()` returns OrderedMap. + + { + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + if (a === b) { + return 0; + } +});`} +/> + +Note: `sort()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means. + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: Comparator): this;`} +/> + + member.name);`} +/> + +Note: `sortBy()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a `Map` of `Collection`, grouped by the return value of the `grouper` function. + +(grouper: (value: V, key: K, iter: this) => G, context?: unknown): Map;`} +/> + +Note: This is always an eager operation. + + x.get('v'));`} +/> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Collection. + + unknown, context?: unknown): number;`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned false). + +## Creating subsets + + + +Returns a new Collection of the same type representing a portion of this Collection from start up to but not including end. + + + +If begin is negative, it is offset from the end of the Collection. e.g. `slice(-2)` returns a Collection of the last two entries. If it is not provided the new Collection will begin at the beginning of this Collection. + +If end is negative, it is offset from the end of the Collection. e.g. `slice(0, -1)` returns a Collection of everything but the last entry. If it is not provided, the new Collection will continue through the end of this Collection. + +If the requested slice is equivalent to the current Collection, then it will return itself. + + + +Returns a new Collection of the same type containing all entries except the first. + + + + + +Returns a new Collection of the same type containing all entries except the last. + + + + + +Returns a new Collection of the same type which excludes the first `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which excludes the last `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection of the same type which includes the first `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes the last `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns false. + + boolean, context?: unknown): this;`} +/> + +## Combination + + + +Returns a new Collection of the same type with other values and collection-like concatenated to this one. + +): Collection;`} +/> + +For Seqs, all entries will be present in the resulting Seq, even if they have the same key. + + + +Flattens nested Collections. + +;`} /> +;`} /> + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only others Collection, not Arrays or Objects. + +Note: `flatten(true)` operates on `Collection>` and returns `Collection` + + + +Flat-maps the Collection, returning a Collection of the same type. + +(mapper: (value: V, key: K, iter: this) => Iterable, context?: unknown): Collection;`} +/> +(mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: unknown): Collection;`} +/> + + + +Reduces the Collection to a value by calling the `reducer` for every entry in the Collection and passing along the reduced value. + +(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: unknown): R;`} +/> +(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R;`} +/> + + + +Reduces the Collection in reverse (from the right side). + +(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: unknown): R;`} +/> +(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R;`} +/> + + + +True if `predicate` returns true for all entries in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +True if `predicate` returns true for any entry in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +Joins values together as a string, inserting a separator between each. The default separator is `","`. + + + + + +Returns true if this Collection includes no values. + + + +For some lazy `Seq`, `isEmpty` might need to iterate to determine emptiness. At most one iteration will occur. + + + +Returns the size of this Collection. + + + boolean, context?: unknown): number;`} +/> + +Regardless of if this Collection can describe its size lazily (some Seqs cannot), this method will always return the correct size. E.g. it evaluates a lazy `Seq` if necessary. + +If `predicate` is provided, then this returns the count of entries in the Collection for which the `predicate` returns true. + + + +Returns a `Seq.Keyed` of counts, grouped by the return value of the `grouper` function. + +(grouper: (value: V, key: K, iter: this) => G, context?: unknown): Map;`} +/> + +Note: This is not a lazy operation. + +## Search for value + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: V): V | undefined;`} +/> + + + +Returns the last value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: V): V | undefined;`} +/> + + + +Returns the first [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: V): [K, V] | undefined;`} +/> + + + +Returns the last [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: V): [K, V] | undefined;`} +/> + + + +Returns the key for which the `predicate` returns true. + + boolean, context?: unknown): K | undefined;`} +/> + + + +Returns the last key for which the `predicate` returns true. + + boolean, context?: unknown): K | undefined;`} +/> + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): V | undefined;`} /> + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: Comparator): V | undefined;`} +/> + + i.avgHit);`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): V | undefined;`} /> + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: Comparator): V | undefined;`} +/> + + i.avgHit); // will output { name: 'Bob', avgHit: 1 }`} +/> + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean;`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean;`} /> diff --git a/website/docs/Intro.mdx b/website/docs/Intro.mdx new file mode 100644 index 0000000000..3e2022aeef --- /dev/null +++ b/website/docs/Intro.mdx @@ -0,0 +1,90 @@ +Immutable data encourages pure functions (data-in, data-out) and lends itself +to much simpler application development and enabling techniques from +functional programming such as lazy evaluation. + +While designed to bring these powerful functional concepts to JavaScript, it +presents an Object-Oriented API familiar to Javascript engineers and closely +mirroring that of Array, Map, and Set. It is easy and efficient to convert to +and from plain Javascript types. + +## How to read these docs + +In order to better explain what kinds of values the Immutable.js API expects +and produces, this documentation is presented in a statically typed dialect of +JavaScript (like [Flow][] or [TypeScript][]). You _don't need_ to use these +type checking tools in order to use Immutable.js, however becoming familiar +with their syntax will help you get a deeper understanding of this API. + +**A few examples and how to read them.** + +All methods describe the kinds of data they accept and the kinds of data +they return. For example a function which accepts two numbers and returns +a number would look like this: + +```js +sum(first: number, second: number): number +``` + +Sometimes, methods can accept different kinds of data or return different +kinds of data, and this is described with a _type variable_, which is +typically in all-caps. For example, a function which always returns the same +kind of data it was provided would look like this: + +```js +identity(value: T): T +``` + +Type variables are defined with classes and referred to in methods. For +example, a class that holds onto a value for you might look like this: + +```js +class Box { +constructor(value: T) +getValue(): T +} +``` + +In order to manipulate Immutable data, methods that we're used to affecting +a Collection instead return a new Collection of the same type. The type +`this` refers to the same kind of class. For example, a List which returns +new Lists when you `push` a value onto it might look like: + +```js +class List { +push(value: T): this +} +``` + +Many methods in Immutable.js accept values which implement the JavaScript +[Iterable][] protocol, and might appear like `Iterable` for something +which represents sequence of strings. Typically in JavaScript we use plain +Arrays (`[]`) when an Iterable is expected, but also all of the Immutable.js +collections are iterable themselves! + +For example, to get a value deep within a structure of data, we might use +`getIn` which expects an `Iterable` path: + +``` +getIn(path: Iterable): unknown +``` + +To use this method, we could pass an array: `data.getIn([ "key", 2 ])`. + +Note: All examples are presented in the modern [ES2015][] version of +JavaScript. Use tools like Babel to support older browsers. + +For example: + +```js +// ES2015 +const mappedFoo = foo.map((x) => x * x); +// ES5 +var mappedFoo = foo.map(function (x) { + return x * x; +}); +``` + +[ES2015]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla +[TypeScript]: https://www.typescriptlang.org/ +[Flow]: https://flowtype.org/ +[Iterable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols diff --git a/website/docs/List.mdx b/website/docs/List.mdx new file mode 100644 index 0000000000..2f24247008 --- /dev/null +++ b/website/docs/List.mdx @@ -0,0 +1,1277 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# List + +Lists are ordered indexed dense collections, much like a JavaScript Array. + + extends Collection.Indexed`} /> + +Lists are immutable and fully persistent with O(log32 N) gets and sets, and O(1) push and pop. + +Lists implement Deque, with efficient addition and removal from both the end (, ) and beginning (, ). + +Unlike a JavaScript Array, there is no distinction between an "unset" index and an index set to undefined. List#forEach visits all indices from 0 to size, regardless of whether they were explicitly defined. + +## Construction + + + +Create a new immutable List containing the values of the provided collection-like. + +(collection?: Iterable | ArrayLike): List`} /> + +Note: is a factory function and not a class, and does not use the `new` keyword during construction. + + + + + + + + + +## Static methods + + + + + + + +(...values: Array): List`} /> + +## Members + + + +The number of items in this List. + + + +## Persistent changes + + + +Returns a new List which includes `value` at `index`. If `index` already exists in this List, it will be replaced. + +`} /> + +`index` may be a negative number, which indexes back from the end of the List. `v.set(-1, "value")` sets the last item in the List. + +If `index` larger than , the returned List's will be large enough to include the index. + + + +Note: `set` can be used in withMutations. + + + +Returns a new List which excludes this `index` and with a size 1 less than this List. Values at indices above `index` are shifted down by 1 to fill the position. + +This is synonymous with `list.splice(index, 1)`. + +`} /> + +`index` may be a negative number, which indexes back from the end of the List. `v.delete(-1)` deletes the last item in the List. + +Note: `delete` cannot be safely used in IE8. + + + +Since `delete()` re-indexes values, it produces a complete copy, which has `O(N)` complexity. + +Note: `delete` _cannot_ be used in withMutations. + + + +Returns a new List with `value` at `index` with a size 1 more than this List. Values at indices above `index` are shifted over by 1. + +`} /> + +This is synonymous with `list.splice(index, 0, value)`. + + + +Since `insert()` re-indexes values, it produces a complete copy, which has `O(N)` complexity. + +Note: `insert` _cannot_ be used in withMutations. + + + +Returns a new List with 0 size and no values in constant time. + +`} /> + + + +Note: `clear` can be used in withMutations. + + + +Returns a new List with the provided `values` appended, starting at this List's `size`. + +): List`} /> + + + +Note: `push` can be used in withMutations. + + + +Returns a new List with a size one less than this List, excluding the last index in this List. + +`} /> + +Note: this differs from `Array#pop` because it returns a new List rather than the removed value. Use `last()` to get the last value +in this List. + + + +Note: `pop` can be used in withMutations. + + + +Returns a new List with the provided `values` prepended, shifting other values ahead to higher indices. + +): List`} /> + + + +Note: `unshift` can be used in withMutations. + + + +Returns a new List with a size one less than this List, excluding the first index in this List, shifting all other values to a lower index. + +`} /> + +Note: this differs from `Array#shift` because it returns a new List rather than the removed value. Use `first()` to get the first value in this List. + + + +Note: `shift` can be used in withMutations. + + + +Returns a new List with an updated value at `index` with the return value of calling `updater` with the existing value, or `notSetValue` if `index` was not set. If called with a single argument, `updater` is called with the List itself. + + T): List +update(index: number, updater: (value: T | undefined) => T | undefined): List +update(updater: (value: this) => R): R`} +/> + +`index` may be a negative number, which indexes back from the end of the List. `v.update(-1)` updates the last item in the List. + + val.toUpperCase()) +// List [ "a", "b", "C" ]`} +/> + +This can be very useful as a way to "chain" a normal function into a sequence of methods. RxJS calls this "let" and lodash calls it "thru". + +For example, to sum a List after mapping and filtering: + + sum + x, 0) +} + +List([ 1, 2, 3 ]) +.map(x => x + 1) +.filter(x => x % 2 === 0) +.update(sum)`} +/> + +Note: `update(index)` can be used in withMutations. + + + +Returns a new List with size `size`. If `size` is less than this List's size, the new List will exclude values at the higher indices. If `size` is greater than this List's size, the new List will have undefined values for the newly available indices. + +`} /> + +When building a new List and the final size is known up front, `setSize` used in conjunction with withMutations may result in the more performant construction. + +## Deep persistent changes + + + +Returns a new List having set `value` at this `keyPath`. If any keys in `keyPath` do not exist, a new immutable Map will be created at that key. + +, value: unknown): List`} +/> + +Index numbers are used as keys to determine the path to follow in the List. + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and setIn() can update those values as well, treating them immutably by creating new copies of those values with the changes applied. + + + +Note: `setIn` can be used in withMutations. + + + +Returns a new List having removed the value at this `keyPath`. If any keys in `keyPath` do not exist, no change will occur. + +): List`} /> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and `removeIn()` can update those values as well, treating them immutably by creating new copies of those values with the changes applied. + + + +Note: `deleteIn` _cannot_ be safely used in withMutations. + + + +, notSetValue: unknown, updater: (value: unknown) => unknown): this +updateIn(keyPath: Iterable, updater: (value: unknown) => unknown): this`} +/> + +Note: `updateIn` can be used in withMutations. + + + +, ...collections: Array): this`} +/> + +Note: `mergeIn` can be used in withMutations. + + + +, ...collections: Array): this`} +/> + +Note: `mergeDeepIn` can be used in withMutations. + +## Transient changes + + + +Note: Not all methods can be safely used on a mutable collection or within `withMutations`! Check the documentation for each method to see if it allows being used in `withMutations`. + + unknown): List`} +/> + + + +An alternative API for withMutations() + +Note: Not all methods can be safely used on a mutable collection or within `withMutations`! Check the documentation for each method to see if it allows being used in `withMutations`. + +`} /> + + + + + + + + + + + + + + + +## Sequence algorithms + + + +Returns a new List with other values or collections concatenated to this one. + +(...valuesOrCollections: Array | C>): List`} +/> + +Note: `concat` can be used in withMutations. + + + +Returns a new List with values passed through a `mapper` function. + +(mapper: (value: T, key: number, iter: this) => M, context?: unknown): List`} +/> + + 10 * x)`} /> + + + +Returns a new List with values passed through a `mapper` function. + +(mapper: (value: T, key: number, iter: this) => M, context?: unknown): List`} +/> + + + + + +Returns a new List with values passed through a `mapper` function. + +(mapper: (entry: [K, V], index: number, iter: this) => [KM, VM] | undefined, context?: unknown): List<[KM, VM]>`} +/> + + + +Flat-maps the List, returning a new List. + +Similar to `list.map(...).flatten(true)`. + +(mapper: (value: T, key: number, iter: this) => Iterable, context?: unknown): List`} +/> + + + +Returns a new List with only the values for which the `predicate` function returns true. + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + +(predicate: (value: T, index: number, iter: this) => value is F, context?: unknown): List`} +/> + + + +Returns a new List with the values for which the `predicate` function returns false and another for which is returns true. + +(predicate: (this: C, value: T, index: number, iter: this) => value is F, context?: C): [List, List]`} +/> + + + +Returns a List "zipped" with the provided collection. + +Like `zipWith`, but using the default `zipper`: creating an `Array`. + +(other: Collection): List<[T, U]> +zip(other: Collection, other2: Collection): List<[T, U, V]>`} +/> + + + + + +Returns a List "zipped" with the provided collections. + +Unlike `zip`, `zipAll` continues zipping until the longest collection is exhausted. Missing values from shorter collections are filled with `undefined`. + +(other: Collection): List<[T, U]> +zipAll(other: Collection, other2: Collection): List<[T, U, V]>`} +/> + + + +Note: Since zipAll will return a collection as large as the largest input, some results may contain undefined values. +TypeScript cannot account for these without cases (as of v2.5). + + + +Returns a List "zipped" with the provided collections by using a custom `zipper` function. + +(zipper: (value: T, otherValue: U) => Z, otherCollection: Collection): List +zipWith(zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection): List +zipWith(zipper: (...values: Array) => Z, ...collections: Array>): List`} +/> + + a + b, b);`} +/> + + + +Returns a new List with its values shuffled thanks to the [Fisher–Yates](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) algorithm. +It uses Math.random, but you can provide your own random number generator. + + number): this`} /> + + + +Returns a new List with only the values for which the `predicate` function returns false. + + boolean, context?: unknown): this`} +/> + + x % 2 === 0);`} /> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new List with the order of the values reversed. + +`} /> + + + + + +Returns List of the same type which includes the same entries, stably sorted by using a comparator. + + number): List`} /> + + b - a);`} /> + +If a comparator is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +When sorting collections which have no defined order, their ordered equivalents will be returned. e.g. `map.sort()` returns `OrderedMap`. + +Note: `sort()` always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means: + + C, comparator?: (a, b) => number): List`} +/> + + person.age);`} +/> + +Note: `sortBy()` always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a `Map` of `List` grouped by the return value of the `grouper` function. + +(grouper: (value: T, index: number, iter: this) => G, context?: unknown): Map>`} +/> + +Note: This is not a lazy operation. + + x.get('v'))`} +/> + +## Conversion to JavaScript types + + + +Deeply converts this List to a JavaScript Array. + +>`} /> + + + +Shallowly converts this Indexed collection to equivalent native JavaScript Array. + +`} /> + + + +Shallowly converts this collection to an Array. + +`} /> + + + +Shallowly converts this List to a JavaScript Object. + + + +Convert keys to strings. + +## Reading values + + + +Returns the value at `index`. + + + + + + + +True if a key exists within this Collection, using Immutable.is to determine equality + + + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + + + +Returns the first value in this collection. + + + + + + + +Returns the last value in this collection. + + + + + +## Conversion to Seq + + + +Converts this List to a Seq of the same kind (indexed). + +`} /> + + + +If this is a collection of [key, value] entry tuples, it will return a Seq.Keyed of those entries. + +`} /> + + + +Returns a Seq.Keyed from this List where indices are treated as keys. + +This is useful if you want to operate on a List and preserve the [index, value] pairs. + +The returned Seq will have identical iteration order as this List. + +`} /> + + v === 'B') +// Seq [ "B" ] +const keyedSeq = indexedSeq.toKeyedSeq() +// Seq { 0: "A", 1: "B", 2: "C" } +keyedSeq.filter(v => v === 'B') +// Seq { 1: "B" }`} +/> + + + +Returns a Seq.Indexed of the values of this List, discarding keys. + +`} /> + + + +Returns a Seq.Set of the values of this List, discarding keys. + +`} /> + +## Combination + + + +Returns a new List with the separator inserted between each value in this List. + +`} /> + + + + + +Returns a new List with the values from each collection interleaved. + +>): List`} +/> + +The resulting Collection includes the first item from each, then the second from each, etc. + + + +The shortest Collection stops interleave. + + + +Since `interleave()` re-indexes values, it produces a complete copy, which has `O(N)` complexity. + +Note: `interleave()` _cannot_ be used in withMutations. + + + +Returns a new List by replacing a region of this List with new values. If values are not provided, it only skips the region to be removed. + +`index` may be a negative number, which indexes back from the end of the List. `s.splice(-2)` splices after the second to last item. + +): List`} +/> + + + +Since `splice()` re-indexes values, it produces a complete copy, which has `O(N)` complexity. + +Note: `splice` _cannot_ be used in withMutations. + + + +Returns a new flattened List, optionally only flattening to a particular depth. + + +flatten(shallow?: boolean): List`} +/> + + + +## Search for value + + + +Returns the first index at which a given value can be found in the Collection, or -1 if it is not present. + + + + + + + +Returns the last index at which a given value can be found in the Collection, or -1 if it is not present. + + + + + + + +Returns the first index in the Collection where a value satisfies the provided predicate function. Otherwise -1 is returned. + + boolean, context?: unknown): number`} +/> + + x % 2 === 0)`} /> + + + +Returns the last index in the Collection where a value satisfies the provided predicate function. Otherwise -1 is returned. + + boolean, context?: unknown): number`} +/> + + x % 2 === 0)`} +/> + + + +Returns the first value for which the `predicate` function returns true. + + boolean, context?: unknown): T | undefined`} +/> + + x % 2 === 0)`} /> + + + +Returns the last value for which the `predicate` function returns true. + + boolean, context?: unknown): T | undefined`} +/> + + x % 2 === 0)`} /> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first `[key, value]` entry for which the `predicate` function returns true. + + boolean, context?: unknown): [number, T] | undefined`} +/> + + x % 2 === 0)`} /> + + + +Returns the last `[key, value]` entry for which the `predicate` function returns true. + + boolean, context?: unknown): [number, T] | undefined`} +/> + + x % 2 === 0)`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first key for which the `predicate` function returns true. + + boolean, context?: unknown): number | undefined`} +/> + + x % 2 === 0)`} /> + + + +Returns the last key for which the `predicate` function returns true. + + boolean, context?: unknown): number | undefined`} +/> + + x % 2 === 0)`} /> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + + + +Returns the last key associated with the search value, or undefined. + + + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + + number): T | undefined`} +/> + + + +The comparator is used in the same way as Collection#sort. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max()`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +( + comparatorValueMapper: (value: T, key: number, iter: this) => C, + comparator?: (valueA: C, valueB: C) => number +): T | undefined`} +/> + + person.age)`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + + number): T | undefined`} +/> + + + +The comparator is used in the same way as Collection#sort. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min()`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +( + comparatorValueMapper: (value: T, key: number, iter: this) => C, + comparator?: (valueA: C, valueB: C) => number +): T | undefined`} +/> + + person.age)`} +/> + +## Value equality + + + +True if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + + + + + +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean`} /> + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Set, discarding keys. Throws if values are not hashable. + +`} /> + +Note: This is equivalent to `Set(this)`, but provided to allow for chained expressions. + + + +Converts this Collection to a Set, maintaining the order of iteration and discarding keys. + +`} /> + +Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List, discarding keys. + +This is similar to `List(collection)`, but provided to allow for chained expressions. However, when called on `Map` or other keyed collections, `collection.toList()` discards the keys and creates a list of only the values, whereas `List(collection)` creates a list of entry tuples. + +`} /> + + + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Iterators + + + +An iterator of this `Collection`'s keys. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `keySeq` instead, if this is what you want. + + + +An iterator of this `Collection`'s values. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `valueSeq` instead, if this is what you want. + + + +An iterator of this `Collection`'s entries as `[ key, value ]` tuples. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `entrySeq` instead, if this is what you want. + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, discarding values. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a new Seq.Indexed of [key, value] tuples. + +`} /> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Collection. + + unknown, context?: unknown): number`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned false). + +## Creating subsets + + + +Returns a new Collection of the same type representing a portion of this Collection from start up to but not including end. + + + +If begin is negative, it is offset from the end of the Collection. e.g. `slice(-2)` returns a Collection of the last two entries. If it is not provided the new Collection will begin at the beginning of this Collection. + +If end is negative, it is offset from the end of the Collection. e.g. `slice(0, -1)` returns a Collection of everything but the last entry. If it is not provided, the new Collection will continue through the end of this Collection. + +If the requested slice is equivalent to the current Collection, then it will return itself. + + + +Returns a new Collection of the same type containing all entries except the first. + +`} /> + + + +Returns a new Collection of the same type containing all entries except the last. + +`} /> + + + +Returns a new Collection of the same type which excludes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which excludes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): List`} +/> + + x.match(/g/))`} +/> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): this`} +/> + + x.match(/hat/))`} +/> + + + +Returns a new Collection of the same type which includes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns true. + + boolean, context?: unknown): List`} +/> + + x.match(/o/))`} +/> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns false. + + boolean, context?: unknown): List`} +/> + + x.match(/at/))`} +/> + +## Reducing a value + + + +Reduces the Collection to a value by calling the `reducer` for every entry in the Collection and passing along the reduced value. + +(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: unknown): R +reduce(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R`} +/> + +If `initialReduction` is not provided, the first item in the Collection will be used. + + + +Reduces the Collection in reverse (from the right side). + +(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: unknown): R +reduceRight(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R`} +/> + +Note: Similar to this.reverse().reduce(), and provided for parity with `Array#reduceRight`. + + + +True if `predicate` returns true for all entries in the Collection. + + boolean, context?: unknown): boolean`} +/> + + + +True if `predicate` returns true for any entry in the Collection. + + boolean, context?: unknown): boolean`} +/> + + + +Joins values together as a string, inserting a separator between each. The default separator is `","`. + + + + + +Returns true if this Collection includes no values. + + + +For some lazy `Seq`, `isEmpty` might need to iterate to determine emptiness. At most one iteration will occur. + + + +Returns the size of this Collection. + + boolean, context?: unknown): number`} +/> + +Regardless of if this Collection can describe its size lazily (some Seqs cannot), this method will always return the correct size. E.g. it evaluates a lazy `Seq` if necessary. + +If `predicate` is provided, then this returns the count of entries in the Collection for which the `predicate` returns true. + + + +Returns a `Seq.Keyed` of counts, grouped by the return value of the `grouper` function. + +(grouper: (value: V, key: K, iter: this) => G, context?: unknown): Map`} +/> + +Note: This is not a lazy operation. + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean`} /> diff --git a/website/docs/Map.mdx b/website/docs/Map.mdx new file mode 100644 index 0000000000..0c73b7fc8d --- /dev/null +++ b/website/docs/Map.mdx @@ -0,0 +1,1320 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Map + +Immutable Map is an unordered Collection.Keyed of (key, value) pairs with `O(log32 N)` gets and `O(log32 N)` persistent sets. + + extends Collection.Keyed`} /> + +Iteration order of a Map is undefined, however is stable. Multiple iterations of the same Map will iterate in the same order. + +Map's keys can be of any type, and use `Immutable.is` to determine key equality. This allows the use of any value (including NaN) as a key. + +Because `Immutable.is` returns equality based on value semantics, and Immutable collections are treated as values, any Immutable collection may be used as a key. + + + +Any JavaScript object may be used as a key, however strict identity is used to evaluate key equality. Two similar looking objects will represent two different keys. + +Implemented by a hash-array mapped trie. + +## Construction + + + +Create a new Immutable Map. + +(collection?: Iterable<[K, V]>): Map +Map(obj: { [key: PropertyKey]: V }): Map +`} +/> + +Created with the same key value pairs as the provided Collection.Keyed or JavaScript Object or expects a Collection of [K, V] tuple entries. + +Note: `Map` is a factory function and not a class, and does not use the `new` keyword during construction. + + + + + +Keep in mind, when using JS objects to construct Immutable Maps, that JavaScript Object properties are always strings, even if written in a quote-less shorthand, while Immutable Maps accept keys of any type. + +```js +let obj = { 1: 'one' }; +Object.keys(obj); // [ "1" ] +assert.equal(obj['1'], obj[1]); // "one" === "one" + +let map = Map(obj); +assert.notEqual(map.get('1'), map.get(1)); // "one" !== undefined +``` + +Property access for JavaScript Objects first converts the key to a string, but since Immutable Map keys can be of any type the argument to `get()` is not altered. + +## Static Methods + + + +True if the provided value is a Map. + +`} +/> + +## Members + + + +The number of entries in this Map. + + + +## Persistent changes + + + +Returns a new Map also containing the new key, value pair. If an equivalent key already exists in this Map, it will be replaced. + +`} /> + + + +Note: `set` can be used in `withMutations`. + + + +Returns a new Map which excludes this `key`. + +`} /> + +Note: `delete` cannot be safely used in IE8, but is provided to mirror the ES6 collection API. + + + +Note: `delete` can be used in `withMutations`. + + + +Returns a new Map which excludes the provided `keys`. + +): this`} /> + + + +Note: `deleteAll` can be used in `withMutations`. + + + +Returns a new Map containing no keys or values. + +`} /> + + + +Note: `clear` can be used in `withMutations`. + + + +Returns a new Map having updated the value at this `key` with the return value of calling `updater` with the existing value. + + V): Map +update(key: K, updater: (value: V | undefined) => V | undefined): Map +update(updater: (value: this) => R): R`} +/> + +Similar to: `map.set(key, updater(map.get(key)))`. + + value + value)`} +/> + +This is most commonly used to call methods on collections within a structure of data. For example, in order to `.push()` onto a nested `List`, `update` and `push` can be used together: + + list.push(4))`} +/> + +When a `notSetValue` is provided, it is provided to the `updater` function when the value at the key does not exist in the Map. + + value + value)`} +/> + +However, if the `updater` function returns the same value it was called with, then no change will occur. This is still true if `notSetValue` is provided. + + val) +// Map { "apples": 10 } +assert.strictEqual(newMap, aMap);`} +/> + +For code using ES2015 or later, using `notSetValue` is discouraged in favor of function parameter default values. This helps to avoid any potential confusion with identify functions as described above. + +The previous example behaves differently when written with default values: + + val)`} +/> + +If no key is provided, then the `updater` function return value is returned as well. + + aMap.get('key')) +// "value"`} +/> + +This can be very useful as a way to "chain" a normal function into a sequence of methods. RxJS calls this "let" and lodash calls it "thru". + +For example, to sum the values in a Map: + + sum + x, 0) +} + +Map({ x: 1, y: 2, z: 3 }) +.map(x => x + 1) +.filter(x => x % 2 === 0) +.update(sum)`} /> + +Note: `update(key)` can be used in `withMutations`. + + + +Returns a new Map resulting from merging the provided Collections (or JS objects) into this Map. In other words, this takes each entry of each collection and sets it on this Map. + +`} /> + +Note: Values provided to `merge` are shallowly converted before being merged. No nested values are altered. + + + +Note: `merge` can be used in `withMutations`. + + + +Like `merge()`, `mergeWith()` returns a new Map resulting from merging the provided Collections (or JS objects) into this Map, but uses the `merger` function for dealing with conflicts. + + unknown, ...collections): Map`} +/> + + oldVal / newVal, two) +// { "a": 0.2, "b": 0.5, "c": 30, "d": 60 } +two.mergeWith((oldVal, newVal) => oldVal / newVal, one) +// { "b": 2, "a": 5, "d": 60, "c": 30 }`} +/> + +Note: `mergeWith` can be used in `withMutations`. + + + +Like `merge()`, but when two compatible collections are encountered with the same key, it merges them as well, recursing deeply through the nested data. Two collections are considered to be compatible (and thus will be merged together) if they both fall into one of three categories: keyed (e.g., `Map`s, `Record`s, and objects), indexed (e.g., `List`s and arrays), or set-like (e.g., `Set`s). If they fall into separate categories, `mergeDeep` will replace the existing collection with the collection being merged in. This behavior can be customized by using `mergeDeepWith()`. + +`} /> + +Note: Indexed and set-like collections are merged using `concat()`/`union()` and therefore do not recurse. + + + +Note: `mergeDeep` can be used in `withMutations`. + + + +Like `mergeDeep()`, but when two non-collections or incompatible collections are encountered at the same key, it uses the `merger` function to determine the resulting value. Collections are considered incompatible if they fall into separate categories between keyed, indexed, and set-like. + + unknown, ...collections): Map`} +/> + + oldVal / newVal, two)`} +/> + +Note: `mergeDeepWith` can be used in `withMutations`. + +## Deep persistent changes + + + +Returns a new Map having set `value` at this `keyPath`. If any keys in `keyPath` do not exist, a new immutable Map will be created at that key. + +, value: unknown): Map`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and `setIn()` can update those values as well, treating them immutably by creating new copies of those values with the changes applied. + + + +If any key in the path exists but cannot be updated (such as a primitive like number or a custom Object like Date), an error will be thrown. + +Note: `setIn` can be used in `withMutations`. + + + +Returns a new Map having removed the value at this `keyPath`. If any keys in `keyPath` do not exist, no change will occur. + +): Map`} /> + +Note: `deleteIn` can be used in `withMutations`. + + + +Returns a new Map having applied the `updater` to the entry found at the keyPath. + +, notSetValue: unknown, updater: (value) => unknown): Map`} +/> + +This is most commonly used to call methods on collections nested within a structure of data. For example, in order to `.push()` onto a nested `List`, `updateIn` and `push` can be used together: + + list.push(4))`} +/> + +If any keys in `keyPath` do not exist, new Immutable `Map`s will be created at those keys. If the `keyPath` does not already contain a value, the `updater` function will be called with `notSetValue`, if provided, otherwise `undefined`. + + val * 2)`} +/> + +If the `updater` function returns the same value it was called with, then no change will occur. This is still true if `notSetValue` is provided. + + val) +// Map { "a": Map { "b": Map { "c": 10 } } } +assert.strictEqual(newMap, map)`} +/> + +For code using ES2015 or later, using `notSetValue` is discouraged in favor of function parameter default values. This helps to avoid any potential confusion with identify functions as described above. + +The previous example behaves differently when written with default values: + + val)`} +/> + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and updateIn() can update those values as well, treating them immutably by creating new copies of those values with the changes applied. + + val * 2)`} +/> + +If any key in the path exists but cannot be updated (such as a primitive like number or a custom Object like Date), an error will be thrown. + +Note: `updateIn` can be used in `withMutations`. + + + +A combination of `updateIn` and `merge`, returning a new Map, but performing the merge at a point arrived at by following the keyPath. In other words, these two lines are equivalent: + +```js +map.updateIn(['a', 'b', 'c'], (abc) => abc.merge(y)); +map.mergeIn(['a', 'b', 'c'], y); +``` + +, ...collections: Array): Map`} +/> + +Note: `mergeIn` can be used in `withMutations`. + + + +A combination of `updateIn` and `mergeDeep`, returning a new Map, but performing the deep merge at a point arrived at by following the keyPath. In other words, these two lines are equivalent: + +```js +map.updateIn(['a', 'b', 'c'], (abc) => abc.mergeDeep(y)); +map.mergeDeepIn(['a', 'b', 'c'], y); +``` + +, ...collections: Array): Map`} +/> + +Note: `mergeDeepIn` can be used in `withMutations`. + +## Transient changes + + + +Every time you call one of the above functions, a new immutable Map is created. If a pure function calls a number of these to produce a final return value, then a penalty on performance and memory has been paid by creating all of the intermediate immutable Maps. + +If you need to apply a series of mutations to produce a new immutable Map, `withMutations()` creates a temporary mutable copy of the Map which can apply mutations in a highly performant manner. In fact, this is exactly how complex mutations like `merge` are done. + + unknown): Map`} +/> + +As an example, this results in the creation of 2, not 4, new Maps: + + { + map.set('a', 1).set('b', 2).set('c', 3) +}) +assert.equal(map1.size, 0) +assert.equal(map2.size, 3)`} +/> + +Note: Not all methods can be used on a mutable collection or within `withMutations`! Read the documentation for each method to see if it is safe to use in `withMutations`. + + + +Another way to avoid creation of intermediate Immutable maps is to create a mutable copy of this collection. Mutable copies _always_ return `this`, and thus shouldn't be used for equality. Your function should never return a mutable copy of a collection, only use it internally to create a new collection. + + + +If possible, use `withMutations` to work with temporary mutable copies as it provides an easier to use API and considers many common optimizations. + +Note: if the collection is already mutable, `asMutable` returns itself. + +Note: Not all methods can be used on a mutable collection or within `withMutations`! Read the documentation for each method to see if it allows being used in `withMutations`. + + + +Returns true if this is a mutable copy (see `asMutable()`) and mutative alterations have been applied. + + + + + +The yin to `asMutable`'s yang. Because it applies to mutable collections, this operation is _mutable_ and may return itself (though may not return itself, i.e. if the result is an empty collection). Once performed, the original mutable copy must no longer be mutated since it may be the immutable result. + + + +If possible, use `withMutations` to work with temporary mutable copies as it provides an easier to use API and considers many common optimizations. + +## Sequence algorithms + + + +Returns a new Map with values passed through a `mapper` function. + +(mapper: (value: V, key: K, iter: this) => M, context?: unknown): Map`} +/> + + 10 * x)`} /> + + + +Returns a new Map with keys passed through a `mapper` function. + +(mapper: (key: K, value: V, iter: this) => M, context?: unknown): Map`} +/> + + x.toUpperCase())`} /> + + + +Returns a new Map with entries ([key, value] tuples) passed through a `mapper` function. + +(mapper: (entry: [K, V], index: number, iter: this) => [KM, VM] | undefined, context?: unknown): Map`} +/> + + [ k.toUpperCase(), v * 2 ])`} +/> + +Note: `mapEntries()` always returns a new instance, even if it produced the same entry at every step. + +If the mapper function returns `undefined`, then the entry will be filtered. + + + +Flat-maps the Map, returning a Map of the same type. + +Similar to `map(...).flatten(true)`. + +(mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: unknown): Map`} +/> + + + +Returns a new Map with only the entries for which the `predicate` function returns true. + + boolean, context?: unknown): Map`} +/> + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Map with only the entries for which the `predicate` function returns false. + + boolean, context?: unknown): this`} +/> + + x % 2 === 0)`} +/> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Map with the order of the entries reversed. + + + + + +Returns a new Map with the entries partitioned into two Maps based on the `predicate` function. + + boolean, context?: unknown): [Map, Map]`} +/> + + x % 2 === 0)`} +/> + + + +Returns a new Map with the keys and values flipped. + +`} /> + + + + + +Returns an OrderedMap of the same type which includes the same entries, stably sorted by using a `comparator`. + +): this & OrderedMap`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + + { + if (a < b) { return -1; } + if (a > b) { return 1; } + if (a === b) { return 0; } +});`} +/> + +Note: `sort()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means: + +( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: (valueA: C, valueB: C) => number +): OrderedMap`} +/> + + member.name);`} +/> + +Note: `sortBy()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a `Map` of `Collection`, grouped by the return value of the `grouper` function. + +( + grouper: (value: V, key: K, iter: this) => G, + context?: unknown + ): Map`} +/> + +Note: This is always an eager operation. + + x.get('v'))`} +/> + +## Conversion to JavaScript types + + + +Deeply converts this Keyed collection to equivalent native JavaScript Object. + +> | { [key in PropertyKey]: DeepCopy }`} +/> + +Converts keys to Strings. + + + +Shallowly converts this Keyed collection to equivalent native JavaScript Object. + + | { [key in PropertyKey]: V }`} /> + +Converts keys to Strings. + + + +Shallowly converts this collection to an Array. + + | Array<[K, V]>`} /> + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Seq + + + +Converts this Collection to a Seq of the same kind (indexed, keyed, or set). + +`} /> + + + +Returns a Seq.Keyed from this Collection where indices are treated as keys. + +This is useful if you want to operate on a Collection.Indexed and preserve the [index, value] pairs. + +The returned Seq will have identical iteration order as this Collection. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a Seq.Set of the values of this Collection, discarding keys. + +`} /> + +## Value equality + + + +True if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + + + + + +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading values + + + +Returns the value associated with the provided key. + + + + + + + +True if a key exists within this Collection, using Immutable.is to determine equality. + + + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + + + +Returns the first value in this collection. + + + + + + + +Returns the last value in this collection. + + + + + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean`} /> + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Set, discarding keys. Throws if values are not hashable. + +`} /> + +Note: This is equivalent to `Set(this)`, but provided to allow for chained expressions. + + + +Converts this Collection to a Set, maintaining the order of iteration and discarding keys. + +`} /> + +Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List, discarding keys. + +`} /> + +This is similar to `List(collection)`, but provided to allow for chained expressions. However, when called on `Map` or other keyed collections, `collection.toList()` discards the keys and creates a list of only the values, whereas `List(collection)` creates a list of entry tuples. + + + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Iterators + + + +An iterator of this `Collection`'s keys. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `keySeq` instead, if this is what you want. + + + +An iterator of this `Collection`'s values. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `valueSeq` instead, if this is what you want. + + + +An iterator of this `Collection`'s entries as `[ key, value ]` tuples. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `entrySeq` instead, if this is what you want. + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, discarding values. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a new Seq.Indexed of [key, value] tuples. + +`} /> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Collection. + + unknown, + context?: unknown + ): number`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned false). + +## Creating subsets + + + +Returns a new Collection of the same type representing a portion of this Collection from start up to but not including end. + +`} /> + +If begin is negative, it is offset from the end of the Collection. e.g. `slice(-2)` returns a Collection of the last two entries. If it is not provided the new Collection will begin at the beginning of this Collection. + +If end is negative, it is offset from the end of the Collection. e.g. `slice(0, -1)` returns a Collection of everything but the last entry. If it is not provided, the new Collection will continue through the end of this Collection. + +If the requested slice is equivalent to the current Collection, then it will return itself. + + + +Returns a new Collection of the same type containing all entries except the first. + +`} /> + + + +Returns a new Collection of the same type containing all entries except the last. + +`} /> + + + +Returns a new Collection of the same type which excludes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which excludes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): Map`} +/> + + x.match(/g/))`} +/> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): Map`} +/> + + x.match(/hat/))`} +/> + + + +Returns a new Collection of the same type which includes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns true. + + boolean, context?: unknown): Map`} +/> + + x.match(/o/))`} +/> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns false. + + boolean, context?: unknown): Map`} +/> + + x.match(/at/))`} +/> + +## Combination + + + +Returns a new flattened Map, optionally only flattening to a particular depth. + + +flatten(shallow?: boolean): Map`} +/> + + + +## Reducing a value + + + +Reduces the Collection to a value by calling the `reducer` for every entry in the Collection and passing along the reduced value. + +( + reducer: (reduction: R, value: V, key: K, iter: this) => R, + initialReduction?: R, + context?: unknown + ): R`} +/> + +If `initialReduction` is not provided, the first item in the Collection will be used. + + + +Reduces the Collection in reverse (from the right side). + +( + reducer: (reduction: R, value: V, key: K, iter: this) => R, + initialReduction?: R, + context?: unknown + ): R`} +/> + +Note: Similar to `this.reverse().reduce()`, and provided for parity with `Array#reduceRight`. + + + +True if `predicate` returns true for all entries in the Collection. + + boolean, + context?: unknown + ): boolean`} +/> + + + +True if `predicate` returns true for any entry in the Collection. + + boolean, + context?: unknown + ): boolean`} +/> + + + +Joins values together as a string, inserting a separator between each. The default separator is `","`. + + + + + +Returns true if this Collection includes no values. + + + +For some lazy `Seq`, `isEmpty` might need to iterate to determine emptiness. At most one iteration will occur. + + + +Returns the size of this Collection. + + boolean, context?: unknown): number`} +/> + +Regardless of if this Collection can describe its size lazily (some Seqs cannot), this method will always return the correct size. E.g. it evaluates a lazy `Seq` if necessary. + +If `predicate` is provided, then this returns the count of entries in the Collection for which the `predicate` returns true. + + + +Returns a `Seq.Keyed` of counts, grouped by the return value of the `grouper` function. + +( + grouper: (value: V, key: K, iter: this) => G, + context?: unknown + ): Map`} +/> + +Note: This is not a lazy operation. + +## Search for value + + + +Returns the first value for which the `predicate` function returns true. + + boolean, + context?: unknown + ): V | undefined`} +/> + + x % 2 === 0)`} /> + + + +Returns the last value for which the `predicate` function returns true. + + boolean, + context?: unknown + ): V | undefined`} +/> + + x % 2 === 0)`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first `[key, value]` entry for which the `predicate` function returns true. + + boolean, + context?: unknown + ): [K, V] | undefined`} +/> + + x % 2 === 0)`} +/> + + + +Returns the last `[key, value]` entry for which the `predicate` function returns true. + + boolean, + context?: unknown + ): [K, V] | undefined`} +/> + + x % 2 === 0)`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first key for which the `predicate` function returns true. + + boolean, + context?: unknown + ): K | undefined`} +/> + + x % 2 === 0)`} +/> + + + +Returns the last key for which the `predicate` function returns true. + + boolean, + context?: unknown + ): K | undefined`} +/> + + x % 2 === 0)`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + + + +Returns the last key associated with the search value, or undefined. + + + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + + number): V | undefined`} +/> + + + +The comparator is used in the same way as Collection#sort. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max()`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: (valueA: C, valueB: C) => number +): V | undefined`} +/> + + person.age)`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + + number): V | undefined`} +/> + + + +The comparator is used in the same way as Collection#sort. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min()`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: (valueA: C, valueB: C) => number + ): V | undefined`} +/> + + person.age)`} +/> + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean`} /> diff --git a/website/docs/OrderedCollection.mdx b/website/docs/OrderedCollection.mdx new file mode 100644 index 0000000000..7586e771f4 --- /dev/null +++ b/website/docs/OrderedCollection.mdx @@ -0,0 +1,22 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# OrderedCollection + +Interface representing all oredered collections. +This includes `List`, `Stack`, `Map`, `OrderedMap`, `Set`, and `OrderedSet`. +return of `isOrdered()` return true in that case. + +## Members + + + +Shallowly converts this collection to an Array. + + + + + +Returns an iterator that iterates over the values in this collection. + + diff --git a/website/docs/OrderedSet.mdx b/website/docs/OrderedSet.mdx new file mode 100644 index 0000000000..f4647aba8c --- /dev/null +++ b/website/docs/OrderedSet.mdx @@ -0,0 +1,38 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# OrderedSet + +A type of [`Set`](../Set/) that has the additional guarantee that the iteration order of values will be the order in which they were added. + + extends Set, OrderedCollection`} /> + +The iteration behavior of OrderedSet is the same as native ES6 Set. + +Note that `OrderedSet` are more expensive than non-ordered Set and may consume more memory. `OrderedSet#add` is amortized `O(log32 N)`, but not stable. + +## Similar API with `Set` + +`OrderedSet` has the exact same API as [`Set`](../Set/). The only new method is OrderedSet.isOrderedSet(maybeOrderedSet) to check if a value is an `OrderedSet`. + +## Construction + + + +Create a new immutable OrderedSet containing the values of the provided collection-like. + +(collection?: Iterable | ArrayLike): OrderedSet`} +/> + +Note: `OrderedSet` is a factory function and not a class, and does not use the `new` keyword during construction. + + + +## Static Methods + + + +True if the provided value is an OrderedSet. + + diff --git a/website/docs/OrdererMap.mdx b/website/docs/OrdererMap.mdx new file mode 100644 index 0000000000..6caeefe9d7 --- /dev/null +++ b/website/docs/OrdererMap.mdx @@ -0,0 +1,49 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# OrderedMap + +A type of [`Map`](../Map/) that maintains the order of iteration according to when entries were set. + + extends Map`} /> + +The iteration behavior of OrderedMap is the same as native ES6 Map and JavaScript Object. + +Note that `OrderedMap` are more expensive than non-ordered Map and may consume more memory. OrderedMap#set is amortized `O(log32 N)`, but not stable. + +Let's look at the following example to see the difference between `Map` and `OrderedMap`: + + + +The `b` key is re-located on the second position. + + + +The `b` key is still on the third position. + +## Similar API with `Map` + +`OrderedMap` has the exact same API as [`Map`](../Map/). The only new method is OrderedMap.isOrderedMap(maybeOrderedMap) to check if a value is an `OrderedMap`. + +## Construction + + + +Creates a new Immutable OrderedMap. + +(collection?: Iterable<[K, V]>): OrderedMap +OrderedMap(obj: { [key: PropertyKey]: V }): OrderedMap`} +/> + +Note: `OrderedMap` is a factory function and not a class, and does not use the `new` keyword during construction. + + + +## Static Methods + + + +True if the provided value is an OrderedMap. + + diff --git a/website/docs/Range().mdx b/website/docs/Range().mdx new file mode 100644 index 0000000000..814fb7b3bc --- /dev/null +++ b/website/docs/Range().mdx @@ -0,0 +1,17 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Range() + +Returns a Seq.Indexed of numbers from `start` (inclusive) to `end` (exclusive), by `step`, where start defaults to 0, `step` to 1, and `end` to infinity. When `start` is equal to `end`, returns empty range. + +`} +/> + +Note: `Range` is a factory function and not a class, and does not use the `new` keyword during construction. + + + + + diff --git a/website/docs/Record.Factory.mdx b/website/docs/Record.Factory.mdx new file mode 100644 index 0000000000..59c7e84fb4 --- /dev/null +++ b/website/docs/Record.Factory.mdx @@ -0,0 +1,46 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Record.Factory + +A Record.Factory is created by the `Record()` function. Record instances +are created by passing it some of the accepted values for that Recordtype: + + + +Note that Record Factories return `Record & Readonly`, +this allows use of both the Record instance API, and direct property +access on the resulting instances: + + + +## Construction + + + +( + values?: Partial + ): RecordOf`} +/> + +## Members + + + +The name provided to `Record(values, name)` can be accessed with `displayName`. + + diff --git a/website/docs/Record.mdx b/website/docs/Record.mdx new file mode 100644 index 0000000000..82f123422b --- /dev/null +++ b/website/docs/Record.mdx @@ -0,0 +1,303 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Record + +A record is similar to a JS object, but enforces a specific set of allowed string keys, and has default values. + +The `Record()` function produces new Record Factories, which when called create Record instances. + + + +Records always have a value for the keys they define. `remove`ing a key from a record simply resets it to the default value for that key. + +```js +myRecord.get('a'); // 1 +myRecord.get('b'); // 3 +const myRecordWithoutB = myRecord.remove('b'); +myRecordWithoutB.get('b'); // 2 +``` + +Values provided to the constructor not found in the Record type will be ignored. For example, in this case, ABRecord is provided a key "x" even though only "a" and "b" have been defined. The value for "x" will be ignored for this record. + +```js +const myRecord = ABRecord({ b: 3, x: 10 }); +myRecord.get('x'); // undefined +``` + +Because Records have a known set of string keys, property get access works as expected, however property sets will throw an Error. + +Note: IE8 does not support property access. Only use `get()` when supporting IE8. + +```js +myRecord.b; // 3 +myRecord.b = 5; // throws Error +``` + +Record Types can be extended as well, allowing for custom methods on your Record. This is not a common pattern in functional environments, but is in many JS programs. + +However Record Types are more restricted than typical JavaScript classes. They do not use a class constructor, which also means they cannot use class properties (since those are technically part of a constructor). + +While Record Types can be syntactically created with the JavaScript `class` form, the resulting Record function is actually a factory function, not a class constructor. Even though Record Types are not classes, JavaScript currently requires the use of `new` when creating new Record instances if they are defined as a `class`. + + + +**Typing Records:** + +Immutable.js exports two types designed to make it easier to use Records with typed code, `RecordOf` and `RecordFactory`. + +When defining a new kind of Record factory function, use a type that describes the values the record contains along with `RecordFactory`. To type instances of the Record (which the factory function returns), use `RecordOf`. + +Typically, new Record definitions will export both the Record factory function as well as the Record instance type for use in other code. + +```ts +import type { RecordFactory, RecordOf } from 'immutable'; + +// Use RecordFactory for defining new Record factory functions. +type Point3DProps = { x: number, y: number, z: number }; + +const defaultValues: Point3DProps = { x: 0, y: 0, z: 0 }; +const makePoint3D: RecordFactory = Record(defaultValues); +export makePoint3D; + +// Use RecordOf for defining new instances of that Record. +export type Point3D = RecordOf; +const some3DPoint: Point3D = makePoint3D({ x: 10, y: 20, z: 30 }); +``` + +**Typing Record Subclasses:** + +Records can be subclassed as a means to add additional methods to Record instances. This is generally discouraged in favor of a more functional API, since Subclasses have some minor overhead. However the ability to create a rich API on Record types can be quite valuable. + +When typing Subclasses, do not use `RecordFactory`, instead apply the props type when subclassing: + +```ts +type PersonProps = { name: string; age: number }; + +const defaultValues: PersonProps = { name: 'Aristotle', age: 2400 }; +const PersonRecord = Record(defaultValues); + +class Person extends PersonRecord { + getName(): string { + return this.get('name'); + } + + setName(name: string): this { + return this.set('name', name); + } +} +``` + +**Choosing Records vs plain JavaScript objects** + +Records offer a persistently immutable alternative to plain JavaScript objects, however they're not required to be used within Immutable.js collections. In fact, the deep-access and deep-updating functions like `getIn()` and `setIn()` work with plain JavaScript Objects as well. + +Deciding to use Records or Objects in your application should be informed by the tradeoffs and relative benefits of each: + +- _Runtime immutability_: plain JS objects may be carefully treated as immutable, however Record instances will _throw_ if attempted to be mutated directly. Records provide this additional guarantee, however at some marginal runtime cost. While JS objects are mutable by nature, the use of type-checking tools like TypeScript or [Flow](https://medium.com/@gcanti/immutability-with-flow-faa050a1aef4) can help gain confidence in code written to favor immutability. + +- _Value equality_: Records use value equality when compared with `is()` or `record.equals()`. That is, two Records with the same keys and values are equal. Plain objects use _reference equality_. Two objects with the same keys and values are not equal since they are different objects. This is important to consider when using objects as keys in a `Map` or + values in a `Set`, which use equality when retrieving values. + +- _API methods_: Records have a full featured API, with methods like `.getIn()`, and `.equals()`. These can make working with these values easier, but comes at the cost of not allowing keys with those names. + +- _Default values_: Records provide default values for every key, which can be useful when constructing Records with often unchanging values. However default values can make using Flow and TypeScript more laborious. + +- _Serialization_: Records use a custom internal representation to efficiently store and update their values. Converting to and from this form isn't free. If converting Records to plain objects is common, consider sticking with plain objects to begin with. + +## Construction + + + +(defaultValues: TProps, name?: string): Record.Factory`} +/> + +## Static methods + + + + + + + + + +## Reading values + + + + + + + +(key: K): TProps[K] +get(key: string, notSetValue: T): T`} +/> + +## Reading deep values + + + + + + + +(key: K): TProps[K] +getIn(key: string, notSetValue: T): T`} +/> + +## Value equality + + + + + + + + + +## Persistent changes + + + +(key: K, value: TProps[K]): this`} /> + + + +(key: K, updater: (value: TProps[K]) => TProps[K]): this;`} +/> + + + +>>): this`} /> + + + +>): this;`} /> + + + + unknown, + ...collections: Array> + ): this;`} +/> + + + + unknown, + ...collections: Array> + ): this;`} +/> + + + +Returns a new instance of this Record type with the value for the specific key set to its default value. + +(key: K): this;`} /> + + + +Returns a new instance of this Record type with all values set to their default values. + + + +## Deep persistent changes + + + + + + + + unknown): this;`} +/> + + + +>): this;`} /> + + + +>): this;`} +/> + + + +): this;`} /> + +## Conversion to JavaScript types + + + +Deeply converts this Record to equivalent native JavaScript Object. + +Note: This method may not be overridden. Objects with custom serialization to plain JS may override toJSON() instead. + +;`} /> + + + +Shallowly converts this Record to equivalent native JavaScript Object. + + + + + +Shallowly converts this Record to equivalent JavaScript Object. + + + +## Transient changes + + + +Note: Not all methods can be used on a mutable collection or within `withMutations`! Only `set` may be used mutatively. + +See Map#withMutations + + unknown): this;`} /> + + + +See Map#asMutable + + + + + +See Map#wasAltered + + + + + +See Map#asImmutable + + + +## Sequence algorithms + + + +;`} /> diff --git a/website/docs/Repeat().mdx b/website/docs/Repeat().mdx new file mode 100644 index 0000000000..f70c5ed8cd --- /dev/null +++ b/website/docs/Repeat().mdx @@ -0,0 +1,16 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Repeat() + +Returns a Seq.Indexed of `value` repeated `times` times. When `times` is not defined, returns an infinite `Seq` of `value`. + +(value: T, times?: number): Seq.Indexed`} /> + +Note: `Repeat` is a factory function and not a class, and does not use the `new` keyword during construction. + + + diff --git a/website/docs/Seq.Indexed.mdx b/website/docs/Seq.Indexed.mdx new file mode 100644 index 0000000000..74b258eb45 --- /dev/null +++ b/website/docs/Seq.Indexed.mdx @@ -0,0 +1,789 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Seq.Indexed + + which represents an ordered indexed list of values. + + + +## Construction + + + +Always returns Seq.Indexed, discarding associated keys and supplying incrementing indices. + + + +Note: `Seq.Indexed` is a conversion function and not a class, and does not use the new keyword during construction. + +## Static methods + + + +Provides an Seq.Indexed of the values provided. + + + +## Reading values + + + +Returns the value associated with the provided index, or notSetValue if the index is beyond the bounds of the Collection. + +(key: number, notSetValue: NSV): T | NSV; +get(key: number): T | undefined;`} +/> + +`index` may be a negative number, which indexes back from the end of the Collection. `s.get(-1)` gets the last item in the Collection. + + + +True if a key exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +In case the `Collection` is not empty returns the first element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): T | NSV; +first(): T | undefined;`} +/> + + + +In case the `Collection` is not empty returns the last element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): T | NSV; +last(): T | undefined;`} +/> + +## Conversion to JavaScript types + + + +Deeply converts this Indexed Seq to equivalent native JavaScript Array. + +>;`} /> + + + +Shallowly converts this Indexed Seq to equivalent native JavaScript Array. + +;`} /> + + + +Shallowly converts this collection to an Array. + +;`} /> + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Seq + + + +Returns Seq.Indexed. + +;`} /> + + + +If this is a collection of [key, value] entry tuples, it will return a Seq.Keyed of those entries. + +;`} /> + + + +Returns a Seq.Keyed with the same key-value entries as this Collection.Indexed. + +;`} /> + + + +Returns a Seq.Indexed with the same values as this Collection.Indexed. + +;`} /> + + + +Returns a Seq.Set with the same values as this Collection.Indexed. + +;`} /> + +## Combination + + + +Returns a Collection of the same type with `separator` between each item in this Collection. + + + + + +Returns a Collection of the same type with the provided `collections` interleaved into this collection. + +>): this;`} +/> + +The resulting Collection includes the first item from each, then the second from each, etc. + + + +The shortest Collection stops interleave. + + + +Since `interleave()` re-indexes values, it produces a complete copy, which has `O(N)` complexity. + +Note: `interleave` _cannot_ be used in `withMutations`. + + + +Splice returns a new indexed Collection by replacing a region of this Collection with new values. If values are not provided, it only skips the region to be removed. + +): this;`} +/> + +`index` may be a negative number, which indexes back from the end of the Collection. `s.splice(-2)` splices after the second to last item. + + + +Since `splice()` re-indexes values, it produces a complete copy, which has `O(N)` complexity. + +Note: `splice` _cannot_ be used in `withMutations`. + + + +Returns a Collection of the same type "zipped" with the provided collections. + +(other: Collection): Seq.Indexed<[T, U]>;`} +/> +(other: Collection, other2: Collection): Seq.Indexed<[T, U, V]>;`} +/> +>): Seq.Indexed;`} +/> + +Like `zipWith`, but using the default `zipper`: creating an `Array`. + + + + + +Returns a Collection "zipped" with the provided collections. Unlike `zip`, `zipAll` continues zipping until the longest collection is exhausted. Missing values from shorter collections are filled with `undefined`. + +(other: Collection): Seq.Indexed<[T, U]>;`} +/> +(other: Collection, other2: Collection): Seq.Indexed<[T, U, V]>;`} +/> +>): Seq.Indexed;`} +/> + + + + + +Returns a Collection of the same type "zipped" with the provided collections by using a custom `zipper` function. + +(zipper: (value: T, otherValue: U) => Z, otherCollection: Collection): Collection.Indexed;`} +/> +(zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection): Seq.Indexed;`} +/> +(zipper: (...values: Array) => Z, ...collections: Array>): Seq.Indexed;`} +/> + + a + b, b);`} +/> + + + +Flattens nested Collections. + +;`} /> +;`} /> + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only others Collection, not Arrays or Objects. + +Note: `flatten(true)` operates on `Collection>` and returns `Collection` + +## Search for value + + + +Returns the first index at which a given value can be found in the Collection, or -1 if it is not present. + + + + + +Returns the last index at which a given value can be found in the Collection, or -1 if it is not present. + + + + + +Returns the first index in the Collection where a value satisfies the provided predicate function. Otherwise -1 is returned. + + boolean, context?: unknown): number;`} +/> + + + +Returns the last index in the Collection where a value satisfies the provided predicate function. Otherwise -1 is returned. + + boolean, context?: unknown): number;`} +/> + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined;`} +/> + + + +Returns the last value for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined;`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown): [number, T] | undefined;`} +/> + + + +Returns the last [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown): [number, T] | undefined;`} +/> + + + +Returns the key for which the `predicate` returns true. + + boolean, context?: unknown): number | undefined;`} +/> + + + +Returns the last key for which the `predicate` returns true. + + boolean, context?: unknown): number | undefined;`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined;`} /> + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +(comparatorValueMapper: (value: T, key: number, iter: this) => C, comparator?: Comparator): T | undefined;`} +/> + + i.avgHit);`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined;`} /> + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +(comparatorValueMapper: (value: T, key: number, iter: this) => C, comparator?: Comparator): T | undefined;`} +/> + + i.avgHit);`} +/> + +## Sequence algorithms + + + +Returns a new Seq with other collections concatenated to this one. + +(...valuesOrCollections: Array | C>): Seq.Indexed;`} +/> + + + +Returns a new Seq.Indexed with values passed through a `mapper` function. + +(mapper: (value: T, key: number, iter: this) => M, context?: unknown): Seq.Indexed;`} +/> + + 10 * x)`} /> + +Note: `map()` always returns a new instance, even if it produced the same value at every step. + + + +Flat-maps the Seq, returning a Seq of the same type. + +(mapper: (value: T, key: number, iter: this) => Iterable, context?: unknown): Seq.Indexed;`} +/> + +Similar to `seq.map(...).flatten(true)`. + + + +Returns a new Collection with only the values for which the `predicate` function returns true. + +(predicate: (value: T, index: number, iter: this) => value is F, context?: unknown): Seq.Indexed;`} +/> + unknown, context?: unknown): this;`} +/> + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new indexed Seq with the values for which the `predicate` function returns false and another for which is returns true. + +(predicate: (this: C, value: T, index: number, iter: this) => value is F, context?: C): [Seq.Indexed, Seq.Indexed];`} +/> +(predicate: (this: C, value: T, index: number, iter: this) => unknown, context?: C): [this, this];`} +/> + + + +;`} /> + + + +Returns a new Collection with only the values for which the `predicate` function returns false. + + unknown, context?: unknown): this;`} +/> + + x > 2)`} /> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Collection with the values in reverse order. + + + + + +Returns a new sorted Collection, sorted by the natural order of the values. + +;`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +Note: `sort()` always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a new sorted Collection, sorted by the provided `comparator` function. + +(comparator: (value: T) => R): Collection.Indexed;`} +/> + +Note: `sortBy()` always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Groups the values by the return value of the `mapper` function, and returns a Collection.Indexed of Arrays of grouped values. + +(mapper: (value: T) => K): Collection.Indexed>;`} +/> + +## Value equality + + + +Returns true if the Collections are of the same size and all values are equal. + + + + + +Returns a hash code for this Collection. + + + +## Reading deep values + + + +Returns the value at the given nested path, or notSetValue if any key in the path is not present. + +(path: Array, notSetValue: NSV): T | NSV;`} +/> +): T | undefined;`} /> + + + +Returns a boolean if the given nested path exists. + +): boolean;`} /> + +## Persistent changes + + + +Returns a new Collection.Indexed with the value at the given index updated to the new value. + + T): this;`} /> + +## Conversion to Collections + + + +Converts this Collection.Indexed to a Map. The first value of each entry is used as the key. + +;`} /> + + + +Converts this Collection.Indexed to an OrderedMap. The first value of each entry is used as the key. + +;`} /> + + + +Converts this Collection.Indexed to a Set. + +;`} /> + + + +Converts this Collection.Indexed to an OrderedSet. + +;`} /> + + + +Converts this Collection.Indexed to a List. + +;`} /> + + + +Converts this Collection.Indexed to a Stack. + +;`} /> + +## Iterators + + + +Returns an Iterable of the keys in the Collection. + +;`} /> + + + +Returns an Iterable of the values in the Collection. + +;`} /> + + + +Returns an Iterable of the [key, value] entries in the Collection. + +;`} /> + +## Collections (Seq) + + + +Returns a Seq of the keys in the Collection. + +;`} /> + + + +Returns a Seq of the values in the Collection. + +;`} /> + + + +Returns a Seq of the [key, value] entries in the Collection. + +;`} /> + +## Side effects + + + +Calls the provided function for each value in the Collection. Returns the Collection. + + void, context?: unknown): this;`} +/> + +## Creating subsets + + + +Returns a new Collection.Indexed with the values between the given start and end indices. + + + + + +Returns a new Collection.Indexed with all but the first value. + + + + + +Returns a new Collection.Indexed with all but the last value. + + + + + +Returns a new Collection.Indexed with the first `n` values removed. + + + + + +Returns a new Collection.Indexed with the last `n` values removed. + + + + + +Returns a new Collection.Indexed with values skipped while the `predicate` function returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection.Indexed with values skipped until the `predicate` function returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection.Indexed with the first `n` values. + + + + + +Returns a new Collection.Indexed with the last `n` values. + + + + + +Returns a new Collection.Indexed with values taken while the `predicate` function returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Collection.Indexed with values taken until the `predicate` function returns true. + + boolean, context?: unknown): this;`} +/> + +## Reducing a value + + + +Returns the accumulated result of calling the provided reducer function for each value in the Collection, from left to right. + +(reducer: (previousValue: R | T, currentValue: T, index: number, iter: this) => R, initialValue?: R): R;`} +/> + + + +Returns the accumulated result of calling the provided reducer function for each value in the Collection, from right to left. + +(reducer: (previousValue: R | T, currentValue: T, index: number, iter: this) => R, initialValue?: R): R;`} +/> + + + +Returns true if the `predicate` function returns a truthy value for every value in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +Returns true if the `predicate` function returns a truthy value for any value in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +Returns the concatenated string result of calling `String(value)` on every value in the Collection, separated by the given separator string. + + + + + +Returns true if the Collection has no values. + + + + + +Returns the number of values in the Collection. + + + + + +Returns a new Collection.Indexed with the number of times each value occurs in the Collection. + +;`} /> + +## Comparison + + + +Returns true if this Collection.Indexed is a subset of the other Collection (i.e. all values in this Collection.Indexed are also in the other). + + + + + +Returns true if this Collection.Indexed is a superset of the other Collection (i.e. this Collection.Indexed contains all values of the other). diff --git a/website/docs/Seq.Keyed.mdx b/website/docs/Seq.Keyed.mdx new file mode 100644 index 0000000000..c81a376324 --- /dev/null +++ b/website/docs/Seq.Keyed.mdx @@ -0,0 +1,889 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Seq.Keyed + + which represents key-value pairs. + + + +## Construction + + + +Always returns a `Seq.Keyed`, if input is not keyed, expects an +collection of [K, V] tuples. + +(collection?: Iterable<[K, V]>): Seq.Keyed +Seq.Keyed(obj: {[key: string]: V}): Seq.Keyed`} +/> + +Note: `Seq.Keyed` is a conversion function and not a class, and does not +use the `new` keyword during construction. + +## Conversion to JavaScript types + + + +Deeply converts this Keyed Seq to equivalent native JavaScript Object. + + };`} /> +Converts keys to Strings. + + + +Shallowly converts this Keyed Seq to equivalent native JavaScript Object. + + +Converts keys to Strings. + + + +Shallowly converts this collection to an Array. + +;`} /> + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Seq + + + +Returns itself. + + + +Returns a Seq.Keyed from this Collection where indices are treated as keys. + +;`} /> + +This is useful if you want to operate on an Collection.Indexed and preserve the [index, value] pairs. + +The returned Seq will have identical iteration order as this Collection. + +```js +const indexedSeq = Seq(['A', 'B', 'C']); +// Seq [ "A", "B", "C" ] +indexedSeq.filter((v) => v === 'B'); +// Seq [ "B" ] +const keyedSeq = indexedSeq.toKeyedSeq(); +// Seq { 0: "A", 1: "B", 2: "C" } +keyedSeq.filter((v) => v === 'B'); +``` + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +;`} /> + + + +Returns a Seq.Set of the values of this Collection, discarding keys. + +;`} /> + +## Sequence functions + + + +Returns a new Collection.Keyed of the same type where the keys and values have been flipped. + + + +```js +const { Map } = require('immutable'); +Map({ a: 'z', b: 'y' }).flip(); +// Map { "z": "a", "y": "b" } +``` + + + +Returns a new Seq with other collections concatenated to this one. + +All entries will be present in the resulting Seq, even if they +have the same key. + +( + ...collections: Array> + ): Seq.Keyed; + concat( + ...collections: Array<{ [key: string]: C }> + ): Seq.Keyed;`} +/> + + + +Returns a new Seq.Keyed with values passed through a `mapper` function. + +(mapper: (value: V, key: K, iter: this) => M, context?: unknown): Seq.Keyed;`} +/> + +```js +const { Seq } = require('immutable'); +Seq.Keyed({ a: 1, b: 2 }).map((x) => 10 * x); +// Seq { "a": 10, "b": 20 } +``` + +Note: `map()` always returns a new instance, even if it produced the same value at every step. + + + +Returns a new Collection.Keyed of the same type with keys passed through a `mapper` function. + +(mapper: (key: K, value: V, iter: this) => M, context?: unknown): Seq.Keyed;`} +/> + +```js +const { Map } = require('immutable'); +Map({ a: 1, b: 2 }).mapKeys((x) => x.toUpperCase()); +// Map { "A": 1, "B": 2 } +``` + +Note: `mapKeys()` always returns a new instance, even if it produced the same key at every step. + + + +Returns a new Collection.Keyed of the same type with entries ([key, value] tuples) passed through a `mapper` function. + +(mapper: (entry: [K, V], index: number, iter: this) => [KM, VM] | undefined, context?: unknown): Seq.Keyed;`} +/> + +```js +const { Map } = require('immutable'); +Map({ a: 1, b: 2 }).mapEntries(([k, v]) => [k.toUpperCase(), v * 2]); +// Map { "A": 2, "B": 4 } +``` + +Note: `mapEntries()` always returns a new instance, even if it produced the same entry at every step. +If the mapper function returns `undefined`, then the entry will be filtered. + + + +Flat-maps the Seq, returning a Seq of the same type. + +(mapper: (value: V, key: K, iter: this) => Iterable<[KM, VM]>, context?: unknown): Seq.Keyed;`} +/> + +Similar to `seq.map(...).flatten(true)`. + + + +Returns a new Seq with only the entries for which the `predicate` function returns true. + +(predicate: (value: V, key: K, iter: this) => value is F, context?: unknown): Seq.Keyed;`} +/> + unknown, context?: unknown): this;`} +/> + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + + +(predicate: (this: C, value: V, key: K, iter: this) => value is F, context?: C): [Seq.Keyed, Seq.Keyed];`} +/> +(predicate: (this: C, value: V, key: K, iter: this) => unknown, context?: C): [this, this];`} +/> + +Returns a new keyed Seq with the values for which the `predicate` function returns false and another for which is returns true. + + + +;`} /> + +Yields [key, value] pairs. + +## Value equality + + + +Returns true if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: this is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + + + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + +```js +const a = List([1, 2, 3]); +const b = List([1, 2, 3]); +assert.notStrictEqual(a, b); // different instances +const set = Set([a]); +assert.equal(set.has(b), true); +``` + +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading values + + + +Returns the value associated with the provided key, or notSetValue if the Collection does not contain this key. + +(key: K, notSetValue: NSV): V | NSV;`} /> + + +Note: it is possible a key may be associated with an `undefined` value, so if `notSetValue` is not provided and this method returns `undefined`, that does not guarantee the key was not found. + + + +True if a key exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +In case the `Collection` is not empty returns the first element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): V | NSV;`} /> + + + + +In case the `Collection` is not empty returns the last element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): V | NSV;`} /> + + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown;`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean;`} /> + +## Persistent changes + + + +This can be very useful as a way to "chain" a normal function into a sequence of methods. RxJS calls this "let" and lodash calls it "thru". + +(updater: (value: this) => R): R;`} /> + +For example, to sum a Seq after mapping and filtering: + + sum + x, 0); +} + +Seq([1, 2, 3]) +.map((x) => x + 1) +.filter((x) => x % 2 === 0) +.update(sum);`} +/> + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +;`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +;`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Set, discarding keys. Throws if values are not hashable. + +;`} /> + +Note: This is equivalent to Set(this), but provided to allow for chained expressions. + + + +Converts this Collection to a Set, maintaining the order of iteration and discarding keys. + +;`} /> + +Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List, discarding keys. + +;`} /> + +This is similar to `List(collection)`, but provided to allow for chained expressions. However, when called on `Map` or other keyed collections, `collection.toList()` ignores the keys and creates a list of just the values, whereas `List(collection)` creates a list of entry tuples. + + + + + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +;`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Iterators + + + +An iterator of this `Collection`'s keys. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `keySeq` instead if you want an Immutable.js Seq. + + + +An iterator of this `Collection`'s values. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `valueSeq` instead if you want an Immutable.js Seq. + + + +An iterator of this `Collection`'s entries as `[ key, value ]` tuples. + +;`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `entrySeq` instead if you want an Immutable.js Seq. + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, discarding values. + +;`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +;`} /> + + + +Returns a new Seq.Indexed of [key, value] tuples. + +;`} /> + +## Sequence algorithms + + + +Returns a new Collection of the same type with only the entries for which the `predicate` function returns false. + + boolean, context?: unknown): this;`} +/> + +```js +const { Map } = require('immutable'); +Map({ a: 1, b: 2, c: 3, d: 4 }).filterNot((x) => x % 2 === 0); +// Map { "a": 1, "c": 3 } +``` + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Collection of the same type in reverse order. + + + + + +Returns a new Collection of the same type which includes the same entries, stably sorted by using a `comparator`. + +): this;`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +```js +const { Map } = require('immutable'); +Map({ c: 3, a: 1, b: 2 }).sort((a, b) => { + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + if (a === b) { + return 0; + } +}); +// OrderedMap { "a": 1, "b": 2, "c": 3 } +``` + +Note: `sort()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means: + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: (valueA: C, valueB: C) => number): this;`} +/> + + member.name);`} +/> + +Note: `sortBy()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a `Map` of `Collection`, grouped by the return value of the `grouper` function. + +(grouper: (value: V, key: K, iter: this) => G, context?: unknown): Map;`} +/> + +Note: This is always an eager operation. + + x.get('v'));`} +/> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Collection. + + unknown, context?: unknown): number;`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned false). + +## Creating subsets + + + +Returns a new Collection of the same type representing a portion of this Collection from start up to but not including end. + + + +If begin is negative, it is offset from the end of the Collection. e.g. slice(-2) returns a Collection of the last two entries. If it is not provided the new Collection will begin at the beginning of this Collection. + +If end is negative, it is offset from the end of the Collection. e.g. slice(0, -1) returns a Collection of everything but the last entry. If it is not provided, the new Collection will continue through the end of this Collection. + +If the requested slice is equivalent to the current Collection, then it will return itself. + + + +Returns a new Collection of the same type containing all entries except the first. + + + + + +Returns a new Collection of the same type containing all entries except the last. + + + + + +Returns a new Collection of the same type which excludes the first `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which excludes the last `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): this;`} +/> + + x.match(/g/)) +// List [ "cat", "hat", "god" ] +`} +/> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): this;`} +/> + + x.match(/hat/)) +// List [ "hat", "god" ] +`} +/> + + + +Returns a new Collection of the same type which includes the first `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes the last `amount` entries from this Collection. + + + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns true. + + boolean, context?: unknown): this;`} +/> + +```js +const { List } = require('immutable'); +List(['dog', 'frog', 'cat', 'hat', 'god']).takeWhile((x) => x.match(/o/)); +// List [ "dog", "frog" ] +``` + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns false. + + boolean, context?: unknown): this;`} +/> + +```js +const { List } = require('immutable'); +List(['dog', 'frog', 'cat', 'hat', 'god']).takeUntil((x) => x.match(/at/)); +// List [ "dog", "frog" ] +``` + +## Combination + + + +Flattens nested Collections. + +; +flatten(shallow?: boolean): Collection;`} +/> + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only other Collections, not Arrays or Objects. + +Note: `flatten(true)` operates on `Collection>` and returns `Collection`. + +## Reducing a value + + + +Reduces the Collection to a value by calling the `reducer` for every entry in the Collection and passing along the reduced value. + +If `initialReduction` is not provided, the first item in the Collection will be used. + +(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: unknown): R; +reduce(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R;`} +/> + + + +Reduces the Collection in reverse (from the right side). + +(reducer: (reduction: R, value: V, key: K, iter: this) => R, initialReduction: R, context?: unknown): R; +reduceRight(reducer: (reduction: V | R, value: V, key: K, iter: this) => R): R;`} +/> + + + +True if `predicate` returns true for all entries in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +True if `predicate` returns true for any entry in the Collection. + + boolean, context?: unknown): boolean;`} +/> + + + +Joins values together as a string, inserting a separator between each. The default separator is `","`. + + + + + +Returns true if this Collection includes no values. + +For some lazy `Seq`, `isEmpty` might need to iterate to determine emptiness. At most one iteration will occur. + + + + + +Returns the size of this Collection. + +Regardless of if this Collection can describe its size lazily (some Seqs cannot), this method will always return the correct size. E.g. it evaluates a lazy `Seq` if necessary. + +If `predicate` is provided, then this returns the count of entries in the Collection for which the `predicate` returns true. + + boolean, context?: unknown): number;`} +/> + + + +Returns a `Seq.Keyed` of counts, grouped by the return value of the `grouper` function. + +(grouper: (value: V, key: K, iter: this) => G, context?: unknown): Map;`} +/> + +Note: This is not a lazy operation. + +## Search for value + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: V): V | undefined;`} +/> + + + +Returns the last value for which the `predicate` returns true. + +Note: `predicate` will be called for each entry in reverse. + + boolean, context?: unknown, notSetValue?: V): V | undefined;`} +/> + + + +Returns the first [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: V): [K, V] | undefined;`} +/> + + + +Returns the last [key, value] entry for which the `predicate` returns true. + +Note: `predicate` will be called for each entry in reverse. + + boolean, context?: unknown, notSetValue?: V): [K, V] | undefined;`} +/> + + + +Returns the key for which the `predicate` returns true. + + boolean, context?: unknown): K | undefined;`} +/> + + + +Returns the last key for which the `predicate` returns true. + +Note: `predicate` will be called for each entry in reverse. + + boolean, context?: unknown): K | undefined;`} +/> + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + +): V | undefined;`} /> + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: Comparator): V | undefined;`} +/> + +```js +const { List } = require('immutable'); +const l = List([ + { name: 'Bob', avgHit: 1 }, + { name: 'Max', avgHit: 3 }, + { name: 'Lili', avgHit: 2 }, +]); +l.maxBy((i) => i.avgHit); // will output { name: 'Max', avgHit: 3 +``` + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): V | undefined;`} /> + +The `comparator` is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: Comparator): V | undefined;`} +/> + +```js +const { List } = require('immutable'); +const l = List([ + { name: 'Bob', avgHit: 1 }, + { name: 'Max', avgHit: 3 }, + { name: 'Lili', avgHit: 2 }, +]); +l.minBy((i) => i.avgHit); // will output { name: 'Bob', avgHit: 1 } +``` + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean;`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean;`} /> diff --git a/website/docs/Seq.Set.mdx b/website/docs/Seq.Set.mdx new file mode 100644 index 0000000000..5f5462658d --- /dev/null +++ b/website/docs/Seq.Set.mdx @@ -0,0 +1,744 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Seq.Set + + which represents a set of values. + + + +Because are often lazy, `Seq.Set` does not provide the same guarantee +of value uniqueness as the concrete . + +## Construction + + + +Always returns a Seq.Set, discarding associated indices or keys. + + + +Note: `Seq.Set` is a conversion function and not a class, and does not use the new keyword during construction. + +## Static methods + + + +Returns a Seq.Set of the provided values. + + + +## Members + + + +## Force evaluation + + +## Persistent changes + + +## Sequence algorithms + + + +Returns a new `Seq.Set` with values passed through a `mapper` function. + +(mapper: (value: T, key: T, iter: this) => M, context?: unknown): Set`} +/> + + 10 * x)`} /> + +Note: `map()` always returns a new instance, even if it produced the same value at every step. + + + +Flat-maps the Seq, returning a Seq of the same type. + +Similar to `set.map(...).flatten(true)`. + +(mapper: (value: T, key: T, iter: this) => Iterable, context?: unknown): Seq.Set`} +/> + + + +Returns a new Set with only the values for which the `predicate` function returns true. + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + boolean, context?: unknown): Seq.Set`} +/> + + + +Returns a new Set with only the values for which the `predicate` function returns false. + + boolean, context?: unknown): Seq.Set`} +/> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Set with the values for which the `predicate` function returns false and another for which is returns true. + + boolean, context?: C): [Seq.Set, Seq.Set]`} +/> + + + +Returns a new Collection of the same type which includes the same entries, stably sorted by using a `comparator`. + +): OrderedSet`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +Note: `sort()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: Comparator): this & OrderedSet`} +/> + + person.age)`} +/> + +Note: `sortBy()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a new Set with the order of the values reversed. + +`} /> + + + +Returns a `Map` of `Set`, grouped by the return value of the `grouper` function. + +(grouper: (value: T, key: T, iter: this) => G, context?: unknown): Map>`} +/> + +Note: This is not a lazy operation. + +## Conversion to JavaScript types + + + +Deeply converts this Set Seq to equivalent native JavaScript Array. + +>`} /> + + + +Shallowly converts this Set Seq to equivalent native JavaScript Array. + +`} /> + + + +Shallowly converts this collection to an Array. + +`} /> + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Seq + + + +Returns itself. + +`} /> + + + +Returns a Seq.Keyed from this Collection where indices are treated as keys. + +This is useful if you want to operate on a Collection and preserve the [value, value] pairs. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a Seq.Set of the values of this Collection, discarding keys. + +`} /> +## Value equality + + + +True if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + + + + + +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading values + + + +Returns the value associated with the provided key, or notSetValue if the Collection does not contain this key. + +Note: it is possible a key may be associated with an `undefined` value, so if `notSetValue` is not provided and this method returns `undefined`, that does not guarantee the key was not found. + +(key: T, notSetValue: NSV): T | NSV +get(key: T): T | undefined`} +/> + + + +True if a key exists within this Collection, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +Returns the first value in this Collection. + +(notSetValue: NSV): T | NSV +first(): T | undefined`} +/> + + + +Returns the last value in this Collection. + +(notSetValue: NSV): T | NSV +last(): T | undefined`} +/> + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean`} /> + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Returns itself. + +`} /> + + + +Converts this Collection to a Set, maintaining the order of iteration. + +`} /> + +Note: This is equivalent to `OrderedSet(this)`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List. + +`} /> + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Iterators + + + +An iterator of this `Set`'s keys. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `keySeq` instead, if this is what you want. + + + +An iterator of this `Set`'s values. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `valueSeq` instead, if this is what you want. + + + +An iterator of this `Set`'s entries as `[value, value]` tuples. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `entrySeq` instead, if this is what you want. + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, discarding values. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a new Seq.Indexed of [value, value] tuples. + +`} /> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Collection. + + unknown, context?: unknown): number`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned false). + +## Creating subsets + + + +Returns a new Set of the same type representing a portion of this Set from start up to but not including end. + +`} /> + +If begin is negative, it is offset from the end of the Collection. e.g. `slice(-2)` returns a Collection of the last two entries. If it is not provided the new Collection will begin at the beginning of this Collection. + +If end is negative, it is offset from the end of the Collection. e.g. `slice(0, -1)` returns a Collection of everything but the last entry. If it is not provided, the new Collection will continue through the end of this Collection. + +If the requested slice is equivalent to the current Collection, then it will return itself. + + + +Returns a new Collection of the same type containing all entries except the first. + +`} /> + + + +Returns a new Collection of the same type containing all entries except the last. + +`} /> + + + +Returns a new Collection of the same type which excludes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which excludes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): Set`} +/> + + x.match(/g/))`} +/> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): Set`} +/> + + x.match(/hat/))`} +/> + + + +Returns a new Collection of the same type which includes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns true. + + boolean, context?: unknown): Set`} +/> + + x.match(/o/))`} +/> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns false. + + boolean, context?: unknown): Set`} +/> + + x.match(/at/))`} +/> + +## Combination + + + +Returns a new Seq with other collections concatenated to this one. + +(...valuesOrCollections: Array | C>): Seq.Set`} +/> + + + +Flattens nested Collections. + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only others Collection, not Arrays or Objects. + + + + + +Flat-maps the Set, returning a new Set. + +Similar to `set.map(...).flatten(true)`. + +(mapper: (value: T, key: T, iter: this) => Iterable, context?: unknown): Set`} +/> + +## Reducing a value + + + +Reduces the Iterable to a value by calling the `reducer` for every entry in the Iterable and passing along the reduced value. + +(reducer: (reduced: R, value: T, key: T, iter: this) => R, initialValue: R): R`} +/> + +If initialValue is not provided, the first entry in the Iterable will be used as the initial value. + + + +Reduces the Iterable to a value by calling the `reducer` for every entry in the Iterable and passing along the reduced value. + +(reducer: (reduced: R, value: T, key: T, iter: this) => R, initialValue: R): R`} +/> + +Note: Similar to this.reverse().reduce(), and provided for parity with `Array#reduceRight`. + + + +Returns true if the `predicate` returns true for every entry in the Iterable. + + boolean, context?: unknown): boolean`} +/> + + + +Returns true if the `predicate` returns true for any entry in the Iterable. + + boolean, context?: unknown): boolean`} +/> + + + +Returns a string of all the entries in the Iterable, separated by `separator`. + + + + + +Returns true if the Iterable is empty. + + + + + +Returns the number of entries in the Iterable. + + + + + +Returns a Map of the number of occurrences of each value in the Iterable. + +(grouper: (value: T, key: T, iter: this) => G, context?: unknown): Map`} +/> + +## Search for value + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): T | undefined`} +/> + + + +Returns the last value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): T | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first [value, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): [T, T] | undefined`} +/> + + + +Returns the last [value, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): [T, T] | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first key for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined`} +/> + + + +Returns the last key for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined`} /> + +The comparator is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: Comparator): T | undefined`} +/> + + person.age)`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined`} /> + +The comparator is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: Comparator): T | undefined`} +/> + + person.age)`} +/> + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean`} /> diff --git a/website/docs/Seq.mdx b/website/docs/Seq.mdx new file mode 100644 index 0000000000..96c005c4bc --- /dev/null +++ b/website/docs/Seq.mdx @@ -0,0 +1,996 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Seq + +`Seq` describes a lazy operation, allowing them to efficiently chain +use of all the higher-order collection methods (such as and ) +by not creating intermediate collections. + + extends Collection`} /> + +**Seq is immutable** — Once a Seq is created, it cannot be +changed, appended to, rearranged or otherwise modified. Instead, any +mutative method called on a `Seq` will return a new `Seq`. + +**Seq is lazy** — `Seq` does as little work as necessary to respond to any +method call. Values are often created during iteration, including implicit +iteration when reducing or converting to a concrete data structure such as +a or JavaScript [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array). + +For example, the following performs no work, because the resulting +`Seq`'s values are never iterated: + +```js +import { Seq } from 'immutable'; +const oddSquares = Seq([1, 2, 3, 4, 5, 6, 7, 8]) + .filter((x) => x % 2 !== 0) + .map((x) => x * x); +``` + +Once the `Seq` is used, it performs only the work necessary. In this +example, no intermediate arrays are ever created, filter is called three +times, and map is only called once: + +```js +oddSquares.get(1); // 9 +``` + +Any collection can be converted to a lazy Seq with `Seq()`. + +```js +import { Map } from 'immutable'; + +const map = Map({ a: 1, b: 2, c: 3 }); +const lazySeq = Seq(map); +``` + +`Seq` allows for the efficient chaining of operations, allowing for the +expression of logic that can otherwise be very tedious: + +```js +lazySeq + .flip() + .map((key) => key.toUpperCase()) + .flip(); +// Seq { A: 1, B: 1, C: 1 } +``` + +As well as expressing logic that would otherwise seem memory or time +limited, for example `Range` is a special kind of Lazy sequence. + + -n) + .filter((n) => n % 2 === 0) + .take(2) + .reduce((r, n) => r * n, 1); +`} +/> + +Seq is often used to provide a rich collection API to JavaScript Object. + + v * 2) + .toObject();`} +/> + +## Construction + + + +Creates a Seq. + +(seq: S): S; +function Seq(collection: Collection.Keyed): Seq.Keyed; +function Seq(collection: Collection.Set): Seq.Set; +function Seq(collection: Collection.Indexed | Iterable | ArrayLike): Seq.Indexed; +function Seq(obj: { [key: string]: V }): Seq.Keyed;`} +/> + +Returns a particular kind of `Seq` based on the input. + + * If a `Seq`, that same `Seq`. + * If an `Collection`, a `Seq` of the same kind (Keyed, Indexed, or Set). + * If an Array-like, an `Seq.Indexed`. + * If an Iterable Object, an `Seq.Indexed`. + * If an Object, a `Seq.Keyed`. + +Note: An Iterator itself will be treated as an object, becoming a `Seq.Keyed`, +which is usually not what you want. You should turn your Iterator Object into +an iterable object by defining a Symbol.iterator (or @@iterator) method which +returns `this`. + +Note: `Seq` is a conversion function and not a class, and does not use the +`new` keyword during construction. + +## Static methods + + + + + +## Members + + + +Some Seqs can describe their size lazily. When this is the case, +size will be an integer. Otherwise it will be undefined. + + + +For example, Seqs returned from or +preserve the size of the original `Seq` while does not. + +Note: , + + and `Seq`s made from +s and s will always have a +size. + +## Force evaluation + + + +Because Sequences are lazy and designed to be chained together, they do +not cache their results. For example, this function is called a total +of 6 times, as each `join` iterates the `Seq` of three values. + + + +```js +var squares = Seq([1, 2, 3]).map((x) => x * x); +squares.join() + squares.join(); +``` + +If you know a `Seq` will be used multiple times, it may be more +efficient to first cache it in memory. Here, the function is called +only 3 times. + +```js +var squares = Seq([1, 2, 3]) + .map((x) => x * x) + .cacheResult(); +squares.join() + squares.join(); +``` + +Use this method judiciously, as it must fully evaluate a `Seq` which can be +a burden on memory and possibly performance. + +Note: after calling , a `Seq` will always have a `size`. + +## Sequence algorithms + + + +Returns a new `Seq` with values passed through a +`mapper` function. + +(mapper: (value: V, key: K, iter: this) => M, context?: unknown): Seq;`} +/> + + 10 * x);`} /> + +Note: always returns a new instance, even if it produced the same +value at every step. +Note: used only for sets. + + + +Flat-maps the `Seq`, returning a `Seq` of the same type. + +(mapper: (value: V, key: K, iter: this) => Iterable, context?: unknown): Seq;`} +/> + +Similar to (...).(true). + +Note: Used only for sets. + + + +Returns a new `Seq` with only the values for which the `predicate` +function returns true. + + unknown, context?: unknown): this;`} +/> + +Note: always returns a new instance, even if it results in +not filtering out any values. + + + +Returns a new `Seq` with the values for which the `predicate` function returns false and another for which is returns true. + +( + predicate: (this, value: V, key: K, iter) => value is F, + context + ): [Seq, Seq];`} +/> + + + +Returns a new `Seq` of the same type with other values and collection-like concatenated to this one. + + + +All entries will be present in the resulting `Seq`, even if they have the same key. + + + +Returns a new Collection of the same type with only the entries for which the `predicate` function returns false. + + boolean, context): this;`} +/> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Collection of the same type in reverse order. + + + + + +Returns a new Collection of the same type which includes the same entries, stably sorted by using a `comparator`. + +): this;`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +When sorting collections which have no defined order, their ordered equivalents will be returned. e.g. `map.sort()` returns OrderedMap. + + { + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + if (a === b) { + return 0; + } +});`} +/> + +Note: `sort()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means. + +(comparatorValueMapper: (value: V, key: K, iter: this) => C, comparator?: Comparator): this;`} +/> + + member.name); +`} +/> + +Note: `sortBy()` Always returns a new instance, even if the original was +already sorted. + +Note: This is always an eager operation. + + + +Returns a `Map` of `Collection`, grouped by the return value of the `grouper` function. + +( + grouper: (value: V, key: K, iter: this) => G, + context?: unknown + ): Map`} +/> + +Note: This is always an eager operation. + + x.get('v'))`} +/> + +## Value equality + + + +True if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + + + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + +```js +import { Seq, Set } from 'immutable'; + +const a = Seq([1, 2, 3]); +const b = Seq([1, 2, 3]); +assert.notStrictEqual(a, b); // different instances +const set = Set([a]); +assert.equal(set.has(b), true); +``` + +Note: hashCode() MUST return a Uint32 number. The easiest way to guarantee this is to return `myHash | 0` from a custom implementation. +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +Note: `hashCode()` is not guaranteed to always be called before `equals()`. Most but not all Immutable.js collections use hash codes to organize their internal data structures, while all Immutable.js collections use equality during lookups. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading values + + + +Returns the value associated with the provided key, or notSetValue if the Collection does not contain this key. + +Note: it is possible a key may be associated with an `undefined` value, so if `notSetValue` is not provided and this method returns `undefined`, that does not guarantee the key was not found. + +(key: K, notSetValue: NSV): V | NSV;`} /> + + + + +True if a key exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +In case the `Collection` is not empty returns the first element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): V | NSV;`} /> + + + + +In case the `Collection` is not empty returns the last element of the `Collection`. In case the `Collection` is empty returns the optional default value if provided, if no default value is provided returns undefined. + +(notSetValue: NSV): V | NSV;`} /> + + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown;`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean;`} /> + +## Persistent changes + + + +This can be very useful as a way to "chain" a normal function into a sequence of methods. RxJS calls this "let" and lodash calls it "thru". + +(updater: (value: this) => R): R;`} /> + +For example, to sum a Seq after mapping and filtering: + + sum + x, 0); +} +Seq([1, 2, 3]) + .map((x) => x + 1) + .filter((x) => x % 2 === 0) + .update(sum);`} +/> + +## Conversion to JavaScript types + + + +Deeply converts this Seq to equivalent native JavaScript Array or Object. + + | { [key: string]: V };`} /> + +`Collection.Indexed`, and `Collection.Set` become `Array`, while `Collection.Keyed` become `Object`, converting keys to Strings. + + + +Shallowly converts this Seq to equivalent native JavaScript Array or Object. + + | { [key: string]: V };`} /> + +`Collection.Indexed`, and `Collection.Set` become `Array`, while `Collection.Keyed` become `Object`, converting keys to Strings. + + + +Shallowly converts this collection to an Array. + +;`} /> + +`Collection.Indexed`, and `Collection.Set` produce an Array of values. `Collection.Keyed` produce an Array of [key, value] tuples. + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +;`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +;`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Set, discarding keys. Throws if values are not hashable. + +;`} /> + +Note: This is equivalent to `Set(this)`, but provided to allow for chained expressions. + + + +Converts this Collection to a Set, maintaining the order of iteration and discarding keys. + +;`} /> + +Note: This is equivalent to `OrderedSet(this.valueSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List, discarding keys. + +;`} /> + +This is similar to `List(collection)`, but provided to allow for chained +expressions. However, when called on `Map` or other keyed collections, +`collection.toList()` discards the keys and creates a list of only the +values, whereas `List(collection)` creates a list of entry tuples. + + + + + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +;`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Conversion to Seq + + + +Converts this Collection to a Seq of the same kind (indexed, keyed, or set). + +;`} /> + + + +Returns a Seq.Keyed from this Collection where indices are treated as keys. + +;`} /> + +This is useful if you want to operate on an Collection.Indexed and preserve the [index, value] pairs. + +The returned Seq will have identical iteration order as this Collection. + +```js +import { Seq } from 'immutable'; + +const indexedSeq = Seq(['A', 'B', 'C']); +// Seq [ "A", "B", "C" ] +indexedSeq.filter((v) => v === 'B'); +// Seq [ "B" ] +const keyedSeq = indexedSeq.toKeyedSeq(); +// Seq { 0: "A", 1: "B", 2: "C" } +keyedSeq.filter((v) => v === 'B'); +// Seq { 1: "B" } +``` + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +;`} /> + + + +Returns a Seq.Set of the values of this Collection, discarding keys. + +;`} /> + +## Iterators + + + +An iterator of this `Collection`'s keys. + +;`} /> + +Note: this will return an ES6 iterator which does not support +Immutable.js sequence algorithms. Use `keySeq` instead, if this is +what you want. + + + +An iterator of this `Collection`'s values. + +Note: this will return an ES6 iterator which does not support +Immutable.js sequence algorithms. Use `valueSeq` instead, if this is +what you want. + +;`} /> + + + +An iterator of this `Collection`'s entries as `[ key, value ]` tuples. + +Note: this will return an ES6 iterator which does not support +Immutable.js sequence algorithms. Use `entrySeq` instead, if this is +what you want. + +;`} /> + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, +discarding values. + +;`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +;`} /> + + + +Returns a new Seq.Indexed of [key, value] tuples. + +;`} /> + +## Side effects + + + +The sideEffect is executed for every entry in the Seq. + + unknown, context?: unknown): number;`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned `false`). + +## Creating subsets + + + +Returns a new Seq of the same type containing entries from begin up to but not including end. + +If begin is negative, it is offset from the end of the Seq. If end is negative, it is also offset from the end of the Seq. If end is not provided, it will default to the size of the Seq. If the requested slice is empty, returns the same type of empty Seq. + + + + + +Returns a new Seq of the same type containing all entries except the first. + + + + + +Returns a new Seq of the same type containing all entries except the last. + + + + + +Returns a new Seq of the same type containing all entries except the first amount. + + + + + +Returns a new Seq of the same type containing all entries except the last amount. + + + + + +Returns a new Seq of the same type containing entries from the first entry for which predicate returns false. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Seq of the same type containing entries from the first entry for which predicate returns true. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Seq of the same type containing the first amount entries. + + + + + +Returns a new Seq of the same type containing the last amount entries. + + + + + +Returns a new Seq of the same type containing entries from the start until predicate returns false. + + boolean, context?: unknown): this;`} +/> + + + +Returns a new Seq of the same type containing entries from the start until predicate returns true. + + boolean, context?: unknown): this;`} +/> + +## Combination + + + +Flattens nested Collections. + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only other Collections, not Arrays or Objects. + +Note: `flatten(true)` operates on `Collection>` and returns `Collection`. + + + + + + +Reduces the Collection to a value by calling the `reducer` for every entry in the Collection and passing along the reduced value. + +If `initialReduction` is not provided, the first item in the Collection will be used. + +@see `Array#reduce`. + +(reducer: (reduction, value, key, iter: this) => R): R;`} +/> + + + +Reduces the Collection in reverse (from the right side). + +Note: Similar to `this.reverse().reduce()`, and provided for parity with `Array#reduceRight`. + +(reducer: (reduction, value, key, iter: this) => R): R;`} +/> + + + +True if `predicate` returns true for all entries in the Collection. + + boolean, + context?: unknown + ): boolean;`} +/> + + + +True if `predicate` returns true for any entry in the Collection. + + boolean, + context?: unknown + ): boolean;`} +/> + + + +Joins values together as a string, inserting a separator between each. The default separator is `","`. + + + + + +Returns true if this Collection includes no values. + +For some lazy `Seq`, `isEmpty` might need to iterate to determine emptiness. At most one iteration will occur. + + + + + +Returns the size of this Collection. + +Regardless of if this Collection can describe its size lazily (some Seqs cannot), this method will always return the correct size. E.g. it evaluates a lazy `Seq` if necessary. + +If `predicate` is provided, then this returns the count of entries in the Collection for which the `predicate` returns true. + + + boolean, context?: unknown): number;`} +/> + + + +Returns a `Seq.Keyed` of counts, grouped by the return value of the `grouper` function. + +(grouper: (value: V, key: K, iter: this) => G, context?: unknown): Map;`} +/> + +Note: This is not a lazy operation. + +## Search for value + + + +Returns the first value for which the `predicate` returns true. + + boolean, + context?: unknown, + notSetValue?: V + ): V | undefined;`} +/> + + + +Returns the last value for which the `predicate` returns true. + +Note: `predicate` will be called for each entry in reverse. + + boolean, + context?: unknown, + notSetValue?: V + ): V | undefined;`} +/> + + + +Returns the first [key, value] entry for which the `predicate` returns true. + + boolean, + context?: unknown, + notSetValue?: V + ): [K, V] | undefined;`} +/> + + + +Returns the last [key, value] entry for which the `predicate` returns true. + +Note: `predicate` will be called for each entry in reverse. + + boolean, + context?: unknown, + notSetValue?: V + ): [K, V] | undefined;`} +/> + + + +Returns the key for which the `predicate` returns true. + + boolean, + context?: unknown + ): K | undefined;`} +/> + + + +Returns the last key for which the `predicate` returns true. + + boolean, + context?: unknown + ): K | undefined;`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): V | undefined;`} /> + +The `comparator` is used in the same way as . If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: Comparator + ): V | undefined;`} +/> + + i.avgHit); +`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): V | undefined;`} /> + +The `comparator` is used in the same way as . If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative _only_ when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +( + comparatorValueMapper: (value: V, key: K, iter: this) => C, + comparator?: Comparator + ): V | undefined;`} +/> + + i.avgHit); +`} +/> + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean;`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean;`} /> diff --git a/website/docs/Set.mdx b/website/docs/Set.mdx new file mode 100644 index 0000000000..e87ff08558 --- /dev/null +++ b/website/docs/Set.mdx @@ -0,0 +1,860 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Set + +A Collection of unique values with `O(log32 N)` adds and has. + + extends Collection.Set`} /> + +When iterating a Set, the entries will be (value, value) pairs. Iteration order of a Set is undefined, however is stable. Multiple iterations of the same Set will iterate in the same order. + +Set values, like Map keys, may be of any type. Equality is determined by `Immutable.is` enabling Sets to uniquely include other Immutable collections, custom value types, and NaN. + +## Construction + + + +Create a new Immutable Set. + +(collection?: Iterable | ArrayLike): Set`} /> + +Note: `Set` is a factory function and not a class, and does not use the `new` keyword during construction. + + + +## Static Methods + + + +True if the provided value is a Set. + + + + + +Creates a new Set containing `values`. + +(...values: Array): Set`} /> + + + +`Set.fromKeys()` creates a new immutable Set containing the keys from this Collection or JavaScript Object. + +(iter: Collection.Keyed): Set +Set.fromKeys(iter: Collection): Set +Set.fromKeys(obj: { [key: string]: unknown }): Set`} +/> + + + +Creates a Set that contains every value shared between all of the provided Sets. + +(sets: Iterable>): Set`} /> + + + + + +Creates a Set that contains all values contained in any of the provided Sets. + +(sets: Iterable>): Set`} /> + + + +## Members + + + +The number of items in this Set. + + + +## Persistent changes + + + +Returns a new Set which includes this value. + +`} /> + +Note: `add` can be used in `withMutations`. + + + +Returns a new Set which excludes this value. + +`} /> + +Note: `delete` cannot be safely used in IE8, use `remove` if supporting old browsers. + +Note: `delete` can be used in `withMutations`. + + + +Returns a new Set containing no values. + +`} /> + +Note: `clear` can be used in `withMutations`. + + + +Returns a Set including any value from `collections` that does not already exist in this Set. + +(...collections: Array>): Set`} /> + +Note: `union` can be used in `withMutations`. + + + +Returns a Set which has removed any values not also contained within `collections`. + +>): Set`} /> + +Note: `intersect` can be used in `withMutations`. + + + +Returns a Set excluding any values contained within `collections`. + +>): Set`} /> + + + +Note: `subtract` can be used in `withMutations`. + +## Transient changes + + + +Note: Not all methods can be used on a mutable collection or within `withMutations`! Check the documentation for each method to see if it allows being used in `withMutations`. + + unknown): Set`} +/> + + + +`} /> + +Note: Not all methods can be used on a mutable collection or within `withMutations`! Check the documentation for each method to see if it allows being used in `withMutations`. + + + +Returns true if this is a mutable copy (see `asMutable()`) and mutative alterations have been applied. + + + + + +The yin to `asMutable`'s yang. Because it applies to mutable collections, this operation is _mutable_ and may return itself (though may not return itself, i.e. if the result is an empty collection). Once performed, the original mutable copy must no longer be mutated since it may be the immutable result. + +`} /> + +If possible, use `withMutations` to work with temporary mutable copies as it provides an easier to use API and considers many common optimizations. + +## Sequence algorithms + + + +Returns a new Set with values passed through a `mapper` function. + +(mapper: (value: T, key: T, iter: this) => M, context?: unknown): Set`} +/> + + 10 * x)`} /> + + + +Flat-maps the Set, returning a new Set. + +Similar to `set.map(...).flatten(true)`. + +(mapper: (value: T, key: T, iter: this) => Iterable, context?: unknown): Set`} +/> + + + +Returns a new Set with only the values for which the `predicate` function returns true. + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + boolean, context?: unknown): Set`} +/> + + + +Returns a new Set with only the values for which the `predicate` function returns false. + + boolean, context?: unknown): Set`} +/> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Set with the values for which the `predicate` function returns false and another for which is returns true. + + boolean, context?: C): [Set, Set]`} +/> + + + +Returns an OrderedSet of the same type which includes the same entries, stably sorted by using a `comparator`. + +): OrderedSet`} /> + +If a `comparator` is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +Note: `sort()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: (valueA: C, valueB: C) => number): this & OrderedSet`} +/> + + person.age)`} +/> + +Note: `sortBy()` Always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a new Set with the order of the values reversed. + +`} /> + + + +Returns a `Map` of `Set`, grouped by the return value of the `grouper` function. + +(grouper: (value: T, key: T, iter: this) => G, context?: unknown): Map>`} +/> + +Note: This is not a lazy operation. + +## Conversion to JavaScript types + + + +Deeply converts this Set to equivalent native JavaScript Array. + +>`} /> + + + +Shallowly converts this Set to equivalent native JavaScript Array. + +`} /> + + + +Shallowly converts this collection to an Array. + +`} /> + + + +Shallowly converts this Collection to an Object. + + + +Converts keys to Strings. + +## Conversion to Seq + + + +Returns itself. + +`} /> + + + +Returns a Seq.Keyed from this Collection where indices are treated as keys. + +This is useful if you want to operate on a Collection and preserve the [value, value] pairs. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a Seq.Set of the values of this Collection, discarding keys. + +`} /> + +## Value equality + + + +True if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + +The `hashCode` of a Collection is used to determine potential equality, and is used when adding this to a `Set` or as a key in a `Map`, enabling lookup via a different instance. + + + + + +If two values have the same `hashCode`, they are [not guaranteed to be equal][Hash Collision]. If two values have different `hashCode`s, they must not be equal. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) + +## Reading values + + + +Returns the value associated with the provided key, or notSetValue if the Collection does not contain this key. + +Note: it is possible a key may be associated with an `undefined` value, so if `notSetValue` is not provided and this method returns `undefined`, that does not guarantee the key was not found. + +(key: T, notSetValue: NSV): T | NSV +get(key: T): T | undefined`} +/> + + + +True if a key exists within this Collection, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this `Collection`, using `Immutable.is` to determine equality. + + + + + +Returns the first value in this Collection. + +(notSetValue: NSV): T | NSV +first(): T | undefined`} +/> + + + +Returns the last value in this Collection. + +(notSetValue: NSV): T | NSV +last(): T | undefined`} +/> + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown`} +/> + + + +Plain JavaScript Object or Arrays may be nested within an Immutable.js Collection, and getIn() can access those values as well: + + + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean`} /> + +## Conversion to Collections + + + +Converts this Collection to a Map, Throws if keys are not hashable. + +`} /> + +Note: This is equivalent to `Map(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a Map, maintaining the order of iteration. + +`} /> + +Note: This is equivalent to `OrderedMap(this.toKeyedSeq())`, but provided for convenience and to allow for chained expressions. + + + +Returns itself. + +`} /> + + + +Converts this Collection to a Set, maintaining the order of iteration. + +`} /> + +Note: This is equivalent to `OrderedSet(this)`, but provided for convenience and to allow for chained expressions. + + + +Converts this Collection to a List. + +`} /> + + + +Converts this Collection to a Stack, discarding keys. Throws if values are not hashable. + +`} /> + +Note: This is equivalent to `Stack(this)`, but provided to allow for chained expressions. + +## Iterators + + + +An iterator of this `Set`'s keys. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `keySeq` instead, if this is what you want. + + + +An iterator of this `Set`'s values. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `valueSeq` instead, if this is what you want. + + + +An iterator of this `Set`'s entries as `[value, value]` tuples. + +`} /> + +Note: this will return an ES6 iterator which does not support Immutable.js sequence algorithms. Use `entrySeq` instead, if this is what you want. + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Collection, discarding values. + +`} /> + + + +Returns an Seq.Indexed of the values of this Collection, discarding keys. + +`} /> + + + +Returns a new Seq.Indexed of [value, value] tuples. + +`} /> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Collection. + + unknown, context?: unknown): number`} +/> + +Unlike `Array#forEach`, if any call of `sideEffect` returns `false`, the iteration will stop. Returns the number of entries iterated (including the last iteration which returned false). + +## Creating subsets + + + +Returns a new Set of the same type representing a portion of this Set from start up to but not including end. + +`} /> + +If begin is negative, it is offset from the end of the Collection. e.g. `slice(-2)` returns a Collection of the last two entries. If it is not provided the new Collection will begin at the beginning of this Collection. + +If end is negative, it is offset from the end of the Collection. e.g. `slice(0, -1)` returns a Collection of everything but the last entry. If it is not provided, the new Collection will continue through the end of this Collection. + +If the requested slice is equivalent to the current Collection, then it will return itself. + + + +Returns a new Collection of the same type containing all entries except the first. + +`} /> + + + +Returns a new Collection of the same type containing all entries except the last. + +`} /> + + + +Returns a new Collection of the same type which excludes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which excludes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): Set`} +/> + + x.match(/g/))`} +/> + + + +Returns a new Collection of the same type which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): Set`} +/> + + x.match(/hat/))`} +/> + + + +Returns a new Collection of the same type which includes the first `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes the last `amount` entries from this Collection. + +`} /> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns true. + + boolean, context?: unknown): Set`} +/> + + x.match(/o/))`} +/> + + + +Returns a new Collection of the same type which includes entries from this Collection as long as the `predicate` returns false. + + boolean, context?: unknown): Set`} +/> + + x.match(/at/))`} +/> + +## Combination + + + +Returns a new Set with other collections concatenated to this one. + +(...valuesOrCollections: Array | C>): Set`} +/> + + + +Flattens nested Collections. + +Will deeply flatten the Collection by default, returning a Collection of the same type, but a `depth` can be provided in the form of a number or boolean (where true means to shallowly flatten one level). A depth of 0 (or shallow: false) will deeply flatten. + +Flattens only others Collection, not Arrays or Objects. + + + + + +Flat-maps the Set, returning a new Set. + +Similar to `set.map(...).flatten(true)`. + +(mapper: (value: T, key: T, iter: this) => Iterable, context?: unknown): Set`} +/> + +## Reducing a value + + + +Reduces the Iterable to a value by calling the `reducer` for every entry in the Iterable and passing along the reduced value. + +(reducer: (reduced: R, value: T, key: T, iter: this) => R, initialValue: R): R`} +/> + +If initialValue is not provided, the first entry in the Iterable will be used as the initial value. + + + +Reduces the Iterable to a value by calling the `reducer` for every entry in the Iterable and passing along the reduced value. + +(reducer: (reduced: R, value: T, key: T, iter: this) => R, initialValue: R): R`} +/> + +Note: Similar to this.reverse().reduce(), and provided for parity with `Array#reduceRight`. + + + +Returns true if the `predicate` returns true for every entry in the Iterable. + + boolean, context?: unknown): boolean`} +/> + + + +Returns true if the `predicate` returns true for any entry in the Iterable. + + boolean, context?: unknown): boolean`} +/> + + + +Returns a string of all the entries in the Iterable, separated by `separator`. + + + + + +Returns true if the Iterable is empty. + + + + + +Returns the number of entries in the Iterable. + + + + + +Returns a Map of the number of occurrences of each value in the Iterable. + +(grouper: (value: T, key: T, iter: this) => G, context?: unknown): Map`} +/> + +## Search for value + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): T | undefined`} +/> + + + +Returns the last value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): T | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first [value, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): [T, T] | undefined`} +/> + + + +Returns the last [value, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): [T, T] | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first key for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined`} +/> + + + +Returns the last key for which the `predicate` returns true. + + boolean, context?: unknown): T | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined`} /> + +The comparator is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `>`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `max` will operate independent of the order of input as long as the comparator is commutative. The default comparator `>` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: Comparator): T | undefined`} +/> + + person.age)`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined`} /> + +The comparator is used in the same way as `Collection#sort`. If it is not provided, the default comparator is `<`. + +When two values are considered equivalent, the first encountered will be returned. Otherwise, `min` will operate independent of the order of input as long as the comparator is commutative. The default comparator `<` is commutative only when types do not differ. + +If `comparator` returns 0 and either value is NaN, undefined, or null, that value will be returned. + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means: + +(comparatorValueMapper: (value: T, key: T, iter: this) => C, comparator?: Comparator): T | undefined`} +/> + + person.age)`} +/> + +## Comparison + + + +True if `iter` includes every value in this Collection. + +): boolean`} /> + + + +True if this Collection includes every value in `iter`. + +): boolean`} /> diff --git a/website/docs/Stack.mdx b/website/docs/Stack.mdx new file mode 100644 index 0000000000..c4e14605dd --- /dev/null +++ b/website/docs/Stack.mdx @@ -0,0 +1,847 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# Stack + +Stacks are indexed collections which support very efficient `O(1)` addition and removal from the front using `unshift(v)` and `shift()`. + + extends Collection.Indexed`} /> + +For familiarity, Stack also provides `push(v)`, `pop()`, and `peek()`, but be aware that they also operate on the front of the list, unlike List or a JavaScript Array. + +Note: `reverse()` or any inherent reverse traversal (`reduceRight`, `lastIndexOf`, etc.) is not efficient with a Stack. + +Stack is implemented with a Single-Linked List. + +## Construction + + + +Create a new immutable Stack containing the values of the provided collection-like. + +(collection?: Iterable | ArrayLike): Stack`} +/> + +Note: `Stack` is a factory function and not a class, and does not use the `new` keyword during construction. + +## Static Methods + + + +True if the provided value is a Stack. + +`} +/> + + + +Creates a new Stack containing `values`. + +(...values: Array): Stack`} /> + +## Members + + + +The number of items in this Stack. + + + +## Reading values + + + +Alias for `Stack.first()`. + + + + + +Returns the value associated with the provided key, or notSetValue if the Collection does not contain this key. + +(key: number, notSetValue: NSV): T | NSV +get(key: number): T | undefined`} +/> + + + +True if a key exists within this Collection, using `Immutable.is` to determine equality. + + + + + +True if a value exists within this Collection, using `Immutable.is` to determine equality. + + + + + +Returns the first value in this Collection. + + + + + +Returns the last value in this Collection. + + + +## Persistent changes + + + +Returns a new Stack with 0 size and no values. + +`} /> + +Note: `clear` can be used in `withMutations`. + + + +Returns a new Stack with the provided `values` prepended, shifting other values ahead to higher indices. + +): Stack`} /> + +This is very efficient for Stack. + +Note: `unshift` can be used in `withMutations`. + + + +Like `Stack#unshift`, but accepts a collection rather than varargs. + +): Stack`} /> + +Note: `unshiftAll` can be used in `withMutations`. + + + +Returns a new Stack with a size ones less than this Stack, excluding the first item in this Stack, shifting all other values to a lower index. + +`} /> + +Note: this differs from `Array#shift` because it returns a new Stack rather than the removed value. Use `first()` or `peek()` to get the first value in this Stack. + +Note: `shift` can be used in `withMutations`. + + + +Alias for `Stack#unshift` and is not equivalent to `List#push`. + +): Stack`} /> + + + +Alias for `Stack#unshiftAll`. + +): Stack`} /> + + + +Alias for `Stack#shift` and is not equivalent to `List#pop`. + +`} /> + + + +Returns a new Stack with an updated value at `index` with the return value of calling `updater` with the existing value. + + T | undefined): this +update(updater: (value: this) => R): R`} +/> + +## Transient changes + + + +Note: Not all methods can be used on a mutable collection or within `withMutations`! Check the documentation for each method to see if it mentions being safe to use in `withMutations`. + + unknown): this`} /> + + + +Note: Not all methods can be used on a mutable collection or within `withMutations`! Check the documentation for each method to see if it mentions being safe to use in `withMutations`. + + + + + + + + + + + +## Sequence algorithms + + + +Returns a new Stack with other collections concatenated to this one. + +(...valuesOrCollections: Array | C>): Stack`} +/> + + + +Returns a new Stack with values passed through a `mapper` function. + +(mapper: (value: T, key: number, iter: this) => M, context?: unknown): Stack`} +/> + +Note: `map()` always returns a new instance, even if it produced the same value at every step. + + + +Flat-maps the Stack, returning a new Stack. + +Similar to `stack.map(...).flatten(true)`. + +(mapper: (value: T, key: number, iter: this) => Iterable, context?: unknown): Stack`} +/> + + + +Returns a new Set with only the values for which the `predicate` function returns true. + +(predicate: (value: T, index: number, iter: this) => value is F, context?: unknown): Set +filter(predicate: (value: T, index: number, iter: this) => unknown, context?: unknown): this`} +/> + +Note: `filter()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Stack with the values for which the `predicate` function returns false and another for which it returns true. + +(predicate: (this: C, value: T, index: number, iter: this) => value is F, context?: C): [Stack, Stack] +partition(predicate: (this: C, value: T, index: number, iter: this) => unknown, context?: C): [this, this]`} +/> + + + +Returns a Stack "zipped" with the provided collections. + +Like `zipWith`, but using the default `zipper`: creating an `Array`. + +(other: Collection): Stack<[T, U]> +zip(other: Collection, other2: Collection): Stack<[T, U, V]> +zip(...collections: Array>): Stack`} +/> + +Example: + +```js +const a = Stack([1, 2, 3]); +const b = Stack([4, 5, 6]); +const c = a.zip(b); // Stack [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ] +``` + + + +Returns a Stack "zipped" with the provided collections. + +Unlike `zip`, `zipAll` continues zipping until the longest collection is exhausted. Missing values from shorter collections are filled with `undefined`. + +(other: Collection): Stack<[T, U]> +zipAll(other: Collection, other2: Collection): Stack<[T, U, V]> +zipAll(...collections: Array>): Stack`} +/> + +Example: + +```js +const a = Stack([1, 2]); +const b = Stack([3, 4, 5]); +const c = a.zipAll(b); // Stack [ [ 1, 3 ], [ 2, 4 ], [ undefined, 5 ] ] +``` + +Note: Since zipAll will return a collection as large as the largest input, some results may contain undefined values. TypeScript cannot account for these without cases (as of v2.5). + + + +Returns a Stack "zipped" with the provided collections by using a custom `zipper` function. + +(zipper: (value: T, otherValue: U) => Z, otherCollection: Collection): Stack +zipWith(zipper: (value: T, otherValue: U, thirdValue: V) => Z, otherCollection: Collection, thirdCollection: Collection): Stack +zipWith(zipper: (...values: Array) => Z, ...collections: Array>): Stack`} +/> + +Example: + +```js +const a = Stack([1, 2, 3]); +const b = Stack([4, 5, 6]); +const c = a.zipWith((a, b) => a + b, b); +// Stack [ 5, 7, 9 ] +``` + +## Sequence algorithms + + + + + +Returns an iterator of this Stack. + +`} /> + + + +Returns a new Stack with only the values for which the `predicate` function returns false. + + boolean, context?: unknown): this`} +/> + +Note: `filterNot()` always returns a new instance, even if it results in not filtering out any values. + + + +Returns a new Stack with the order of the values reversed. + + + + + +Returns Stack of the same type which includes the same entries, stably sorted by using a comparator. + +): this`} /> + +If a comparator is not provided, a default comparator uses `<` and `>`. + +`comparator(valueA, valueB)`: + +- Returns `0` if the elements should not be swapped. +- Returns `-1` (or any negative number) if `valueA` comes before `valueB` +- Returns `1` (or any positive number) if `valueA` comes after `valueB` +- Alternatively, can return a value of the `PairSorting` enum type +- Is pure, i.e. it must always return the same value for the same pair of values. + +Note: `sort()` always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Like `sort`, but also accepts a `comparatorValueMapper` which allows for sorting by more sophisticated means. + +(comparatorValueMapper: (value: T, key: number, iter: this) => C, comparator?: Comparator): this`} +/> + +Note: `sortBy()` always returns a new instance, even if the original was already sorted. + +Note: This is always an eager operation. + + + +Returns a `Map` of `Stack`, grouped by the return value of the `grouper` function. + +(grouper: (value: T, key: number, iter: this) => G, context?: unknown): Map>`} +/> + +Note: This is not a lazy operation. + +## Conversion to JavaScript types + + + +Deeply converts this Stack to equivalent native JavaScript Array. + +>`} /> + + + +Shallowly converts this Stack to equivalent native JavaScript Array. + +`} /> + + + +Shallowly converts this collection to an Array. + +`} /> + + + +Shallowly converts this Stack to a JavaScript Object. + + + +## Conversion to Seq + + + +Returns a Seq.Indexed of the values of this Stack. + +`} /> + + + +If this is a collection of [key, value] entry tuples, it will return a Seq.Keyed of those entries. + +`} /> + + + +Returns a Seq.Keyed from this Stack where indices are treated as keys. + +`} /> + + + +Returns a Seq.Indexed of the values of this Stack, discarding keys. + +`} /> + + + +Returns a Seq.Set of the values of this Stack, discarding keys. + +`} /> + +## Combination + + + +Returns a new Stack with the separator inserted between each value in this Stack. + +`} /> + + + +Returns a new Stack with the values from each collection interleaved. + +>): Stack`} +/> + + + +Returns a new Stack by replacing a region of this Stack with new values. If values are not provided, it only skips the region to be removed. + +): Stack`} +/> + + + +Returns a new flattened Stack, optionally only flattening to a particular depth. + + +flatten(shallow?: boolean): Stack`} +/> + +## Search for value + + + +Returns the first index at which a given value can be found in the Stack, or -1 if it is not present. + + + + + +Returns the last index at which a given value can be found in the Stack, or -1 if it is not present. + + + + + +Returns the first index in the Stack where a value satisfies the provided predicate function. Otherwise -1 is returned. + + boolean, context?: unknown): number`} +/> + + + +Returns the last index in the Stack where a value satisfies the provided predicate function. Otherwise -1 is returned. + + boolean, context?: unknown): number`} +/> + + + +Returns the first value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): T | undefined`} +/> + + + +Returns the last value for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): T | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): [number, T] | undefined`} +/> + + + +Returns the last [key, value] entry for which the `predicate` returns true. + + boolean, context?: unknown, notSetValue?: T): [number, T] | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the first key for which the `predicate` returns true. + + boolean, context?: unknown): number | undefined`} +/> + + + +Returns the last key for which the `predicate` returns true. + + boolean, context?: unknown): number | undefined`} +/> + +Note: `predicate` will be called for each entry in reverse. + + + +Returns the key associated with the search value, or undefined. + + + + + +Returns the last key associated with the search value, or undefined. + + + + + +Returns the maximum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined`} /> + + + +Like `max`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +(comparatorValueMapper: (value: T, key: number, iter: this) => C, comparator?: Comparator): T | undefined`} +/> + + + +Returns the minimum value in this collection. If any values are comparatively equivalent, the first one found will be returned. + +): T | undefined`} /> + + + +Like `min`, but also accepts a `comparatorValueMapper` which allows for comparing by more sophisticated means. + +(comparatorValueMapper: (value: T, key: number, iter: this) => C, comparator?: Comparator): T | undefined`} +/> + +## Value equality + + + +True if this and the other Collection have value equality, as defined by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to allow for chained expressions. + + + +Computes and returns the hashed identity for this Collection. + + + +## Reading deep values + + + +Returns the value found by following a path of keys or indices through nested Collections. + +, notSetValue?: unknown): unknown`} +/> + + + +True if the result of following a path of keys or indices through nested Collections results in a set value. + +): boolean`} /> + +## Conversion to Collections + + + +Converts this Stack to a Map, Throws if keys are not hashable. + +`} /> + + + +Converts this Stack to a Map, maintaining the order of iteration. + +`} /> + + + +Converts this Stack to a Set, discarding keys. + +`} /> + + + +Converts this Stack to a Set, maintaining the order of iteration and discarding keys. + +`} /> + + + +Converts this Stack to a List, discarding keys. + +`} /> + + + +Returns itself. + +`} /> + +## Iterators + + + +An iterator of this Stack's keys. + +`} /> + + + +An iterator of this Stack's values. + +`} /> + + + +An iterator of this Stack's entries as [key, value] tuples. + +`} /> + +## Collections (Seq) + + + +Returns a new Seq.Indexed of the keys of this Stack, discarding values. + +`} /> + + + +Returns an Seq.Indexed of the values of this Stack, discarding keys. + +`} /> + + + +Returns a new Seq.Indexed of [key, value] tuples. + +`} /> + +## Side effects + + + +The `sideEffect` is executed for every entry in the Stack. + + unknown, context?: unknown): number`} +/> + +## Creating subsets + + + +Returns a new Stack representing a portion of this Stack from start up to but not including end. + +`} /> + + + +Returns a new Stack containing all entries except the first. + +`} /> + + + +Returns a new Stack containing all entries except the last. + +`} /> + + + +Returns a new Stack which excludes the first `amount` entries from this Stack. + +`} /> + + + +Returns a new Stack which excludes the last `amount` entries from this Stack. + +`} /> + + + +Returns a new Stack which includes entries starting from when `predicate` first returns false. + + boolean, context?: unknown): Stack`} +/> + + + +Returns a new Stack which includes entries starting from when `predicate` first returns true. + + boolean, context?: unknown): Stack`} +/> + + + +Returns a new Stack which includes the first `amount` entries from this Stack. + +`} /> + + + +Returns a new Stack which includes the last `amount` entries from this Stack. + +`} /> + + + +Returns a new Stack which includes entries from this Stack as long as the `predicate` returns true. + + boolean, context?: unknown): Stack`} +/> + + + +Returns a new Stack which includes entries from this Stack as long as the `predicate` returns false. + + boolean, context?: unknown): Stack`} +/> + +## Reducing a value + + + +Reduces the Stack to a value by calling the `reducer` for every entry in the Stack and passing along the reduced value. + +(reducer: (reduction: R, value: T, key: number, iter: this) => R, initialReduction: R, context?: unknown): R +reduce(reducer: (reduction: T | R, value: T, key: number, iter: this) => R): R`} +/> + + + +Reduces the Stack in reverse (from the right side). + +(reducer: (reduction: R, value: T, key: number, iter: this) => R, initialReduction: R, context?: unknown): R +reduceRight(reducer: (reduction: T | R, value: T, key: number, iter: this) => R): R`} +/> + + + +True if `predicate` returns true for all entries in the Stack. + + boolean, context?: unknown): boolean`} +/> + + + +True if `predicate` returns true for any entry in the Stack. + + boolean, context?: unknown): boolean`} +/> + + + +Joins values together as a string, inserting a separator between each. The default separator is `","`. + + + + + +Returns true if this Stack includes no values. + + + + + +Returns the size of this Stack. + + boolean, context?: unknown): number`} +/> + + + +Returns a `Map` of counts, grouped by the return value of the `grouper` function. + +(grouper: (value: T, key: number, iter: this) => G, context?: unknown): Map`} +/> + +## Comparison + + + +True if `iter` includes every value in this Stack. + +): boolean`} /> + + + +True if this Stack includes every value in `iter`. + +): boolean`} /> diff --git a/website/docs/ValueObject.mdx b/website/docs/ValueObject.mdx new file mode 100644 index 0000000000..e58cd247e9 --- /dev/null +++ b/website/docs/ValueObject.mdx @@ -0,0 +1,49 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# ValueObject + +The interface to fulfill to qualify as a Value Object. + +## Members + + + +True if this and the other Collection have value equality, as defined +by `Immutable.is()`. + + + +Note: This is equivalent to `Immutable.is(this, other)`, but provided to +allow for chained expressions. + + +Computes and returns the hashed identity for this Collection. + + + +The `hashCode` of a Collection is used to determine potential equality, +and is used when adding this to a `Set` or as a key in a `Map`, enabling +lookup via a different instance. + + + +Note: hashCode() MUST return a Uint32 number. The easiest way to +guarantee this is to return `myHash | 0` from a custom implementation. + +If two values have the same `hashCode`, they are [not guaranteed +to be equal][Hash Collision]. If two values have different `hashCode`s, +they must not be equal. + +Note: `hashCode()` is not guaranteed to always be called before +`equals()`. Most but not all Immutable.js collections use hash codes to +organize their internal data structures, while all Immutable.js +collections use equality during lookups. + +[Hash Collision]: https://en.wikipedia.org/wiki/Collision_(computer_science) diff --git a/website/docs/fromJS().mdx b/website/docs/fromJS().mdx new file mode 100644 index 0000000000..2d1d9504d7 --- /dev/null +++ b/website/docs/fromJS().mdx @@ -0,0 +1,80 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# fromJS() + +Deeply converts plain JS objects and arrays to Immutable Maps and Lists. + + unknown + ): Collection; +`} +/> + +`fromJS` will convert Arrays and [array-like objects][2] to a List, and +plain objects (without a custom prototype) to a Map. [Iterable objects][3] +may be converted to List, Map, or Set. + +If a `reviver` is optionally provided, it will be called with every +collection as a Seq (beginning with the most nested collections +and proceeding to the top-level collection itself), along with the key +referring to each collection and the parent JS object provided as `this`. +For the top level, object, the key will be `""`. This `reviver` is expected +to return a new Immutable Collection, allowing for custom conversions from +deep JS objects. Finally, a `path` is provided which is the sequence of +keys to this value from the starting value. + +`reviver` acts similarly to the [same parameter in `JSON.parse`][1]. + +If `reviver` is not provided, the default behavior will convert Objects +into Maps and Arrays into Lists like so: + +```js +import { fromJS, isKeyed } from 'immutable'; + +function (key, value) { + return isKeyed(value) ? value.toMap() : value.toList() +} +``` + +Accordingly, this example converts native JS data to OrderedMap and List: + +```js +import { fromJS, isKeyed } from 'immutable'; + +fromJS({ a: { b: [10, 20, 30] }, c: 40 }, function (key, value, path) { + console.log(key, value, path); + return isKeyed(value) ? value.toOrderedMap() : value.toList(); +}) > 'b', + [10, 20, 30], + ['a', 'b'] > 'a', + { b: [10, 20, 30] }, + ['a'] > '', + { a: { b: [10, 20, 30] }, c: 40 }, + []; +``` + +Keep in mind, when using JS objects to construct Immutable Maps, that +JavaScript Object properties are always strings, even if written in a +quote-less shorthand, while Immutable Maps accept keys of any type. + +```js +import { Map } from 'immutable'; + +let obj = { 1: 'one' }; +Object.keys(obj); // [ "1" ] +assert.equal(obj['1'], obj[1]); // "one" === "one" + +let map = Map(obj); +assert.notEqual(map.get('1'), map.get(1)); // "one" !== undefined +``` + +Property access for JavaScript Objects first converts the key to a string, +but since Immutable Map keys can be of any type the argument to `get()` is +not altered. + +[1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Example.3A_Using_the_reviver_parameter 'Using the reviver parameter' +[2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Indexed_collections#working_with_array-like_objects 'Working with array-like objects' +[3]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterable_protocol 'The iterable protocol' diff --git a/website/docs/get().mdx b/website/docs/get().mdx new file mode 100644 index 0000000000..508655840f --- /dev/null +++ b/website/docs/get().mdx @@ -0,0 +1,16 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# get() + +Returns the value within the provided collection associated with the provided key, or notSetValue if the key is not defined in the collection. + + + +A functional alternative to `collection.get(key)` which will also work on plain Objects and Arrays as an alternative for `collection[key]`. + + + + + + diff --git a/website/docs/getIn().mdx b/website/docs/getIn().mdx new file mode 100644 index 0000000000..9c71db59f1 --- /dev/null +++ b/website/docs/getIn().mdx @@ -0,0 +1,15 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# getIn() + +Returns the value at the provided key path starting at the provided collection, or notSetValue if the key path is not defined. + +A functional alternative to `collection.getIn(keypath)` which will also work with plain Objects and Arrays. + + + + + diff --git a/website/docs/has().mdx b/website/docs/has().mdx new file mode 100644 index 0000000000..92da8b77b6 --- /dev/null +++ b/website/docs/has().mdx @@ -0,0 +1,15 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# has() + +Returns true if the key is defined in the provided collection. + + + +A functional alternative to `collection.has(key)` which will also work with plain Objects and Arrays as an alternative for `collection.hasOwnProperty(key)`. + + + + + diff --git a/website/docs/hasIn().mdx b/website/docs/hasIn().mdx new file mode 100644 index 0000000000..cdea2910b9 --- /dev/null +++ b/website/docs/hasIn().mdx @@ -0,0 +1,13 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# hasIn() + +Returns true if the key path is defined in the provided collection. + +A functional alternative to `collection.hasIn(keypath)` which will also work with plain Objects and Arrays. + + + + + diff --git a/website/docs/hash().mdx b/website/docs/hash().mdx new file mode 100644 index 0000000000..36fe2b28cb --- /dev/null +++ b/website/docs/hash().mdx @@ -0,0 +1,27 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# hash() + +The `hash()` function is an important part of how Immutable determines if +two values are equivalent and is used to determine how to store those +values. Provided with any value, `hash()` will return a 31-bit integer. + + + +When designing Objects which may be equal, it's important that when a +`.equals()` method returns true, that both values `.hashCode()` method +return the same value. `hash()` may be used to produce those values. + +For non-Immutable Objects that do not provide a `.hashCode()` functions +(including plain Objects, plain Arrays, Date objects, etc), a unique hash +value will be created for each _instance_. That is, the create hash +represents referential equality, and not value equality for Objects. This +ensures that if that Object is mutated over time that its hash code will +remain consistent, allowing Objects to be used as keys and values in +Immutable.js collections. + +Note that `hash()` attempts to balance between speed and avoiding +collisions, however it makes no attempt to produce secure hashes. + +_New in Version 4.0_ diff --git a/website/docs/is().mdx b/website/docs/is().mdx new file mode 100644 index 0000000000..d663122105 --- /dev/null +++ b/website/docs/is().mdx @@ -0,0 +1,30 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# is() + +Value equality check with semantics similar to `Object.is`, but treats +Immutable `Collection`s as values, equal if the second `Collection` includes +equivalent values. + + + +It's used throughout Immutable when checking for equality, including `Map` +key equality and `Set` membership. + +```js +import { Map, is } from 'immutable'; + +const map1 = Map({ a: 1, b: 1, c: 1 }); +const map2 = Map({ a: 1, b: 1, c: 1 }); +assert.equal(map1 !== map2, true); +assert.equal(Object.is(map1, map2), false); +assert.equal(is(map1, map2), true); +``` + +`is()` compares primitive types like strings and numbers, Immutable.js +collections like `Map` and `List`, but also any custom object which +implements `ValueObject` by providing `equals()` and `hashCode()` methods. + +Note: Unlike `Object.is`, `Immutable.is` assumes `0` and `-0` are the same +value, matching the behavior of ES6 Map key equality. diff --git a/website/docs/isAssociative().mdx b/website/docs/isAssociative().mdx new file mode 100644 index 0000000000..6acbf1746b --- /dev/null +++ b/website/docs/isAssociative().mdx @@ -0,0 +1,19 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isAssociative() + +True if `maybeAssociative` is either a Keyed or Indexed Collection. + + + +```js +import { isAssociative, Map, List, Stack, Set } from 'immutable'; + +isAssociative([]); // false +isAssociative({}); // false +isAssociative(Map()); // true +isAssociative(List()); // true +isAssociative(Stack()); // true +isAssociative(Set()); // false +``` diff --git a/website/docs/isCollection().mdx b/website/docs/isCollection().mdx new file mode 100644 index 0000000000..70e0ff8398 --- /dev/null +++ b/website/docs/isCollection().mdx @@ -0,0 +1,18 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isCollection() + +True if `maybeCollection` is a Collection, or any of its subclasses. + + + +```js +import { isCollection, Map, List, Stack } from 'immutable'; + +isCollection([]); // false +isCollection({}); // false +isCollection(Map()); // true +isCollection(List()); // true +isCollection(Stack()); // true +``` diff --git a/website/docs/isImmutable().mdx b/website/docs/isImmutable().mdx new file mode 100644 index 0000000000..993ecaeacd --- /dev/null +++ b/website/docs/isImmutable().mdx @@ -0,0 +1,20 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isImmutable() + +True if `maybeImmutable` is an Immutable Collection or Record. + + + +Note: Still returns true even if the collections is within a `withMutations()`. + +```js +const { isImmutable, Map, List, Stack } = require('immutable'); +isImmutable([]); // false +isImmutable({}); // false +isImmutable(Map()); // true +isImmutable(List()); // true +isImmutable(Stack()); // true +isImmutable(Map().asMutable()); // true +``` diff --git a/website/docs/isIndexed().mdx b/website/docs/isIndexed().mdx new file mode 100644 index 0000000000..6fa794c39c --- /dev/null +++ b/website/docs/isIndexed().mdx @@ -0,0 +1,19 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isIndexed() + +True if `maybeIndexed` is a Collection.Indexed, or any of its subclasses. + + + +```js +import { isIndexed, Map, List, Stack, Set } from 'immutable'; + +isIndexed([]); // false +isIndexed({}); // false +isIndexed(Map()); // false +isIndexed(List()); // true +isIndexed(Stack()); // true +isIndexed(Set()); // false +``` diff --git a/website/docs/isKeyed().mdx b/website/docs/isKeyed().mdx new file mode 100644 index 0000000000..574f4a4d87 --- /dev/null +++ b/website/docs/isKeyed().mdx @@ -0,0 +1,17 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isKeyed() + +True if `maybeKeyed` is a Collection.Keyed, or any of its subclasses. + + + +```js +const { isKeyed, Map, List, Stack } = require('immutable'); +isKeyed([]); // false +isKeyed({}); // false +isKeyed(Map()); // true +isKeyed(List()); // false +isKeyed(Stack()); // false +``` diff --git a/website/docs/isList().mdx b/website/docs/isList().mdx new file mode 100644 index 0000000000..25c1980fc2 --- /dev/null +++ b/website/docs/isList().mdx @@ -0,0 +1,8 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isList() + +True if `maybeList` is a List. + + diff --git a/website/docs/isMap().mdx b/website/docs/isMap().mdx new file mode 100644 index 0000000000..90bc1e9b75 --- /dev/null +++ b/website/docs/isMap().mdx @@ -0,0 +1,10 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isMap() + +True if `maybeMap` is a Map. + + + +Also true for OrderedMaps. diff --git a/website/docs/isOrdered().mdx b/website/docs/isOrdered().mdx new file mode 100644 index 0000000000..6a5c54c502 --- /dev/null +++ b/website/docs/isOrdered().mdx @@ -0,0 +1,19 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isOrdered() + +True if `maybeOrdered` is a Collection where iteration order is well defined. True for Collection.Indexed as well as OrderedMap and OrderedSet. + + + +```js +import { isOrdered, Map, OrderedMap, List, Set } from 'immutable'; + +isOrdered([]); // false +isOrdered({}); // false +isOrdered(Map()); // false +isOrdered(OrderedMap()); // true +isOrdered(List()); // true +isOrdered(Set()); // false +``` diff --git a/website/docs/isOrderedMap().mdx b/website/docs/isOrderedMap().mdx new file mode 100644 index 0000000000..5adfeddd7c --- /dev/null +++ b/website/docs/isOrderedMap().mdx @@ -0,0 +1,8 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isOrderedMap() + +True if `maybeOrderedMap` is an OrderedMap. + + diff --git a/website/docs/isOrderedSet().mdx b/website/docs/isOrderedSet().mdx new file mode 100644 index 0000000000..99f4fa7e0e --- /dev/null +++ b/website/docs/isOrderedSet().mdx @@ -0,0 +1,8 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isOrderedSet() + +True if `maybeOrderedSet` is an OrderedSet. + + diff --git a/website/docs/isRecord().mdx b/website/docs/isRecord().mdx new file mode 100644 index 0000000000..1da196c1ff --- /dev/null +++ b/website/docs/isRecord().mdx @@ -0,0 +1,8 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isRecord() + +True if `maybeRecord` is a Record. + + diff --git a/website/docs/isSeq().mdx b/website/docs/isSeq().mdx new file mode 100644 index 0000000000..a0448edb65 --- /dev/null +++ b/website/docs/isSeq().mdx @@ -0,0 +1,8 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isSeq() + +True if `maybeSeq` is a Seq. + + diff --git a/website/docs/isSet().mdx b/website/docs/isSet().mdx new file mode 100644 index 0000000000..77a7bb2df6 --- /dev/null +++ b/website/docs/isSet().mdx @@ -0,0 +1,10 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isSet() + +True if `maybeSet` is a Set. + + + +Also true for OrderedSets. diff --git a/website/docs/isStack().mdx b/website/docs/isStack().mdx new file mode 100644 index 0000000000..03b2fbabbc --- /dev/null +++ b/website/docs/isStack().mdx @@ -0,0 +1,8 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isStack() + +True if `maybeStack` is a Stack. + + diff --git a/website/docs/isValueObject().mdx b/website/docs/isValueObject().mdx new file mode 100644 index 0000000000..4a9726f09b --- /dev/null +++ b/website/docs/isValueObject().mdx @@ -0,0 +1,10 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# isValueObject() + +True if `maybeValue` is a JavaScript Object which has _both_ `equals()` and `hashCode()` methods. + + + +Any two instances of value objects can be compared for value equality with `Immutable.is()` and can be used as keys in a `Map` or members in a `Set`. diff --git a/website/docs/merge().mdx b/website/docs/merge().mdx new file mode 100644 index 0000000000..f6020d9a9b --- /dev/null +++ b/website/docs/merge().mdx @@ -0,0 +1,17 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# merge() + +Returns a new collection with the provided collections merged in. + +A functional alternative to `collection.merge()` which will also work with plain Objects and Arrays + +(collection: C, ...collections: Array>): C;`} +/> + + diff --git a/website/docs/mergeDeep().mdx b/website/docs/mergeDeep().mdx new file mode 100644 index 0000000000..3a7b51006f --- /dev/null +++ b/website/docs/mergeDeep().mdx @@ -0,0 +1,26 @@ +import Repl from '@/repl/Repl.tsx'; + +# mergeDeep() + +Like [`merge()`](<../merge()>), but when two compatible collections are encountered with +the same key, it merges them as well, recursing deeply through the nested +data. Two collections are considered to be compatible (and thus will be +merged together) if they both fall into one of three categories: keyed +(e.g., [`Map`](../Map)s, [`Record`](../Record)s, and objects), indexed (e.g., [`List`](../List)s and +arrays), or set-like (e.g., [`Set`](../Set)s). If they fall into separate +categories, [`mergeDeep`](<../mergeDeep()>) will replace the existing collection with the +collection being merged in. This behavior can be customized by using +[`mergeDeepWith()`](<../mergeDeepWith()>). + + + +Note: Indexed and set-like collections are merged using +`concat()`/`union()` and therefore do not recurse. + +A functional alternative to `collection.mergeDeep()` which will also work +with plain Objects and Arrays. + + diff --git a/website/docs/mergeDeepWith().mdx b/website/docs/mergeDeepWith().mdx new file mode 100644 index 0000000000..2a613e1554 --- /dev/null +++ b/website/docs/mergeDeepWith().mdx @@ -0,0 +1,28 @@ +import Repl from '@/repl/Repl.tsx'; + +# mergeDeepWith() + +Like[`mergeDeep()`](<../mergeDeep()>), but when two non-collections or incompatible +collections are encountered at the same key, it uses the `merger` function +to determine the resulting value. Collections are considered incompatible +if they fall into separate categories between keyed, indexed, and set-like. + + any, + collection, + ...collections + )`} +/> + +A functional alternative to `collection.mergeDeepWith()` which will also +work with plain Objects and Arrays. + + oldVal + newVal, + original, + { x: { y: 456 }} +)`} +/> diff --git a/website/docs/mergeWith().mdx b/website/docs/mergeWith().mdx new file mode 100644 index 0000000000..a0334efafd --- /dev/null +++ b/website/docs/mergeWith().mdx @@ -0,0 +1,17 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# mergeWith() + +Returns a copy of the collection with the remaining collections merged in, calling the `merger` function whenever an existing value is encountered. + +A functional alternative to `collection.mergeWith()` which will also work with plain Objects and Arrays. + + oldVal + newVal, + original, + { y: 789, z: 'abc' } +)`} +/> diff --git a/website/docs/remove().mdx b/website/docs/remove().mdx new file mode 100644 index 0000000000..b61fb9881d --- /dev/null +++ b/website/docs/remove().mdx @@ -0,0 +1,20 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# remove() + +Returns a copy of the collection with the value at key removed. + + + +A functional alternative to `collection.remove(key)` which will also work with plain Objects and Arrays as an alternative for `delete collectionCopy[key]`. + + + + diff --git a/website/docs/removeIn().mdx b/website/docs/removeIn().mdx new file mode 100644 index 0000000000..f0be9558e4 --- /dev/null +++ b/website/docs/removeIn().mdx @@ -0,0 +1,15 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# removeIn() + +Returns a copy of the collection with the value at the key path removed. + +A functional alternative to `collection.removeIn(keypath)` which will also work with plain Objects and Arrays. + + + + diff --git a/website/docs/set().mdx b/website/docs/set().mdx new file mode 100644 index 0000000000..cd73154eb6 --- /dev/null +++ b/website/docs/set().mdx @@ -0,0 +1,20 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# set() + +Returns a copy of the collection with the value at key set to the provided value. + +A functional alternative to `collection.set(key, value)` which will also work with plain Objects and Arrays as an alternative for `collectionCopy[key] = value`. + + + + + + diff --git a/website/docs/setIn().mdx b/website/docs/setIn().mdx new file mode 100644 index 0000000000..f5093948fd --- /dev/null +++ b/website/docs/setIn().mdx @@ -0,0 +1,15 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# setIn() + +Returns a copy of the collection with the value at the key path set to the provided value. + +A functional alternative to `collection.setIn(keypath)` which will also work with plain Objects and Arrays. + + + + diff --git a/website/docs/update().mdx b/website/docs/update().mdx new file mode 100644 index 0000000000..0d85809e4e --- /dev/null +++ b/website/docs/update().mdx @@ -0,0 +1,20 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# update() + +Returns a copy of the collection with the value at key set to the result of providing the existing value to the updating function. + +A functional alternative to `collection.update(key, fn)` which will also work with plain Objects and Arrays as an alternative for `collectionCopy[key] = fn(collection[key])`. + + + + val.toUpperCase()); // [ 'dog', 'FROG', 'cat' ]`} +/> + + val * 6); // { x: 738, y: 456 }`} +/> diff --git a/website/docs/updateIn().mdx b/website/docs/updateIn().mdx new file mode 100644 index 0000000000..fe5a07e351 --- /dev/null +++ b/website/docs/updateIn().mdx @@ -0,0 +1,12 @@ +import Repl from '@/repl/Repl.tsx'; +import CodeLink from '@/mdx-components/CodeLink.tsx'; + +# updateIn() + +Returns a copy of the collection with the value at the key path set to the result of providing the existing value to the updating function. + +A functional alternative to `collection.updateIn(keypath, fn)` which will also work with plain Objects and Arrays. + + any): C;`} +/> diff --git a/website/next-env.d.ts b/website/next-env.d.ts new file mode 100644 index 0000000000..1b3be0840f --- /dev/null +++ b/website/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/website/next-sitemap.config.js b/website/next-sitemap.config.js new file mode 100644 index 0000000000..e4cc9ee5dd --- /dev/null +++ b/website/next-sitemap.config.js @@ -0,0 +1,16 @@ +// eslint-disable-next-line @typescript-eslint/no-require-imports, no-undef +const { getVersions } = require('./src/static/getVersions'); + +/** @type {import('next-sitemap').IConfig} */ +// eslint-disable-next-line no-undef +module.exports = { + siteUrl: 'https://immutable-js.com', + generateRobotsTxt: true, + outDir: './out', + exclude: [ + '/docs', + ...getVersions() + .slice(1) + .map((version) => `/docs/${version}/*`), + ], +}; diff --git a/website/next.config.mjs b/website/next.config.mjs new file mode 100644 index 0000000000..a25be9ea0c --- /dev/null +++ b/website/next.config.mjs @@ -0,0 +1,18 @@ +import createMDX from '@next/mdx'; + +/** @type {import('next').NextConfig} */ +const nextConfig = { + // Configure `pageExtensions` to include markdown and MDX files + pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'], + + reactStrictMode: true, + trailingSlash: true, + output: 'export', +}; + +const withMDX = createMDX({ + // Add markdown plugins here, as desired +}); + +// Merge MDX config with Next.js config +export default withMDX(nextConfig); diff --git a/website/public/Immutable-Data-and-React-YouTube.png b/website/public/Immutable-Data-and-React-YouTube.png new file mode 100644 index 0000000000..fd5354bd80 Binary files /dev/null and b/website/public/Immutable-Data-and-React-YouTube.png differ diff --git a/pages/src/static/favicon.png b/website/public/favicon.png similarity index 100% rename from pages/src/static/favicon.png rename to website/public/favicon.png diff --git a/website/src/ArrowDown.tsx b/website/src/ArrowDown.tsx new file mode 100644 index 0000000000..662f63466c --- /dev/null +++ b/website/src/ArrowDown.tsx @@ -0,0 +1,31 @@ +import type { JSX } from 'react'; + +export function ArrowDown({ isActive }: { isActive: boolean }): JSX.Element { + return ( + + + + + + ); +} diff --git a/website/src/Defs.tsx b/website/src/Defs.tsx new file mode 100644 index 0000000000..a8a464643d --- /dev/null +++ b/website/src/Defs.tsx @@ -0,0 +1,428 @@ +import type { FocusEvent, JSX, MouseEvent, ReactNode } from 'react'; +import { Fragment, useCallback, useState } from 'react'; +import Link from 'next/link'; +import { + TypeKind, + Type, + InterfaceDefinition, + ObjectMember, + CallSignature, + CallParam, +} from './TypeDefs'; + +export function InterfaceDef({ + name, + def, +}: { + name: string; + def: InterfaceDefinition; +}) { + return ( + + type + {name} + {def.typeParams && ( + <> + {'<'} + {interpose( + ', ', + def.typeParams.map((t, i) => ( + + {t} + + )) + )} + {'>'} + + )} + {def.extends && ( + <> + extends + {interpose( + ', ', + def.extends.map((e, i) => ) + )} + + )} + {def.implements && ( + <> + implements + {interpose( + ', ', + def.implements.map((e, i) => ) + )} + + )} + + ); +} + +export function CallSigDef({ + name, + callSig, +}: { + name: string; + callSig?: CallSignature; +}) { + const shouldWrap = callSigLength(name, callSig) > 80; + + return ( + + {name} + {callSig?.typeParams && ( + <> + {'<'} + {interpose( + ', ', + callSig.typeParams.map((t, i) => ( + + {t} + + )) + )} + {'>'} + + )} + {'('} + {callSig && functionParams(callSig.params, shouldWrap)} + {')'} + {callSig?.type && ( + <> + {': '} + + + )} + + ); +} + +export function TypeDef({ type, prefix }: { type: Type; prefix?: number }) { + switch (type.k) { + case TypeKind.Never: + return wrap('primitive', 'never'); + case TypeKind.Any: + return wrap('primitive', 'any'); + case TypeKind.Unknown: + return wrap('primitive', 'unknown'); + case TypeKind.This: + return wrap('primitive', 'this'); + case TypeKind.Undefined: + return wrap('primitive', 'undefined'); + case TypeKind.Boolean: + return wrap('primitive', 'boolean'); + case TypeKind.Number: + return wrap('primitive', 'number'); + case TypeKind.String: + return wrap('primitive', 'string'); + case TypeKind.Union: + return wrap( + 'union', + interpose( + ' | ', + type.types.map((t, i) => ) + ) + ); + case TypeKind.Intersection: + return wrap( + 'intersection', + interpose( + ' & ', + type.types.map((t, i) => ) + ) + ); + case TypeKind.Tuple: + return wrap( + 'tuple', + <> + {'['} + {interpose( + ', ', + type.types.map((t, i) => ) + )} + {']'} + + ); + case TypeKind.Object: + if (!type.members) { + return wrap('primitive', 'object'); + } + return wrap( + 'object', + <> + {'{'} + {interpose( + ', ', + type.members.map((t, i) => ) + )} + {'}'} + + ); + case TypeKind.Indexed: + return wrap( + 'indexed', + <> + ,{'['} + + {']'} + + ); + case TypeKind.Operator: + return wrap( + 'operator', + <> + {wrap('primitive', type.operator)} + + ); + case TypeKind.Array: + return wrap( + 'array', + <> + + {'[]'} + + ); + case TypeKind.Function: { + const shouldWrap = (prefix || 0) + funcLength(type) > 78; + return wrap( + 'function', + <> + {type.typeParams && ( + <> + {'<'} + {interpose( + ', ', + type.typeParams.map((t, i) => ( + + {t} + + )) + )} + {'>'} + + )} + {'('} + {functionParams(type.params, shouldWrap)} + {') => '} + + + ); + } + case TypeKind.Param: + return wrap('typeParam', type.param); + case TypeKind.Type: { + return wrap( + 'type', + <> + {type.url ? ( + + {type.name} + + ) : ( + {type.name} + )} + {type.args && ( + <> + {'<'} + {interpose( + ', ', + type.args.map((a, i) => ) + )} + {'>'} + + )} + + ); + } + } + throw new Error('Type with unknown kind ' + JSON.stringify(type)); +} + +function wrap(className: string, child: ReactNode) { + return {child}; +} + +function Hover({ + className, + children, +}: { + className?: string; + children: ReactNode; +}) { + const [isOver, setIsOver] = useState(false); + const mouseOver = useCallback( + (event: MouseEvent | FocusEvent) => { + event.stopPropagation(); + setIsOver(true); + }, + [setIsOver] + ); + const mouseOut = useCallback(() => { + setIsOver(false); + }, [setIsOver]); + return ( + + {children} + + ); +} + +export function MemberDef({ member }: { member: ObjectMember }) { + return ( + + {member.index ? ( + <>[{functionParams(member.params, false)}] + ) : ( + {member.name} + )} + {member.type && ( + <> + : + + )} + + ); +} + +function functionParams( + params: Array | undefined, + shouldWrap: boolean +) { + const elements = interpose( + shouldWrap ? ( + <> + {','} +
+ + ) : ( + ', ' + ), + (params ?? []).map((t, i) => ( + + {t.varArgs ? '...' : null} + {t.name} + {t.optional ? '?: ' : ': '} + + + )) + ); + + return shouldWrap ? ( +
{elements}
+ ) : ( + elements + ); +} + +function callSigLength(name: string, sig?: CallSignature): number { + return name.length + (sig ? funcLength(sig) : 2); +} + +function funcLength(sig: CallSignature): number { + return ( + (sig.typeParams ? 2 + sig.typeParams.join(', ').length : 0) + + 2 + + (sig.params ? paramLength(sig.params) : 0) + + (sig.type ? 2 + typeLength(sig.type) : 0) + ); +} + +function paramLength(params: Array): number { + return params.reduce( + (s, p) => + s + + (p.varArgs ? 3 : 0) + + p.name.length + + (p.optional ? 3 : 2) + + typeLength(p.type), + (params.length - 1) * 2 + ); +} + +function memberLength(members: Array): number { + return members.reduce( + (s, m) => + s + + (m.index ? paramLength(m.params || []) + 2 : m.name!.length) + + (m.type ? typeLength(m.type) + 2 : 0), + (members.length - 1) * 2 + ); +} + +function typeLength(type: Type): number { + if (!type) { + throw new Error('Expected type'); + } + switch (type.k) { + case TypeKind.Never: + return 5; + case TypeKind.Any: + return 3; + case TypeKind.Unknown: + return 7; + case TypeKind.This: + return 4; + case TypeKind.Undefined: + return 9; + case TypeKind.Boolean: + return 7; + case TypeKind.Number: + return 6; + case TypeKind.String: + return 6; + case TypeKind.Union: + case TypeKind.Intersection: + return ( + type.types.reduce((s, t) => s + typeLength(t), 0) + + (type.types.length - 1) * 3 + ); + case TypeKind.Tuple: + return ( + 2 + + type.types.reduce((s, t) => s + typeLength(t), 0) + + (type.types.length - 1) * 2 + ); + case TypeKind.Object: + return type.members ? 2 + memberLength(type.members) : 6; + case TypeKind.Indexed: + return 2 + typeLength(type.type) + typeLength(type.index); + case TypeKind.Operator: + return 1 + type.operator.length + typeLength(type.type); + case TypeKind.Array: + return typeLength(type.type) + 2; + case TypeKind.Function: + return 2 + funcLength(type); + case TypeKind.Param: + return type.param.length; + case TypeKind.Type: + return ( + type.name.length + + (!type.args + ? 0 + : type.args.reduce((s, a) => s + typeLength(a), type.args.length * 2)) + ); + } + throw new Error('Type with unknown kind ' + JSON.stringify(type)); +} + +function interpose( + between: ReactNode, + array: Array +): Array { + const result: Array = []; + let i = 0; + for (const value of array) { + result.push(value, {between}); + } + result.pop(); + + return result; +} diff --git a/website/src/DocHeader.tsx b/website/src/DocHeader.tsx new file mode 100644 index 0000000000..b57499a864 --- /dev/null +++ b/website/src/DocHeader.tsx @@ -0,0 +1,20 @@ +import { HeaderLinks, HeaderLogoLink } from './Header'; + +export function DocHeader({ + versions, + currentVersion, +}: { + versions: Array; + currentVersion?: string; +}) { + return ( +
+
+
+ + +
+
+
+ ); +} diff --git a/website/src/DocOverview.tsx b/website/src/DocOverview.tsx new file mode 100644 index 0000000000..71a62ce155 --- /dev/null +++ b/website/src/DocOverview.tsx @@ -0,0 +1,57 @@ +import Link from 'next/link'; +import { MarkdownContent } from './MarkdownContent'; +import type { TypeDefs, TypeDoc } from './TypeDefs'; + +export type OverviewData = { + doc: TypeDoc | null; + api: Array; +}; + +type APIMember = { + label: string; + url: string; + synopsis?: string; +}; + +// Static use only +export function getOverviewData(defs: TypeDefs): OverviewData { + return { + doc: defs.doc || null, + api: Object.values(defs.types).map((def) => { + const member: APIMember = { label: def.label, url: def.url }; + const doc = def.doc || def.call?.doc; + if (doc?.synopsis) { + member.synopsis = doc?.synopsis; + } + return member; + }), + }; +} + +export function DocOverview({ data }: { data: OverviewData }) { + return ( +
+ {data.doc && ( +
+ + {data.doc.description && ( + + )} +
+ )} + +

API

+ + {data.api.map((member) => ( +
+

+ {member.label} +

+ {member.synopsis && ( + + )} +
+ ))} +
+ ); +} diff --git a/website/src/DocSearch.tsx b/website/src/DocSearch.tsx new file mode 100644 index 0000000000..82e07cf313 --- /dev/null +++ b/website/src/DocSearch.tsx @@ -0,0 +1,53 @@ +'use client'; + +import { useEffect, useState } from 'react'; + +export function DocSearch() { + const [enabled, setEnabled] = useState(null); + + useEffect(() => { + const script = document.createElement('script'); + const firstScript = document.getElementsByTagName('script')[0]; + script.src = + 'https://cdn.jsdelivr.net/npm/docsearch.js@2.5.2/dist/cdn/docsearch.min.js'; + script.addEventListener( + 'load', + () => { + // Initialize Algolia search. + // @ts-expect-error -- algolia is set on windows, need proper type + if (window.docsearch) { + // @ts-expect-error -- algolia is set on windows, need proper type + window.docsearch({ + apiKey: '83f61f865ef4cb682e0432410c2f7809', + indexName: 'immutable_js', + inputSelector: '#algolia-docsearch', + }); + setEnabled(true); + } else { + setEnabled(false); + } + }, + false + ); + firstScript?.parentNode?.insertBefore(script, firstScript); + + const link = document.createElement('link'); + const firstLink = document.getElementsByTagName('link')[0]; + link.rel = 'stylesheet'; + link.href = + 'https://cdn.jsdelivr.net/npm/docsearch.js@2.5.2/dist/cdn/docsearch.min.css'; + firstLink?.parentNode?.insertBefore(link, firstLink); + }, []); + + if (enabled === false) return null; + + return ( + + ); +} diff --git a/website/src/Header.tsx b/website/src/Header.tsx new file mode 100644 index 0000000000..b8e8b67d9e --- /dev/null +++ b/website/src/Header.tsx @@ -0,0 +1,198 @@ +'use client'; + +import { useState, useEffect } from 'react'; +import Link from 'next/link'; + +import { SVGSet } from './SVGSet'; +import { Logo } from './Logo'; +import { StarBtn } from './StarBtn'; +import { isMobile } from './isMobile'; + +export function Header({ + versions, + currentVersion, +}: { + versions: Array; + currentVersion?: string; +}) { + const [scroll, setScroll] = useState(0); + + useEffect(() => { + let _pending = false; + function handleScroll() { + if (!_pending) { + const headerHeight = Math.min( + 800, + Math.max(260, document.documentElement.clientHeight * 0.7) + ); + if (window.scrollY < headerHeight) { + _pending = true; + window.requestAnimationFrame(() => { + _pending = false; + setScroll(window.scrollY); + }); + } + } + } + + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); + + const neg = scroll < 0; + const s = neg ? 0 : scroll; + const sp = isMobile() ? 35 : 70; + + return ( +
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+ {[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0].map((_, i) => ( + + + + + ))} + + + + +
+
+
+ +
+
+
+
+
+ ); +} + +export function HeaderLogoLink() { + return ( + + + + + + + ); +} + +export function HeaderLinks({ + versions, + currentVersion, +}: { + versions: Array; + currentVersion?: string; +}) { + return ( +
+ ); +} + +function DocsDropdown({ + versions, + currentVersion, +}: { + versions: Array; + currentVersion?: string; +}) { + return ( +
+ +
+ + Docs{currentVersion && ` (${currentVersion})`} + +
+
    + {versions.map((v) => ( +
  • + {v} +
  • + ))} +
+
+ ); +} + +function ty(s: number, p: number) { + return (p < s ? p : s) * -0.55; +} + +function o(s: number, p: number) { + return Math.max(0, s > p ? 1 - (s - p) / 350 : 1); +} + +function tz(s: number, p: number) { + return Math.max(0, s > p ? 1 - (s - p) / 20000 : 1); +} + +function t(y: number, z: number) { + return { transform: 'translate3d(0, ' + y + 'px, 0) scale(' + z + ')' }; +} diff --git a/website/src/ImmutableConsole.tsx b/website/src/ImmutableConsole.tsx new file mode 100644 index 0000000000..4875a22058 --- /dev/null +++ b/website/src/ImmutableConsole.tsx @@ -0,0 +1,69 @@ +'use client'; + +import { useEffect } from 'react'; + +type InstallSpace = { + Immutable?: unknown; + module?: unknown; + exports?: unknown; +}; + +let installingVersion: string | undefined; + +export function ImmutableConsole({ version }: { version: string }) { + useEffect(() => { + const installSpace = global as unknown as InstallSpace; + if (installingVersion === version) { + return; + } + installingVersion = version; + installUMD(installSpace, getSourceURL(version)).then((Immutable) => { + installSpace.Immutable = Immutable; + + console.log( + '\n' + + ' ▄▟████▙▄ _ __ __ __ __ _ _ _______ ____ _ _____ \n' + + ' ▟██████████▙ | | | \\ / | \\ / | | | |__ __|/\\ | _ \\| | | ___|\n' + + '██████████████ | | | \\/ | \\/ | | | | | | / \\ | |_) | | | |__ \n' + + '██████████████ | | | |\\ /| | |\\ /| | | | | | | / /\\ \\ | _ <| | | __| \n' + + ' ▜██████████▛ | | | | \\/ | | | \\/ | | |__| | | |/ ____ \\| |_) | |___| |___ \n' + + ' ▀▜████▛▀ |_| |_| |_|_| |_|\\____/ |_/_/ \\_\\____/|_____|_____|\n' + + '\n' + + `Version: ${version}\n` + + '> console.log(Immutable);' + ); + console.log(Immutable); + }); + }, [version]); + return null; +} + +function getSourceURL(version: string) { + if (version === 'latest@main') { + return `https://cdn.jsdelivr.net/gh/immutable-js/immutable-js@npm/dist/immutable.js`; + } + const semver = version[0] === 'v' ? version.slice(1) : version; + return `https://cdn.jsdelivr.net/npm/immutable@${semver}/dist/immutable.js`; +} + +function installUMD(installSpace: InstallSpace, src: string): Promise { + return new Promise((resolve) => { + const installedModule = (installSpace.module = { + exports: (installSpace.exports = {}), + }); + const script = document.createElement('script'); + const firstScript = document.getElementsByTagName('script')[0]; + script.src = src; + script.addEventListener( + 'load', + () => { + installSpace.module = undefined; + installSpace.exports = undefined; + script.remove(); + resolve(installedModule.exports); + }, + false + ); + firstScript?.parentNode?.insertBefore(script, firstScript); + }); +} diff --git a/website/src/Logo.tsx b/website/src/Logo.tsx new file mode 100644 index 0000000000..b9c0bb5e7c --- /dev/null +++ b/website/src/Logo.tsx @@ -0,0 +1,74 @@ +type Props = { + opacity?: number; + inline?: boolean; + color: string; +}; + +export function Logo({ opacity = 1, inline, color }: Props) { + return !inline ? ( + + + + + + + + + + + + ) : ( + + + + + + + + + + + + ); +} diff --git a/website/src/MarkdownContent.tsx b/website/src/MarkdownContent.tsx new file mode 100644 index 0000000000..7f90fca400 --- /dev/null +++ b/website/src/MarkdownContent.tsx @@ -0,0 +1,33 @@ +'use client'; + +import { memo, MouseEvent } from 'react'; +import { useRouter } from 'next/navigation'; + +type Props = { + contents: string; + className?: string; +}; + +// eslint-disable-next-line prefer-arrow-callback +export const MarkdownContent = memo(function MarkdownContent({ + contents, + className, +}) { + const router = useRouter(); + + const handleClick = (event: MouseEvent) => { + const link = event.target as HTMLAnchorElement; + if (link.tagName === 'A' && link.target !== '_blank') { + event.preventDefault(); + router.push(link.href); + } + }; + + return ( +
+ ); +}); diff --git a/website/src/MemberDoc.tsx b/website/src/MemberDoc.tsx new file mode 100644 index 0000000000..7d36ff2c52 --- /dev/null +++ b/website/src/MemberDoc.tsx @@ -0,0 +1,100 @@ +import Link from 'next/link'; +import { Fragment } from 'react'; +import { CallSigDef, MemberDef } from './Defs'; +import { MarkdownContent } from './MarkdownContent'; +import type { MemberDefinition } from './TypeDefs'; + +export function MemberDoc({ member }: { member: MemberDefinition }) { + return ( +
+

+ {member.label} +

+
+ {member.doc && ( + + )} + {!member.signatures ? ( + + + + ) : ( + + {member.signatures.map((callSig, i) => ( + + + {'\n'} + + ))} + + )} + {member.inherited && ( +
+

Inherited from

+ + + {member.inherited.interface}#{member.inherited.label} + + +
+ )} + {member.overrides && ( +
+

Overrides

+ + + {member.overrides.interface}#{member.overrides.label} + + +
+ )} + {member.doc?.notes.map((note, i) => ( +
+

{note.name}

+ {note.name === 'alias' ? ( + + + + ) : ( + + )} +
+ ))} + {member.doc?.description && ( +
+

+ {member.doc.description.slice(0, 5) === ' + +

+ )} +
+
+ ); +} + +// export type ParamTypeMap = { [param: string]: Type }; + +// function getParamTypeMap( +// interfaceDef: InterfaceDefinition | undefined, +// member: MemberDefinition +// ): ParamTypeMap | undefined { +// if (!member.inherited || !interfaceDef?.typeParamsMap) return; +// const defining = member.inherited.split('#')[0] + '>'; +// const paramTypeMap: ParamTypeMap = {}; +// // Filter typeParamsMap down to only those relevant to the defining interface. +// for (const [path, type] of Object.entries(interfaceDef.typeParamsMap)) { +// if (path.startsWith(defining)) { +// paramTypeMap[path.slice(defining.length)] = type; +// } +// } +// return paramTypeMap; +// } diff --git a/website/src/SVGSet.tsx b/website/src/SVGSet.tsx new file mode 100644 index 0000000000..721aa6d978 --- /dev/null +++ b/website/src/SVGSet.tsx @@ -0,0 +1,15 @@ +import type { CSSProperties, ReactNode } from 'react'; + +export function SVGSet({ + style, + children, +}: { + style?: CSSProperties; + children: ReactNode; +}) { + return ( + + {children} + + ); +} diff --git a/website/src/Sidebar.tsx b/website/src/Sidebar.tsx new file mode 100644 index 0000000000..d7d41f660f --- /dev/null +++ b/website/src/Sidebar.tsx @@ -0,0 +1,183 @@ +'use client'; + +import Link from 'next/link'; +import { Fragment, useEffect, useState } from 'react'; +import type { TypeDefinition } from './TypeDefs'; +import { collectMemberGroups } from './collectMemberGroups'; +import { ArrowDown } from './ArrowDown'; +import { SIDEBAR_LINKS } from './app/docs/currentVersion'; + +export type SidebarLinks = Array<{ label: string; url: string }>; + +function Links({ + links, + focus, + showInGroups, + showInherited, +}: { + links: SidebarLinks; + focus?: TypeDefinition; + showInGroups?: boolean; + showInherited?: boolean; +}) { + const [isForcedClosed, setIsForcedClosed] = useState(false); + useEffect(() => { + setIsForcedClosed(false); + }, [focus?.label]); + + return ( +
+

Immutable.js

+ {links.map((link) => { + const isCurrent = focus?.label === link.label; + const isActive = isCurrent && !isForcedClosed; + return ( + +
+ { + if (isCurrent) { + e.preventDefault(); + setIsForcedClosed(!isForcedClosed); + } + }} + > + {link.label} + {isActive && (focus?.interface || focus?.functions) && ( + <> + {' '} + + + )} + +
+ + {isActive && ( + + )} +
+ ); + })} +
+ ); +} + +function Focus({ + focus, + showInGroups, + showInherited, +}: { + focus?: TypeDefinition; + showInGroups?: boolean; + showInherited?: boolean; +}) { + if (!focus || (!focus.interface && !focus.functions)) { + return null; + } + + return ( +
+ {focus.call && ( +
+

Construction

+
+ {focus.call.label} +
+
+ )} + + {focus.functions && ( +
+

Static Methods

+ {Object.values(focus.functions).map((fn) => ( +
+ {fn.label} +
+ ))} +
+ )} + +
+ {collectMemberGroups( + focus.interface, + showInGroups, + showInherited + ).flatMap(([title, groupMembers]) => + groupMembers.length === 0 + ? null + : [ +

+ {title || 'Members'} +

, + groupMembers.map((member) => ( +
+ {member.label} +
+ )), + ] + )} +
+
+ ); +} + +export function SideBar({ + links = SIDEBAR_LINKS, + focus, + toggleShowInherited, + toggleShowInGroups, + showInherited, + showInGroups, +}: { + links?: SidebarLinks; + focus?: TypeDefinition; + toggleShowInherited?: () => void; + toggleShowInGroups?: () => void; + showInherited?: boolean; + showInGroups?: boolean; +}) { + return ( +
+
+
+ {toggleShowInherited && toggleShowInGroups && ( +
+
+ + Grouped + + {' • '} + + Alphabetized + +
+
+ + Inherited + + {' • '} + + Defined + +
+
+ )} + +
+
+ ); +} diff --git a/website/src/StarBtn.tsx b/website/src/StarBtn.tsx new file mode 100644 index 0000000000..1ec8e1c6a9 --- /dev/null +++ b/website/src/StarBtn.tsx @@ -0,0 +1,203 @@ +import { useEffect, useState } from 'react'; + +// API endpoints +// https://registry.npmjs.org/immutable/latest +// https://api.github.com/repos/immutable-js/immutable-js + +export function StarBtn() { + const [stars, setStars] = useState(null); + + useEffect(() => { + loadJSON( + 'https://api.github.com/repos/immutable-js/immutable-js', + (value) => { + if ( + typeof value === 'object' && + value !== null && + 'stargazers_count' in value && + typeof value.stargazers_count === 'number' + ) { + setStars(value.stargazers_count); + } + } + ); + }, []); + + return ( + + + + + Star + + {stars && } + {stars && ( + + {stars} + + )} + + ); +} + +function loadJSON(url: string, then: (value: unknown) => void) { + const oReq = new XMLHttpRequest(); + oReq.onload = (event) => { + if ( + !event.target || + !('responseText' in event.target) || + typeof event.target.responseText !== 'string' + ) { + return null; + } + + let json; + try { + json = JSON.parse(event.target.responseText); + // eslint-disable-next-line @typescript-eslint/no-unused-vars -- TODO enable eslint here + } catch (e) { + // ignore error + } + then(json); + }; + oReq.open('get', url, true); + oReq.send(); +} diff --git a/website/src/TypeDefs.ts b/website/src/TypeDefs.ts new file mode 100644 index 0000000000..0646f92f0b --- /dev/null +++ b/website/src/TypeDefs.ts @@ -0,0 +1,153 @@ +export type TypeDefs = { + version: string; + doc?: TypeDoc; + types: { [name: string]: TypeDefinition }; +}; + +export type TypeDefinition = { + qualifiedName: string; + label: string; // Like a name, but with () for callables. + url: string; + doc?: TypeDoc; + call?: MemberDefinition; + functions?: { [name: string]: MemberDefinition }; + interface?: InterfaceDefinition; +}; + +export type MemberDefinition = { + line: number; + name: string; + label: string; // Like a name, but with () for callables. + url: string; + id: string; // Local reference on a page + group?: string; + doc?: TypeDoc; + isStatic?: boolean; + inherited?: { interface: string; label: string; url: string }; + overrides?: { interface: string; label: string; url: string }; + signatures?: Array; + type?: Type; +}; + +export type CallSignature = { + line?: number; + typeParams?: Array; + params?: Array; + type?: Type; +}; + +export type CallParam = { + name: string; + type: Type; + varArgs?: boolean; + optional?: boolean; +}; + +export type InterfaceDefinition = { + doc?: TypeDoc; + line?: number; + typeParams?: Array; + extends?: Array; + implements?: Array; + members: { [name: string]: MemberDefinition }; +}; + +export type MemberGroup = { + title?: string; + members: { [name: string]: MemberDefinition }; +}; + +export type TypeDoc = { + synopsis: string; + notes: Array; + description: string; +}; + +type TypeDocNote = { name: string; body: string }; + +export enum TypeKind { + Never, + Any, + Unknown, + This, + + Undefined, + Boolean, + Number, + String, + + Object, + Array, + Function, + Param, + Type, + + Union, + Intersection, + Tuple, + Indexed, + Operator, +} + +export type Type = + | NeverType + | AnyType + | UnknownType + | ThisType + | UndefinedType + | BooleanType + | NumberType + | StringType + | UnionType + | IntersectionType + | TupleType + | ObjectType + | ArrayType + | FunctionType + | ParamType + | NamedType + | IndexedType + | OperatorType; + +type NeverType = { k: TypeKind.Never }; +type AnyType = { k: TypeKind.Any }; +type UnknownType = { k: TypeKind.Unknown }; +type ThisType = { k: TypeKind.This }; + +type UndefinedType = { k: TypeKind.Undefined }; +type BooleanType = { k: TypeKind.Boolean }; +type NumberType = { k: TypeKind.Number }; +type StringType = { k: TypeKind.String }; + +type ObjectType = { + k: TypeKind.Object; + members?: Array; +}; +export type ObjectMember = { + index?: boolean; + name?: string; + params?: Array; + type?: Type; +}; + +type ArrayType = { k: TypeKind.Array; type: Type }; +export type FunctionType = { + k: TypeKind.Function; + // Note: does not yet show constraints or defaults + typeParams?: Array; + params: Array; + type: Type; +}; +export type ParamType = { k: TypeKind.Param; param: string }; +export type NamedType = { + k: TypeKind.Type; + name: string; // May be dotted path or other expression + args?: Array; + url?: string; +}; + +type UnionType = { k: TypeKind.Union; types: Array }; +type IntersectionType = { k: TypeKind.Intersection; types: Array }; +type TupleType = { k: TypeKind.Tuple; types: Array }; +type IndexedType = { k: TypeKind.Indexed; type: Type; index: Type }; +type OperatorType = { k: TypeKind.Operator; operator: string; type: Type }; diff --git a/website/src/TypeDocumentation.tsx b/website/src/TypeDocumentation.tsx new file mode 100644 index 0000000000..c8118de8c2 --- /dev/null +++ b/website/src/TypeDocumentation.tsx @@ -0,0 +1,197 @@ +'use client'; + +import { Fragment, useReducer } from 'react'; + +import { InterfaceDef, CallSigDef } from './Defs'; +import { SideBar, SidebarLinks } from './Sidebar'; +import { MemberDoc } from './MemberDoc'; +import { MarkdownContent } from './MarkdownContent'; +import { collectMemberGroups } from './collectMemberGroups'; +import type { TypeDefinition, MemberDefinition } from './TypeDefs'; +import { DocSearch } from './DocSearch'; + +const typeDefURL = + 'https://github.com/immutable-js/immutable-js/blob/main/type-definitions/immutable.d.ts'; +const issuesURL = 'https://github.com/immutable-js/immutable-js/issues'; + +function Disclaimer() { + return ( +
+ This documentation is generated from{' '} + + immutable.d.ts + + . Pull requests and{' '} + + Issues + {' '} + welcome. +
+ ); +} + +function toggle(value: boolean) { + return !value; +} + +export function TypeDocumentation({ + def, + sidebarLinks, +}: { + def: TypeDefinition; + sidebarLinks: SidebarLinks; +}) { + const [showInherited, toggleShowInherited] = useReducer(toggle, true); + const [showInGroups, toggleShowInGroups] = useReducer(toggle, true); + + return ( + <> + + +
+ + + {!def.interface && !def.functions && def.call ? ( + + ) : ( + + )} +
+ + ); +} + +function FunctionDoc({ def }: { def: MemberDefinition }) { + return ( +
+

{def.label}

+ {def.doc && ( + + )} + + {def.signatures!.map((callSig, i) => ( + + + {'\n'} + + ))} + + {def.doc?.notes.map((note, i) => ( +
+

{note.name}

+ {note.name === 'alias' ? : note.body} +
+ ))} + {def.doc?.description && ( +
+

+ {def.doc.description.slice(0, 5) === ' + +

+ )} + +
+ ); +} + +function TypeDoc({ + def, + showInGroups, + showInherited, +}: { + def: TypeDefinition; + showInGroups: boolean; + showInherited: boolean; +}) { + const memberGroups = collectMemberGroups( + def?.interface, + showInGroups, + showInherited + ); + + return ( +
+

{def.qualifiedName}

+ {def.doc && ( + + )} + + {def.interface && ( + + + + )} + + {def.doc?.notes.map((note, i) => ( +
+

{note.name}

+ {note.name === 'alias' ? : note.body} +
+ ))} + + {def.doc?.description && ( +
+

+ {def.doc.description.slice(0, 5) === ' + +

+ )} + + {def.call && ( +
+

Construction

+ +
+ )} + + {def.functions && ( +
+

Static methods

+ {Object.values(def.functions).map((t) => ( + + ))} +
+ )} + +
+ {memberGroups.flatMap(([title, members]) => + members.length === 0 + ? null + : [ +

+ {title || 'Members'} +

, + members.map((member) => ( + + )), + ] + )} +
+ + +
+ ); +} diff --git a/website/src/app/docs/[version]/[type]/page.tsx b/website/src/app/docs/[version]/[type]/page.tsx new file mode 100644 index 0000000000..900fa40374 --- /dev/null +++ b/website/src/app/docs/[version]/[type]/page.tsx @@ -0,0 +1,55 @@ +import { getSidebarLinks } from '../../../../getSidebarLinks'; +import { getTypeDefs } from '../../../../static/getTypeDefs'; +import { getVersionFromGitTag } from '../../../../static/getVersions'; +import { TypeDocumentation } from '../../../../TypeDocumentation'; +import { getVersionFromParams } from '../../../getVersionFromParams'; + +export async function generateStaticParams() { + return getVersionFromGitTag() + .map((version) => + Object.values(getTypeDefs(version).types).map((def) => ({ + version, + type: def.label, + })) + ) + .flat(); +} + +type Params = { + version: string; + type: string; +}; + +type Props = { + params: Promise; +}; + +export async function generateMetadata(props: Props) { + const params = await props.params; + const version = getVersionFromParams(params); + const defs = getTypeDefs(version); + const def = Object.values(defs.types).find((d) => d.label === params.type); + + if (!def) { + throw new Error('404'); + } + + return { + title: `${def.qualifiedName} — Immutable.js`, + }; +} + +export default async function TypeDocPage(props: Props) { + const params = await props.params; + const version = getVersionFromParams(params); + const defs = getTypeDefs(version); + + const def = Object.values(defs.types).find((d) => d.label === params.type); + + if (!def) { + throw new Error('404'); + } + + const sidebarLinks = getSidebarLinks(defs); + return ; +} diff --git a/website/src/app/docs/[version]/layout.tsx b/website/src/app/docs/[version]/layout.tsx new file mode 100644 index 0000000000..ab824ad184 --- /dev/null +++ b/website/src/app/docs/[version]/layout.tsx @@ -0,0 +1,27 @@ +import { DocHeader } from '../../../DocHeader'; +import { ImmutableConsole } from '../../../ImmutableConsole'; +import { getVersions } from '../../../static/getVersions'; +import { getVersionFromParams } from '../../getVersionFromParams'; + +export default async function VersionLayout(props: { + children: React.ReactNode; + params: Promise<{ version: string }>; +}) { + const params = await props.params; + + const { children } = props; + + const versions = getVersions(); + + const version = getVersionFromParams(params); + + return ( +
+ + +
+
{children}
+
+
+ ); +} diff --git a/website/src/app/docs/[version]/page.tsx b/website/src/app/docs/[version]/page.tsx new file mode 100644 index 0000000000..124eef6a4c --- /dev/null +++ b/website/src/app/docs/[version]/page.tsx @@ -0,0 +1,48 @@ +import { Metadata } from 'next'; +import { getVersionFromGitTag } from '../../../static/getVersions'; +import { getTypeDefs } from '../../../static/getTypeDefs'; +import { DocOverview, getOverviewData } from '../../../DocOverview'; +import { DocSearch } from '../../../DocSearch'; +import { SideBar } from '../../../Sidebar'; +import { getSidebarLinks } from '../../../getSidebarLinks'; +import { getVersionFromParams } from '../../getVersionFromParams'; + +export async function generateStaticParams() { + return [...getVersionFromGitTag().map((version) => ({ version }))]; +} + +type Params = { + version: string; +}; + +type Props = { + params: Promise; +}; + +export async function generateMetadata(props: Props): Promise { + const params = await props.params; + const version = getVersionFromParams(params); + + return { + title: `Documentation ${version} — Immutable.js`, + }; +} + +export default async function OverviewDocPage(props: Props) { + const params = await props.params; + const version = getVersionFromParams(params); + const defs = getTypeDefs(version); + const overviewData = getOverviewData(defs); + const sidebarLinks = getSidebarLinks(defs); + + return ( + <> + +
+ +

Immutable.js ({version})

+ +
+ + ); +} diff --git a/website/src/app/docs/[version]/test/sandpack.tsx.bak b/website/src/app/docs/[version]/test/sandpack.tsx.bak new file mode 100644 index 0000000000..5948f1c0a8 --- /dev/null +++ b/website/src/app/docs/[version]/test/sandpack.tsx.bak @@ -0,0 +1,99 @@ +'use client'; + +import { Sandpack } from '@codesandbox/sandpack-react'; + +export function Doc({ content }: { content: string }) { + return ( + + ); +} + +export default function SandpackTest({ + content, + needImports, +}: { + content: string; + needImports?: Array; +}) { + const importLine = needImports + ? `import { ${needImports.join(', ')} } from 'immutable';` + : ''; + + const code = `${importLine} + + ${content} + `.trim(); + + return ( + + {entries.map(([key, value], i) => ( +
+

{key === 'default' ? 'default export' : 'exported variable: ' + key}

+
{JSON.stringify(value, null, 2)}
+ {i !== nbEntries - 1 &&
} +
+ ))} +
; +}`, + hidden: true, + }, + }} + template="react-ts" + /> + ); +} diff --git a/website/src/app/docs/currentVersion.tsx b/website/src/app/docs/currentVersion.tsx new file mode 100644 index 0000000000..92f8c53754 --- /dev/null +++ b/website/src/app/docs/currentVersion.tsx @@ -0,0 +1,261 @@ +export const VERSION = 'v5'; + +export const SIDEBAR_LINKS = [ + { + label: 'List', + description: + 'Lists are ordered indexed dense collections, much like a JavaScript Array.', + url: `/docs/${VERSION}/List`, + }, + { + label: 'Map', + description: + 'Immutable Map is an unordered Collection.Keyed of (key, value) pairs with O(log32 N) gets and O(log32 N) persistent sets.', + url: `/docs/${VERSION}/Map`, + }, + { + label: 'OrderedMap', + description: + 'A type of Map that has the additional guarantee that the iteration order of entries will be the order in which they were set().', + url: `/docs/${VERSION}/OrdererMap`, + }, + { + label: 'Set', + description: 'A Collection of unique values with O(log32 N) adds and has.', + url: `/docs/${VERSION}/Set`, + }, + { + label: 'OrderedSet', + description: + 'A type of Set that has the additional guarantee that the iteration order of values will be the order in which they were added.', + url: `/docs/${VERSION}/OrderedSet`, + }, + { + label: 'Stack', + description: + 'Stacks are indexed collections which support very efficient O(1) addition and removal from the front using unshift(v) and shift().', + url: `/docs/${VERSION}/Stack`, + }, + { + label: 'Range()', + description: + 'Returns a Seq.Indexed of numbers from start (inclusive) to end (exclusive), by step, where start defaults to 0, step to 1, and end to infinity. When start is equal to end, returns empty range.', + url: `/docs/${VERSION}/Range()`, + }, + { + label: 'Repeat()', + description: + 'Returns a Seq.Indexed of value repeated times times. When times is not defined, returns an infinite Seq of value.', + url: `/docs/${VERSION}/Repeat()`, + }, + { + label: 'Record', + description: + 'A record is similar to a JS object, but enforces a specific set of allowed string keys, and has default values.', + url: `/docs/${VERSION}/Record`, + }, + { + label: 'Record.Factory', + description: + 'A Record.Factory is created by the Record() function. Record instances are created by passing it some of the accepted values for that Record type:', + url: `/docs/${VERSION}/Record.Factory`, + }, + { + label: 'Seq', + description: + 'Seq describes a lazy operation, allowing them to efficiently chain use of all the higher-order collection methods (such as map and filter) by not creating intermediate collections.', + url: `/docs/${VERSION}/Seq`, + }, + { + label: 'Seq.Keyed', + description: 'Seq which represents key-value pairs.', + url: `/docs/${VERSION}/Seq.Keyed`, + }, + { + label: 'Seq.Indexed', + description: 'Seq which represents an ordered indexed list of values.', + url: `/docs/${VERSION}/Seq.Indexed`, + }, + { + label: 'Seq.Set', + description: 'Seq which represents a set of values.', + url: `/docs/${VERSION}/Seq.Set`, + }, + { + label: 'Collection', + description: + 'The Collection is a set of (key, value) entries which can be iterated, and is the base class for all collections in immutable, allowing them to make use of all the Collection methods (such as map and filter).', + url: `/docs/${VERSION}/Collection`, + }, + { + label: 'Collection.Keyed', + description: 'Keyed Collections have discrete keys tied to each value.', + url: `/docs/${VERSION}/Collection.Keyed`, + }, + { + label: 'Collection.Indexed', + description: + "Indexed Collections have incrementing numeric keys. They exhibit slightly different behavior than Collection.Keyed for some methods in order to better mirror the behavior of JavaScript's Array, and add methods which do not make sense on non-indexed Collections such as indexOf.", + url: `/docs/${VERSION}/Collection.Indexed`, + }, + { + label: 'Collection.Set', + description: + 'Set Collections only represent values. They have no associated keys or indices. Duplicate values are possible in the lazy Seq.Sets, however the concrete Set Collection does not allow duplicate values.', + url: `/docs/${VERSION}/Collection.Set`, + }, + { + label: 'ValueObject', + description: '', + url: `/docs/${VERSION}/ValueObject`, + }, + { + label: 'OrderedCollection', + description: '', + url: `/docs/${VERSION}/OrderedCollection`, + }, + + // functions + { label: 'fromJS()', description: '', url: `/docs/${VERSION}/fromJS()` }, + { + label: 'is()', + description: + 'Value equality check with semantics similar to Object.is, but treats Immutable Collections as values, equal if the second Collection includes equivalent values.', + url: `/docs/${VERSION}/is()`, + }, + { + label: 'hash()', + description: + 'The hash() function is an important part of how Immutable determines if two values are equivalent and is used to determine how to store those values. Provided with any value, hash() will return a 31-bit integer.', + url: `/docs/${VERSION}/hash()`, + }, + { + label: 'isImmutable()', + description: 'True if maybeImmutable is an Immutable Collection or Record.', + url: `/docs/${VERSION}/isImmutable()`, + }, + { + label: 'isCollection()', + description: + 'True if maybeCollection is a Collection, or any of its subclasses.', + url: `/docs/${VERSION}/isCollection()`, + }, + { + label: 'isKeyed()', + description: + 'True if maybeKeyed is a Collection.Keyed, or any of its subclasses.', + url: `/docs/${VERSION}/isKeyed()`, + }, + { + label: 'isIndexed()', + description: + 'True if maybeIndexed is a Collection.Indexed, or any of its subclasses.', + url: `/docs/${VERSION}/isIndexed()`, + }, + { + label: 'isAssociative()', + description: + 'True if maybeAssociative is either a Keyed or Indexed Collection.', + url: `/docs/${VERSION}/isAssociative()`, + }, + { + label: 'isOrdered()', + description: '', + url: `/docs/${VERSION}/isOrdered()`, + }, + { + label: 'isValueObject()', + description: + 'True if maybeValue is a JavaScript Object which has both equals() and hashCode() methods.', + url: `/docs/${VERSION}/isValueObject()`, + }, + { + label: 'isSeq()', + description: 'True if maybeSeq is a Seq.', + url: `/docs/${VERSION}/isSeq()`, + }, + { + label: 'isList()', + description: 'True if maybeList is a List.', + url: `/docs/${VERSION}/isList()`, + }, + { + label: 'isMap()', + description: 'True if maybeMap is a Map.', + url: `/docs/${VERSION}/isMap()`, + }, + { + label: 'isOrderedMap()', + description: 'True if maybeOrderedMap is an OrderedMap.', + url: `/docs/${VERSION}/isOrderedMap()`, + }, + { + label: 'isStack()', + description: 'True if maybeStack is a Stack.', + url: `/docs/${VERSION}/isStack()`, + }, + { + label: 'isSet()', + description: 'True if maybeSet is a Set.', + url: `/docs/${VERSION}/isSet()`, + }, + { + label: 'isOrderedSet()', + description: 'True if maybeOrderedSet is an OrderedSet.', + url: `/docs/${VERSION}/isOrderedSet()`, + }, + { + label: 'isRecord()', + description: 'True if maybeRecord is a Record.', + url: `/docs/${VERSION}/isRecord()`, + }, + { + label: 'get()', + description: + 'Returns true if the key is defined in the provided collection.', + url: `/docs/${VERSION}/get()`, + }, + { label: 'has()', description: '', url: `/docs/${VERSION}/has()` }, + { label: 'remove()', description: '', url: `/docs/${VERSION}/remove()` }, + { label: 'set()', description: '', url: `/docs/${VERSION}/set()` }, + { label: 'update()', description: '', url: `/docs/${VERSION}/update()` }, + { label: 'getIn()', description: '', url: `/docs/${VERSION}/getIn()` }, + { label: 'hasIn()', description: '', url: `/docs/${VERSION}/hasIn()` }, + { + label: 'removeIn()', + description: + 'Returns a copy of the collection with the value at the key path removed.', + url: `/docs/${VERSION}/removeIn()`, + }, + { + label: 'setIn()', + description: + 'Returns a copy of the collection with the value at the key path set to the provided value.', + url: `/docs/${VERSION}/setIn()`, + }, + { label: 'updateIn()', description: '', url: `/docs/${VERSION}/updateIn()` }, + { + label: 'merge()', + description: + 'Returns a copy of the collection with the remaining collections merged in.', + url: `/docs/${VERSION}/merge()`, + }, + { + label: 'mergeWith()', + description: + 'Returns a copy of the collection with the remaining collections merged in, calling the merger function whenever an existing value is encountered.', + url: `/docs/${VERSION}/mergeWith()`, + }, + { + label: 'mergeDeep()', + description: + 'Like merge(), but when two compatible collections are encountered with the same key, it merges them as well, recursing deeply through the nested data. Two collections are considered to be compatible (and thus will be merged together) if they both fall into one of three categories: keyed (e.g., Maps, Records, and objects), indexed (e.g., Lists and arrays), or set-like (e.g., Sets). If they fall into separate categories, mergeDeep will replace the existing collection with the collection being merged in. This behavior can be customized by using mergeDeepWith().', + url: `/docs/${VERSION}/mergeDeep()`, + }, + { + label: 'mergeDeepWith()', + description: + 'Like mergeDeep(), but when two non-collections or incompatible collections are encountered at the same key, it uses the merger function to determine the resulting value. Collections are considered incompatible if they fall into separate categories between keyed, indexed, and set-like.', + url: `/docs/${VERSION}/mergeDeepWith()`, + }, +]; diff --git a/website/src/app/docs/page.tsx b/website/src/app/docs/page.tsx new file mode 100644 index 0000000000..8f2eed2439 --- /dev/null +++ b/website/src/app/docs/page.tsx @@ -0,0 +1,31 @@ +import { Metadata } from 'next'; +import { getVersions } from '../../static/getVersions'; +import RedirectExistingDocs from './redirect-client'; +import { ImmutableConsole } from '../../ImmutableConsole'; +import { DocHeader } from '../../DocHeader'; + +export const metadata: Metadata = { + title: 'Documentation — Immutable.js', +}; + +export default function Page() { + const versions = getVersions(); + + const latestVersion = versions[0]; + + if (!latestVersion) { + throw new Error('No versions'); + } + + return ( +
+ + +
+
+ +
+
+
+ ); +} diff --git a/website/src/app/docs/redirect-client.tsx b/website/src/app/docs/redirect-client.tsx new file mode 100644 index 0000000000..40538ee952 --- /dev/null +++ b/website/src/app/docs/redirect-client.tsx @@ -0,0 +1,26 @@ +'use client'; + +import { useRouter } from 'next/navigation'; +import { useEffect } from 'react'; + +type Props = { + version: string; +}; + +export default function RedirectExistingDocs({ version }: Props) { + const router = useRouter(); + + useEffect(() => { + const [, type, member] = window.location.hash?.split('/') || []; + let route = `/docs/${version}`; + if (type) { + route += `/${type}`; + } + if (member) { + route += `#${member}`; + } + router.replace(route); + }, [version, router]); + + return
Redirecting...
; +} diff --git a/website/src/app/docs/v5/[type]/page.tsx b/website/src/app/docs/v5/[type]/page.tsx new file mode 100644 index 0000000000..326c86246c --- /dev/null +++ b/website/src/app/docs/v5/[type]/page.tsx @@ -0,0 +1,38 @@ +import { getDocFiles } from '../../../../utils/doc'; + +export async function generateStaticParams() { + const docFiles = getDocFiles(); + + return docFiles.map((file) => ({ + type: file.slug, + })); +} + +type Params = { + version: string; + type: string; +}; + +type Props = { + params: Promise; +}; + +export async function generateMetadata(props: Props) { + const params = await props.params; + + console.log('params', params); + + return { + title: `${params.type} — Immutable.js`, + }; +} + +export default async function TypeDocPage(props: Props) { + const params = await props.params; + + const { type } = params; + + const { default: MdxContent } = await import(`@/docs/${type}.mdx`); + + return ; +} diff --git a/website/src/app/docs/v5/layout.tsx b/website/src/app/docs/v5/layout.tsx new file mode 100644 index 0000000000..ca54797ef9 --- /dev/null +++ b/website/src/app/docs/v5/layout.tsx @@ -0,0 +1,32 @@ +import { SideBar } from '../../../Sidebar'; +import { DocSearch } from '../../../DocSearch'; +import { DocHeader } from '../../../DocHeader'; +import { ImmutableConsole } from '../../../ImmutableConsole'; +import { getVersions } from '../../../static/getVersions'; +import { VERSION } from '../currentVersion'; + +export default async function VersionLayout(props: { + children: React.ReactNode; + params: Promise<{ version: string }>; +}) { + const { children } = props; + + const versions = getVersions(); + + return ( +
+ + +
+
+ + +
+ + {children} +
+
+
+
+ ); +} diff --git a/website/src/app/docs/v5/page.tsx b/website/src/app/docs/v5/page.tsx new file mode 100644 index 0000000000..0134bbf098 --- /dev/null +++ b/website/src/app/docs/v5/page.tsx @@ -0,0 +1,36 @@ +import { Metadata } from 'next'; +import Link from 'next/link'; +import { SIDEBAR_LINKS, VERSION } from '../currentVersion'; + +export async function generateMetadata(): Promise { + return { + title: `Documentation v5 — Immutable.js`, + }; +} + +export default async function OverviewDocPage() { + const { default: MdxContent } = await import(`@/docs/Intro.mdx`); + + console.log('MdxContent', MdxContent); + + return ( + <> +
+

Immutable.js ({VERSION})

+ {/* */} + + + {SIDEBAR_LINKS.map((link) => ( +
+

+ {link.label} +

+
+

{link.description}

+
+
+ ))} +
+ + ); +} diff --git a/website/src/app/getVersionFromParams.ts b/website/src/app/getVersionFromParams.ts new file mode 100644 index 0000000000..99724ad9c7 --- /dev/null +++ b/website/src/app/getVersionFromParams.ts @@ -0,0 +1,7 @@ +type Params = { + version: string; +}; + +export function getVersionFromParams(params: Params): string { + return params.version.replace('%40', '@'); +} diff --git a/website/src/app/layout.tsx b/website/src/app/layout.tsx new file mode 100644 index 0000000000..a65c529099 --- /dev/null +++ b/website/src/app/layout.tsx @@ -0,0 +1,25 @@ +import { Metadata } from 'next'; +import React from 'react'; +import '../../styles/globals.css'; +import '../../styles/prism-theme.css'; + +export const metadata: Metadata = { + title: 'Immutable.js', + icons: { + icon: '/favicon.png', + }, +}; + +export default function RootLayout({ + // Layouts must accept a children prop. + // This will be populated with nested layouts or pages + children, +}: { + children: React.ReactNode; +}) { + return ( + + {children} + + ); +} diff --git a/website/src/app/not-found.tsx b/website/src/app/not-found.tsx new file mode 100644 index 0000000000..10d4886a05 --- /dev/null +++ b/website/src/app/not-found.tsx @@ -0,0 +1,13 @@ +import Link from 'next/link'; + +export default function NotFound() { + return ( + <> +
+

Not Found

+

Could not find requested resource

+ Return Home +
+ + ); +} diff --git a/website/src/app/page.tsx b/website/src/app/page.tsx new file mode 100644 index 0000000000..0fec27610d --- /dev/null +++ b/website/src/app/page.tsx @@ -0,0 +1,27 @@ +import fs from 'fs'; +import { Header } from '../Header'; +import { ImmutableConsole } from '../ImmutableConsole'; +import { MarkdownContent } from '../MarkdownContent'; +import { genMarkdownDoc } from '../static/genMarkdownDoc'; +import { getVersions } from '../static/getVersions'; + +export default async function Page() { + const versions = await getVersions(); + const readme = genMarkdownDoc( + versions[0], + fs.readFileSync(`../README.md`, 'utf8') + ); + + return ( + <> + +
+ +
+
+ +
+
+ + ); +} diff --git a/website/src/app/play/Playground.tsx b/website/src/app/play/Playground.tsx new file mode 100644 index 0000000000..8a6f346d7f --- /dev/null +++ b/website/src/app/play/Playground.tsx @@ -0,0 +1,62 @@ +'use client'; + +import Repl from '../../repl/Repl'; +import { stringToBytes, bytesToString } from './encoder'; + +export default function Playground() { + { + /* +Debug with: + +List([ + 'apple', + 'banana', + 'coconut', + 123, + null, + undefined, + new Date() +]) + .push('dragonfruit') + .map((fruit) => upperFirst(fruit)) + +*/ + } + + let decodedHash: string | null = null; + + try { + decodedHash = window.location.hash + ? bytesToString(window.location.hash.slice(1)) + : null; + } catch (e) { + console.warn('Error decoding hash', e); + } + + const defaultValue = + decodedHash ?? + `const upperFirst = (str) => typeof str === 'string' +? str.charAt(0).toUpperCase() + str.slice(1) +: str; + +List([ +'apple', +'banana', +'coconut', +]) +.push('dragonfruit') +.map((fruit) => upperFirst(fruit)) +`; + + return ( + { + const bytes = stringToBytes(code); + + // adds bytes as url hash + window.location.hash = bytes; + }} + /> + ); +} diff --git a/website/src/app/play/encoder.ts b/website/src/app/play/encoder.ts new file mode 100644 index 0000000000..d58c41aad3 --- /dev/null +++ b/website/src/app/play/encoder.ts @@ -0,0 +1,20 @@ +// taken from https://developer.mozilla.org/en-US/docs/Web/API/Window/btoa#unicode_strings +function base64ToBytes(base64: string): Uint8Array { + const binString = atob(base64); + return Uint8Array.from(binString, (m: string) => m.codePointAt(0) ?? 0); +} + +function bytesToBase64(bytes: Uint8Array): string { + const binString = Array.from(bytes, (byte) => + String.fromCodePoint(byte) + ).join(''); + return btoa(binString); +} + +export function stringToBytes(str: string): string { + return bytesToBase64(new TextEncoder().encode(str)); +} + +export function bytesToString(bytes: string): string { + return new TextDecoder().decode(base64ToBytes(bytes)); +} diff --git a/website/src/app/play/layout.tsx b/website/src/app/play/layout.tsx new file mode 100644 index 0000000000..4f7b7c3a3c --- /dev/null +++ b/website/src/app/play/layout.tsx @@ -0,0 +1,21 @@ +import { DocHeader } from '../../DocHeader'; +import { ImmutableConsole } from '../../ImmutableConsole'; +import { getVersions } from '../../static/getVersions'; + +export default function VersionLayout({ + children, +}: { + children: React.ReactNode; +}) { + const versions = getVersions(); + + return ( +
+ + +
+
{children}
+
+
+ ); +} diff --git a/website/src/app/play/page.tsx b/website/src/app/play/page.tsx new file mode 100644 index 0000000000..47406aabab --- /dev/null +++ b/website/src/app/play/page.tsx @@ -0,0 +1,29 @@ +import { Metadata } from 'next'; +import { DocSearch } from '../../DocSearch'; +import { SideBar } from '../../Sidebar'; +import Playground from './Playground'; +import { VERSION } from '../docs/currentVersion'; + +export async function generateStaticParams() { + // return [...getVersions().map((version) => ({ version }))]; +} + +export async function generateMetadata(): Promise { + return { + title: `Playground — Immutable.js`, + }; +} + +export default function OverviewDocPage() { + return ( + <> + +
+ +

Playgroud (${VERSION})

+ You can share or bookmark the url to get access to this playground. + +
+ + ); +} diff --git a/website/src/collectMemberGroups.ts b/website/src/collectMemberGroups.ts new file mode 100644 index 0000000000..c19d84f1a1 --- /dev/null +++ b/website/src/collectMemberGroups.ts @@ -0,0 +1,26 @@ +import type { InterfaceDefinition, MemberDefinition } from './TypeDefs'; + +export function collectMemberGroups( + interfaceDef: InterfaceDefinition | undefined, + showInGroups?: boolean, + showInherited?: boolean +): Array<[groupTitle: string, members: Array]> { + const groups: { [groupTitle: string]: Array } = {}; + + const members = interfaceDef?.members + ? Object.values(interfaceDef.members) + : []; + + if (!showInGroups) { + members.sort((a, b) => (a.id > b.id ? 1 : -1)); + } + + for (const member of members) { + const groupTitle = (showInGroups && member.group) || ''; + if (showInherited || !member.inherited) { + (groups[groupTitle] || (groups[groupTitle] = [])).push(member); + } + } + + return Object.entries(groups); +} diff --git a/website/src/getSidebarLinks.tsx b/website/src/getSidebarLinks.tsx new file mode 100644 index 0000000000..bb86bf8a85 --- /dev/null +++ b/website/src/getSidebarLinks.tsx @@ -0,0 +1,6 @@ +import type { TypeDefs } from './TypeDefs'; +import { SidebarLinks } from './Sidebar'; + +export function getSidebarLinks(defs: TypeDefs): SidebarLinks { + return Object.values(defs.types).map(({ label, url }) => ({ label, url })); +} diff --git a/website/src/isMobile.ts b/website/src/isMobile.ts new file mode 100644 index 0000000000..9ed855821f --- /dev/null +++ b/website/src/isMobile.ts @@ -0,0 +1,11 @@ +let _isMobile: boolean; +export function isMobile() { + if (_isMobile === undefined) { + const isMobileMatch = + typeof window !== 'undefined' && + window.matchMedia && + window.matchMedia('(max-device-width: 680px)'); + _isMobile = isMobileMatch && isMobileMatch.matches; + } + return _isMobile; +} diff --git a/website/src/mdx-components.tsx b/website/src/mdx-components.tsx new file mode 100644 index 0000000000..2fa6b33e98 --- /dev/null +++ b/website/src/mdx-components.tsx @@ -0,0 +1,78 @@ +import type { MDXComponents } from 'mdx/types'; +import Prism from 'prismjs'; +import loadLanguages from 'prismjs/components/'; + +loadLanguages(['ts']); + +export function useMDXComponents(components: MDXComponents): MDXComponents { + return { + code: ({ className, children, ...rest }) => { + if (!className) { + // no classname : no need to handle syntax highlighting + return {children}; + } + + const language = className.replace('language-', ''); + const html = Prism.highlight( + String(children).trim(), + Prism.languages[language] || Prism.languages.plaintext, + language + ); + + return ( + + ); + }, + MemberLabel: ({ label, alias }: { label: string; alias?: string }) => { + return ( +
+

+ + {label} + § + +

+ {alias && ( + <> +

Alias:

+ {alias} + + )} +
+ ); + }, + See: ({ code }: { code: string }) => { + return ( + <> +

See

+ {code} + + ); + }, + Signature: ({ code }) => { + const language = 'ts'; + const html = Prism.highlight( + String(code).trim(), + Prism.languages[language], + language + ); + + return ( +
+

Method signature

+
+            
+          
+
+ ); + }, + ...components, + }; +} diff --git a/website/src/mdx-components/CodeLink.tsx b/website/src/mdx-components/CodeLink.tsx new file mode 100644 index 0000000000..5d3a2a6b90 --- /dev/null +++ b/website/src/mdx-components/CodeLink.tsx @@ -0,0 +1,18 @@ +import { JSX } from 'react'; + +type Props = { + to: string; + children?: React.ReactNode; +}; + +export default function CodeLink({ to, children }: Props): JSX.Element { + const href = to.includes('#') || to.startsWith('.') ? to : `#${to}`; + + const text = children || to.replace(/^[./]*/g, ''); + + return ( + + {text} + + ); +} diff --git a/website/src/repl/Editor.tsx b/website/src/repl/Editor.tsx new file mode 100644 index 0000000000..cc9f0681f5 --- /dev/null +++ b/website/src/repl/Editor.tsx @@ -0,0 +1,61 @@ +import { useEffect, useRef, type JSX } from 'react'; +import { basicSetup, minimalSetup } from 'codemirror'; +import { EditorView, gutter, keymap } from '@codemirror/view'; +import { defaultKeymap, indentWithTab } from '@codemirror/commands'; +import { EditorState, Extension } from '@codemirror/state'; +import { javascript } from '@codemirror/lang-javascript'; +// TODO activate this when we have a dark mode +import { oneDark } from '@codemirror/theme-one-dark'; +import useDarkMode from '../useDarkMode'; + +type Props = { + value: string; + onChange?: (value: string) => void; +}; + +export function Editor({ value, onChange }: Props): JSX.Element { + const editor = useRef(null); + const darkMode = useDarkMode(); + + const onUpdate = EditorView.updateListener.of((v) => { + if (onChange) { + onChange(v.state.doc.toString()); + } + }); + + useEffect(() => { + if (!editor.current) { + return; + } + + const readOnly = !onChange; + + const startState = EditorState.create({ + doc: value, + // readOnly: !onChange, + extensions: [ + readOnly ? minimalSetup : basicSetup, + keymap.of([...defaultKeymap, indentWithTab]), + javascript(), + darkMode ? oneDark : undefined, + readOnly ? undefined : onUpdate, + EditorState.readOnly.of(readOnly), + readOnly ? gutter({}) : undefined, + ].filter( + (value: Extension | undefined): value is Extension => + typeof value !== 'undefined' + ), + }); + + const view = new EditorView({ + state: startState, + parent: editor.current, + }); + + return () => { + view.destroy(); + }; + }, [darkMode]); + + return
; +} diff --git a/website/src/repl/FormatterOutput.tsx b/website/src/repl/FormatterOutput.tsx new file mode 100644 index 0000000000..26f86043ca --- /dev/null +++ b/website/src/repl/FormatterOutput.tsx @@ -0,0 +1,27 @@ +import { toHTML } from 'jsonml-html'; +import { useEffect, useRef, type JSX } from 'react'; +import { Element, JsonMLElementList } from '../worker/jsonml-types'; + +/** + * immutable-devtools is a console custom formatter. + * Console formatters does use jsonml format. + * {@see https://firefox-source-docs.mozilla.org/devtools-user/custom_formatters/index.html} for a documentation from the Firefox team. + * The `jsonml-html` package can convert jsonml to HTML. + */ +type Props = { + output: undefined | JsonMLElementList | Element; +}; + +export default function FormatterOutput({ output }: Props): JSX.Element { + const header = useRef(null); + + const htmlHeader = output ? toHTML(output) : undefined; + + useEffect(() => { + if (header.current && htmlHeader) { + header.current.replaceChildren(htmlHeader); + } + }, [htmlHeader]); + + return
; +} diff --git a/website/src/repl/Repl.tsx b/website/src/repl/Repl.tsx new file mode 100644 index 0000000000..e702fe5571 --- /dev/null +++ b/website/src/repl/Repl.tsx @@ -0,0 +1,95 @@ +'use client'; +import dynamic from 'next/dynamic'; +import React, { useEffect, useRef, useState, type JSX } from 'react'; +import { Editor } from './Editor'; +import FormatterOutput from './FormatterOutput'; +import './repl.css'; +import { Element, JsonMLElementList } from '../worker/jsonml-types'; + +type Props = { + defaultValue: string; + onRun?: (code: string) => void; + imports?: Array; +}; + +function Repl({ defaultValue, onRun, imports }: Props): JSX.Element { + const [code, setCode] = useState(defaultValue); + const [output, setOutput] = useState([]); + const workerRef = useRef(null); + + useEffect(() => { + // Create a worker from the external worker.js file + workerRef.current = new Worker( + new URL('../worker/index.ts', import.meta.url) + ); + + return () => { + workerRef.current?.terminate(); + }; + }, []); + + useEffect(() => { + runCode(); + }, []); + + const runCode = () => { + if (workerRef.current) { + // ignore import statements as we do unpack all immutable data in the worker + // but it might be useful in the documentation + const cleanedCode = code; // .replace(/^import.*/m, ''); + + // notify parent + if (onRun) { + onRun(cleanedCode); + } + + // send message to worker + workerRef.current.postMessage(cleanedCode); + workerRef.current.onmessage = (event) => { + if (event.data.error) { + setOutput(['div', 'Error: ' + event.data.error]); + } else { + const { output } = event.data; + + if (typeof output === 'object' && !Array.isArray(output)) { + setOutput(['div', { object: output }]); + } else { + setOutput(output); + } + } + }; + } + }; + + return ( +
+

Live example

+ +
+
+ {imports && ( + + )} + + +
+ + +
+ + {output && ( +
+          
+        
+ )} +
+ ); +} + +export default dynamic(() => Promise.resolve(Repl), { + ssr: false, +}); diff --git a/website/src/repl/repl.css b/website/src/repl/repl.css new file mode 100644 index 0000000000..aba5313646 --- /dev/null +++ b/website/src/repl/repl.css @@ -0,0 +1,47 @@ +.repl-editor-container { + display: flex; + align-items: flex-start; + gap: 8px; +} + +.repl-editor { + flex: 1; + width: 0; /* See https://stackoverflow.com/a/75423682/2111353, but does only work on "row" mode */ + + border: 1px solid var(--code-block-bg-color); +} + +.js-repl textarea { + width: 100%; + height: 100px; + margin-bottom: 10px; + padding: 10px; + font-family: monospace; + font-size: 14px; + border: 1px solid #ccc; + border-radius: 4px; + resize: none; +} + +.js-repl button { + padding: 10px 15px; + font-size: 14px; + background-color: var(--link-color); + color: white; + border: none; + border-radius: 4px; + cursor: pointer; +} + +.js-repl button:hover { + background-color: var(--link-hover-color); +} + +.js-repl pre.repl-output { + background-color: var(--code-block-bg-color); + padding: 10px; + border: 1px solid #ccc; + border-radius: 4px; + white-space: pre-wrap; + word-wrap: break-word; +} diff --git a/website/src/static/genMarkdownDoc.ts b/website/src/static/genMarkdownDoc.ts new file mode 100644 index 0000000000..5e16fd48b4 --- /dev/null +++ b/website/src/static/genMarkdownDoc.ts @@ -0,0 +1,28 @@ +import { markdown } from './markdown'; +import { SIDEBAR_LINKS } from '../app/docs/currentVersion'; + +export function genMarkdownDoc(version: string, typeDefSource: string): string { + return markdown( + typeDefSource + .replace(/\n[^\n]+?Build Status[^\n]+?\n/, '\n') + .replace('website/public', ''), + { + defs: { + version, + types: Object.fromEntries( + SIDEBAR_LINKS.map((link) => { + const qualifiedName = link.label.replace(/\(\)$/g, ''); + return [ + qualifiedName, + { + qualifiedName, + label: link.label, + url: link.url, + }, + ]; + }) + ), + }, + } + ); +} diff --git a/website/src/static/getTypeDefs.ts b/website/src/static/getTypeDefs.ts new file mode 100644 index 0000000000..967e3e27f6 --- /dev/null +++ b/website/src/static/getTypeDefs.ts @@ -0,0 +1,881 @@ +import { execSync } from 'child_process'; +import { readFileSync } from 'fs'; +import ts from 'typescript'; + +import { + CallParam, + CallSignature, + TypeDefinition, + InterfaceDefinition, + NamedType, + Type, + TypeDefs, + TypeDoc, + TypeKind, + MemberDefinition, +} from '../TypeDefs'; +import { markdown, MarkdownContext } from './markdown'; +import { stripUndefineds } from './stripUndefineds'; + +const generatedTypeDefs = new Map(); +export function getTypeDefs(version: string) { + let typeDefs = generatedTypeDefs.get(version); + if (typeDefs === undefined) { + typeDefs = genTypeDefData(version); + addData(version, typeDefs); + markdownDocs(typeDefs); + stripUndefineds(typeDefs); + generatedTypeDefs.set(version, typeDefs); + } + return typeDefs; +} + +function addData(version: string, defs: TypeDefs) { + // Add module labels and links + const baseUrl = `/docs/${version}/`; + for (const typeDef of Object.values(defs.types)) { + const isFn = isFunction(typeDef); + const label = typeDef.qualifiedName + (isFn ? '()' : ''); + const url = baseUrl + typeDef.qualifiedName + (isFn ? '()' : ''); + typeDef.label = label; + typeDef.url = url; + if (typeDef.call) { + typeDef.call.url = isFn ? url : url + '#' + typeDef.call.id; + } + if (typeDef.functions) { + for (const fn of Object.values(typeDef.functions)) { + fn.url = url + '#' + fn.id; + } + } + if (typeDef.interface) { + for (const member of Object.values(typeDef.interface.members)) { + member.url = url + '#' + member.id; + } + } + } + + // Add links to named types + for (const typeDef of Object.values(defs.types)) { + typeDef.call?.signatures?.forEach(addSignatureLink); + if (typeDef.functions) { + for (const fn of Object.values(typeDef.functions)) { + fn.signatures?.forEach(addSignatureLink); + } + } + if (typeDef.interface) { + typeDef.interface.extends?.forEach(addTypeLink); + typeDef.interface.implements?.forEach(addTypeLink); + for (const member of Object.values(typeDef.interface.members)) { + addTypeLink(member.type); + member.signatures?.forEach(addSignatureLink); + } + } + } + + function addSignatureLink(sig: CallSignature) { + sig.params?.forEach((p) => addTypeLink(p.type)); + addTypeLink(sig.type); + } + function addTypeLink(type: Type | undefined) { + if (type?.k === TypeKind.Type) { + const def = defs.types[type.name]; + if (def?.url) { + type.url = def.url; + } + } + } + + // Add heritage info + const hasVisitedHeritage = new Set(); + Object.values(defs.types).forEach(addInherited); + + function addInherited(def: TypeDefinition) { + if (!def.interface) { + return; + } + if (hasVisitedHeritage.has(def)) { + return; + } + hasVisitedHeritage.add(def); + const interfaceDef = def.interface; + for (const extended of interfaceDef.extends || []) { + const extendedDef = defs.types[extended.name]; + if (extendedDef?.interface) { + addInherited(extendedDef); + for (const extendedMember of Object.values( + extendedDef.interface.members + )) { + const inherited = extendedMember.inherited || { + interface: extendedDef.qualifiedName, + label: extendedMember.label, + url: extendedMember.url, + }; + const member = interfaceDef.members[extendedMember.name]; + if (!member) { + const url = def.url + '#' + extendedMember.id; + // Build inherited member + const inheritedMember = updateInheritedTypeParams( + { ...extendedMember, url, inherited, overrides: undefined }, + extendedDef.interface.typeParams, + extended.args + ); + setIn( + interfaceDef, + ['members', inheritedMember.name], + inheritedMember + ); + } else if (!member.inherited) { + if (!member.overrides) { + member.overrides = inherited; + } + if (!member.group && extendedMember.group) { + member.group = extendedMember.group; + } + } + } + } + } + } +} + +function isFunction(typeDef: TypeDefinition) { + // eslint-disable-next-line eqeqeq + return !typeDef.interface && !typeDef.functions && typeDef.call != null; +} + +/** + * An inherited member may reference the type parameters of the parent type. + * This updates all type parameters to the correct types. + * + * eg: + * + * interface A { + * member(arg: T) + * } + * + * interface B extends A {} + * + * when building the member `B.member`, it will produce `member(arg: number)` + */ +function updateInheritedTypeParams( + member: MemberDefinition, + params: Array = [], + args: Array = [] +): MemberDefinition { + if (params.length !== args.length) { + throw new Error( + 'Unexpected difference between number of type params and type args' + ); + } + + // If there are no params to replace, no copy is necessary + if (params.length === 0) return member; + + return { + ...member, + type: updateType(member.type), + signatures: member.signatures?.map(updateSignature), + }; + + function updateType(type: Type): Type; + function updateType(type: Type | undefined): Type | undefined; + function updateType(type: Type | undefined): Type | undefined { + switch (type?.k) { + case TypeKind.Param: { + // A parameter reference is replaced with the implementing type argument + const paramIndex = params.indexOf(type.param); + return paramIndex >= 0 ? args[paramIndex] : type; + } + case TypeKind.Array: + case TypeKind.Indexed: + case TypeKind.Operator: + return { ...type, type: updateType(type.type) }; + case TypeKind.Union: + case TypeKind.Intersection: + case TypeKind.Tuple: + return { ...type, types: type.types.map(updateType) }; + case TypeKind.Type: + return { ...type, args: type.args?.map(updateType) }; + case TypeKind.Function: + return updateSignature(type); + case TypeKind.Object: + return { ...type, members: type.members?.map(updateSignature) }; + } + return type; + } + + function updateSignature(signature: S): S { + return { + ...signature, + params: signature.params?.map((p) => ({ + ...p, + type: updateType(p.type), + })), + type: updateType(signature.type), + }; + } +} + +function markdownDocs(defs: TypeDefs) { + markdownDoc(defs.doc, { defs }); + for (const typeDef of Object.values(defs.types)) { + markdownDoc(typeDef.doc, { defs, typeDef }); + if (typeDef.call) { + markdownDoc(typeDef.call.doc, { + defs, + typeDef, + signatures: typeDef.call.signatures, + }); + } + if (typeDef.functions) { + for (const fn of Object.values(typeDef.functions)) { + markdownDoc(fn.doc, { + defs, + typeDef, + signatures: fn.signatures, + }); + } + } + if (typeDef.interface) { + markdownDoc(typeDef.interface.doc, { defs, typeDef }); + for (const member of Object.values(typeDef.interface.members)) { + markdownDoc(member.doc, { + defs, + typeDef, + signatures: member.signatures, + }); + } + } + } +} + +function markdownDoc(doc: TypeDoc | undefined, context: MarkdownContext) { + if (!doc) { + return; + } + if (doc.synopsis) { + doc.synopsis = markdown(doc.synopsis, context); + } + if (doc.description) { + doc.description = markdown(doc.description, context); + } + if (doc.notes) { + for (const note of doc.notes) { + if (note.name !== 'alias') { + note.body = markdown(note.body, context); + } + } + } +} + +const typeDefPath = '../type-definitions/immutable.d.ts'; +const typeDefPathOld = '../type-definitions/Immutable.d.ts'; + +function genTypeDefData(version: string): TypeDefs { + const typeDefSource = getTypeDefSource(version); + const sourceFile = ts.createSourceFile( + typeDefPath, + typeDefSource, + ts.ScriptTarget.ES2015, + /* parentReferences */ true + ); + + const types = typesVisitor(sourceFile); + const doc = types.Immutable.doc; + delete types.Immutable; + delete types.immutable; + return { version, doc, types }; +} + +function getTypeDefSource(version: string): string { + if (version === 'latest@main') { + return readFileSync(typeDefPath, { encoding: 'utf8' }); + } + + // Previous versions used a different name for the type definitions file. + // If the expected file isn't found for this version, try the older name. + try { + return execSync(`git show ${version}:${typeDefPath} 2>/dev/null`, { + encoding: 'utf8', + }); + } catch { + return execSync(`git show ${version}:${typeDefPathOld}`, { + encoding: 'utf8', + }); + } +} + +function typesVisitor(source: ts.SourceFile) { + const types: { [qualifiedName: string]: TypeDefinition } = {}; + const interfaces: Array = []; + const typeParamsScope: Array | undefined> = []; + const aliases: Array<{ [alias: string]: string }> = []; + const qualifiers: Array = []; + let currentGroup: string | undefined; + + visit(source); + return types; + + function visit(node: ts.Node) { + switch (node.kind) { + case ts.SyntaxKind.ModuleDeclaration: + visitModuleDeclaration(node as ts.ModuleDeclaration); + return; + case ts.SyntaxKind.FunctionDeclaration: + visitFunctionDeclaration(node as ts.FunctionDeclaration); + return; + case ts.SyntaxKind.InterfaceDeclaration: + visitInterfaceDeclaration(node as ts.InterfaceDeclaration); + return; + case ts.SyntaxKind.PropertySignature: + visitPropertySignature(node as ts.PropertySignature); + return; + case ts.SyntaxKind.MethodSignature: + visitMethodSignature(node as ts.MethodSignature); + return; + default: + ts.forEachChild(node, visit); + } + } + + function isTypeParam(name: string) { + return typeParamsScope.some((set) => set && set.indexOf(name) !== -1); + } + + function isAliased(name: string) { + return !!last(aliases)[name]; + } + + function addAliases(comment: TypeDoc | undefined, name: string) { + if (comment?.notes) { + comment.notes + .filter((note) => note.name === 'alias') + .map((node) => node.body) + .forEach((alias) => { + last(aliases)[alias] = name; + }); + } + } + + function visitModuleDeclaration(node: ts.ModuleDeclaration) { + const comment = getDoc(node); + if (shouldIgnore(comment)) { + return; + } + + const name = node.name.text; + const qualifiedName = qualifiers.concat([name]).join('.'); + + setIn(types, [qualifiedName, 'qualifiedName'], qualifiedName); + setIn(types, [qualifiedName, 'doc'], comment); + + if (name !== 'Immutable') { + qualifiers.push(name); + } + aliases.push({}); + + ts.forEachChild(node, visit); + + if (name !== 'Immutable') { + qualifiers.pop(); + } + aliases.pop(); + } + + function visitFunctionDeclaration(node: ts.FunctionDeclaration) { + const comment = getDoc(node); + const name = node.name!.text; + if (shouldIgnore(comment) || isAliased(name)) { + return; + } + addAliases(comment, name); + + const callSignature = parseCallSignature(node); + + const parent = qualifiers.join('.'); + const qualifiedName = qualifiers.concat([name]).join('.'); + + if (!parent || types[qualifiedName]) { + // Top level function + setIn(types, [qualifiedName, 'qualifiedName'], qualifiedName); + setIn(types, [qualifiedName, 'call', 'name'], qualifiedName); + setIn(types, [qualifiedName, 'call', 'label'], qualifiedName + '()'); + setIn(types, [qualifiedName, 'call', 'id'], qualifiedName + '()'); + setIn(types, [qualifiedName, 'call', 'doc'], comment); + pushIn(types, [qualifiedName, 'call', 'signatures'], callSignature); + } else { + // Static method + setIn(types, [parent, 'functions', name, 'name'], qualifiedName); + setIn(types, [parent, 'functions', name, 'label'], qualifiedName + '()'); + setIn(types, [parent, 'functions', name, 'id'], name + '()'); + setIn(types, [parent, 'functions', name, 'isStatic'], true); + const functions = types[parent].functions; + pushIn(functions!, [name, 'signatures'], callSignature); + } + } + + function visitInterfaceDeclaration(node: ts.InterfaceDeclaration) { + const interfaceObj: InterfaceDefinition = { members: {} }; + + const name = node.name.text; + const comment = getDoc(node); + const ignore = shouldIgnore(comment); + if (!ignore) { + const qualifiedName = qualifiers.concat([name]).join('.'); + setIn(types, [qualifiedName, 'qualifiedName'], qualifiedName); + + interfaceObj.line = getLineNum(node); + interfaceObj.doc = comment; + interfaceObj.typeParams = node.typeParameters?.map((tp) => tp.name.text); + + typeParamsScope.push(interfaceObj.typeParams); + + if (node.heritageClauses) { + for (const hc of node.heritageClauses) { + const heritageTypes = hc.types.map(parseType) as Array; + if (hc.token === ts.SyntaxKind.ExtendsKeyword) { + interfaceObj.extends = heritageTypes; + } else if (hc.token === ts.SyntaxKind.ImplementsKeyword) { + interfaceObj.implements = heritageTypes; + } else { + throw new Error('Unknown heritageClause'); + } + } + } + setIn(types, [qualifiedName, 'interface'], interfaceObj); + } + + interfaces.push(interfaceObj); + qualifiers.push(name); + aliases.push({}); + currentGroup = undefined; + + ts.forEachChild(node, visit); + + if (!ignore) { + typeParamsScope.pop(); + } + + interfaces.pop(); + qualifiers.pop(); + aliases.pop(); + } + + function ensureGroup(node: ts.Node) { + for (const trivia of getTrivia(node)) { + if (trivia.kind === ts.SyntaxKind.SingleLineCommentTrivia) { + currentGroup = source.text.substring(trivia.pos + 3, trivia.end); + } + } + } + + function visitPropertySignature(node: ts.PropertySignature) { + if (node.questionToken) { + throw new Error('NYI: questionToken'); + } + + const comment = getDoc(node); + const name = node.name.getText(); + if (!shouldIgnore(comment) && !isAliased(name)) { + addAliases(comment, name); + + ensureGroup(node); + + const interfaceData = last(interfaces); + setIn(interfaceData, ['members', name, 'name'], name); + setIn(interfaceData, ['members', name, 'label'], name); + setIn(interfaceData, ['members', name, 'id'], name); + setIn(interfaceData, ['members', name, 'line'], getLineNum(node)); + setIn(interfaceData, ['members', name, 'group'], currentGroup); + setIn(interfaceData, ['members', name, 'doc'], comment); + setIn( + interfaceData, + ['members', name, 'type'], + node.type && parseType(node.type) + ); + } + + ts.forEachChild(node, visit); + } + + function visitMethodSignature(node: ts.MethodSignature) { + if (node.questionToken) { + throw new Error('NYI: questionToken'); + } + + const interfaceData = last(interfaces); + const comment = getDoc(node); + const name = node.name.getText(); + if (!shouldIgnore(comment) && !isAliased(name)) { + addAliases(comment, name); + + ensureGroup(node); + + setIn(interfaceData, ['members', name, 'name'], name); + setIn(interfaceData, ['members', name, 'label'], name + '()'); + setIn(interfaceData, ['members', name, 'id'], name + '()'); + setIn(interfaceData, ['members', name, 'group'], currentGroup); + setIn(interfaceData, ['members', name, 'doc'], comment); + + const callSignature = parseCallSignature(node); + pushIn(interfaceData, ['members', name, 'signatures'], callSignature); + } + + ts.forEachChild(node, visit); + } + + function parseCallSignature( + node: ts.SignatureDeclarationBase + ): CallSignature { + const typeParams = node.typeParameters?.map((tp) => tp.name.text); + typeParamsScope.push(typeParams); + + const callSignature: CallSignature = { + line: getLineNum(node), + typeParams, + params: + node.parameters.length > 0 + ? node.parameters.map(parseParam) + : undefined, + type: node.type && parseType(node.type), + }; + + typeParamsScope.pop(); + + return callSignature; + } + + function parseType(node: ts.TypeNode): Type { + switch (node.kind) { + case ts.SyntaxKind.NeverKeyword: + return { + k: TypeKind.Never, + }; + case ts.SyntaxKind.AnyKeyword: + return { + k: TypeKind.Any, + }; + case ts.SyntaxKind.UnknownKeyword: + return { + k: TypeKind.Unknown, + }; + case ts.SyntaxKind.ThisType: + return { + k: TypeKind.This, + }; + case ts.SyntaxKind.UndefinedKeyword: + return { + k: TypeKind.Undefined, + }; + case ts.SyntaxKind.BooleanKeyword: + return { + k: TypeKind.Boolean, + }; + case ts.SyntaxKind.NumberKeyword: + return { + k: TypeKind.Number, + }; + case ts.SyntaxKind.StringKeyword: + return { + k: TypeKind.String, + }; + case ts.SyntaxKind.ObjectKeyword: + return { + k: TypeKind.Object, + }; + case ts.SyntaxKind.UnionType: + return { + k: TypeKind.Union, + types: (node as ts.UnionTypeNode).types.map(parseType), + }; + case ts.SyntaxKind.IntersectionType: + return { + k: TypeKind.Intersection, + types: (node as ts.IntersectionTypeNode).types.map(parseType), + }; + case ts.SyntaxKind.TupleType: + return { + k: TypeKind.Tuple, + types: (node as ts.TupleTypeNode).elements.map(parseType), + }; + case ts.SyntaxKind.IndexedAccessType: + return { + k: TypeKind.Indexed, + type: parseType((node as ts.IndexedAccessTypeNode).objectType), + index: parseType((node as ts.IndexedAccessTypeNode).indexType), + }; + case ts.SyntaxKind.TypeOperator: { + const operatorNode = node as ts.TypeOperatorNode; + const operator = + operatorNode.operator === ts.SyntaxKind.KeyOfKeyword + ? 'keyof' + : operatorNode.operator === ts.SyntaxKind.ReadonlyKeyword + ? 'readonly' + : undefined; + if (!operator) { + throw new Error( + 'Unknown operator kind: ' + ts.SyntaxKind[operatorNode.operator] + ); + } + return { + k: TypeKind.Operator, + operator, + type: parseType(operatorNode.type), + }; + } + case ts.SyntaxKind.TypeLiteral: + return { + k: TypeKind.Object, + members: (node as ts.TypeLiteralNode).members.map((m) => { + switch (m.kind) { + case ts.SyntaxKind.IndexSignature: { + const indexNode = m as ts.IndexSignatureDeclaration; + return { + index: true, + params: indexNode.parameters.map(parseParam), + type: parseType(indexNode.type), + }; + } + case ts.SyntaxKind.PropertySignature: { + const propNode = m as ts.PropertySignature; + return { + // Note: this will break on computed or other complex props. + name: (propNode.name as ts.Identifier).text, + type: propNode.type && parseType(propNode.type), + }; + } + } + throw new Error('Unknown member kind: ' + ts.SyntaxKind[m.kind]); + }), + }; + case ts.SyntaxKind.ArrayType: + return { + k: TypeKind.Array, + type: parseType((node as ts.ArrayTypeNode).elementType), + }; + case ts.SyntaxKind.FunctionType: { + const functionNode = node as ts.FunctionTypeNode; + return { + k: TypeKind.Function, + params: functionNode.parameters.map(parseParam), + type: parseType(functionNode.type), + typeParams: functionNode.typeParameters?.map((p) => p.name.text), + }; + } + case ts.SyntaxKind.TypeReference: { + const refNode = node as ts.TypeReferenceNode; + const name = getNameText(refNode.typeName); + if (isTypeParam(name)) { + return { + k: TypeKind.Param, + param: name, + }; + } + return { + k: TypeKind.Type, + name: getNameText(refNode.typeName), + args: refNode.typeArguments?.map(parseType), + }; + } + case ts.SyntaxKind.ExpressionWithTypeArguments: { + const expressionNode = node as ts.ExpressionWithTypeArguments; + return { + k: TypeKind.Type, + name: getNameText(expressionNode.expression), + args: expressionNode.typeArguments?.map(parseType), + }; + } + case ts.SyntaxKind.TypePredicate: + return { + k: TypeKind.Boolean, + }; + case ts.SyntaxKind.MappedType: { + const mappedNode = node as ts.MappedTypeNode; + // Simplification of MappedType to typical Object type. + return { + k: TypeKind.Object, + members: [ + { + index: true, + params: [ + { + name: 'key', + type: { k: TypeKind.String }, + }, + ], + type: parseType(mappedNode.type!), + }, + ], + }; + } + case ts.SyntaxKind.ConditionalType: + case ts.SyntaxKind.RestType: { + return { k: TypeKind.Never }; + } + } + throw new Error('Unknown type kind: ' + ts.SyntaxKind[node.kind]); + } + + function parseParam(node: ts.ParameterDeclaration) { + if (node.name.kind !== ts.SyntaxKind.Identifier) { + throw new Error('NYI: Binding patterns'); + } + if (!node.type) { + throw new Error(`Expected parameter ${node.name.text} to have a type`); + } + const p: CallParam = { + name: node.name.text, + type: parseType(node.type), + }; + if (node.dotDotDotToken) { + p.varArgs = true; + } + if (node.questionToken) { + p.optional = true; + } + if (node.initializer) { + throw new Error('NYI: equalsValueClause'); + } + return p; + } +} + +function getLineNum(node: ts.Node) { + const source = node.getSourceFile(); + return source.getLineAndCharacterOfPosition(node.getStart(source)).line; +} + +const COMMENT_NOTE_RX = /^@(\w+)\s*(.*)$/; + +const NOTE_BLACKLIST: { [key: string]: boolean } = { + override: true, +}; + +function getDoc(node: ts.Node): TypeDoc | undefined { + const trivia = last(getTrivia(node)); + if (!trivia || trivia.kind !== ts.SyntaxKind.MultiLineCommentTrivia) { + return; + } + + const lines = node + .getSourceFile() + .text.substring(trivia.pos, trivia.end) + .split('\n') + .slice(1, -1) + .map((l) => l.trim().slice(2)); + + const paragraphs = lines + .filter((l) => l[0] !== '@') + .join('\n') + .split('\n\n'); + + const synopsis = paragraphs.shift()!; + const description = paragraphs.join('\n\n'); + const notes = lines + .filter((l) => l[0] === '@') + .map((l) => l.match(COMMENT_NOTE_RX)) + // eslint-disable-next-line eqeqeq + .filter((n: T): n is NonNullable => n != null) + .map((n) => ({ name: n[1], body: n[2] })) + .filter((note) => !NOTE_BLACKLIST[note.name]); + + return { + synopsis, + description, + notes, + }; +} + +function getNameText(node: ts.Node): string { + // @ts-expect-error Not included in typed API for some reason. + return ts.entityNameToString(node); +} + +function getTrivia(node: ts.Node): Array { + const sourceFile = node.getSourceFile(); + return ts.getLeadingCommentRanges(sourceFile.text, node.pos) || []; +} + +function last(list: Array): T { + return list && list[list.length - 1]; +} + +function pushIn< + T, + K1 extends keyof T, + A extends NonNullable & Array, + V extends A[number], +>(obj: T, path: readonly [K1], value: V): V; +function pushIn< + T, + K1 extends keyof T, + K2 extends keyof NonNullable, + A extends NonNullable[K2]> & Array, + V extends A[number], +>(obj: T, path: readonly [K1, K2], value: V): V; +function pushIn< + T, + K1 extends keyof T, + K2 extends keyof NonNullable, + K3 extends keyof NonNullable[K2]>, + A extends NonNullable[K2]>[K3]> & + Array, + V extends A[number], +>(obj: T, path: readonly [K1, K2, K3], value: V): V; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function pushIn(obj: any, path: ReadonlyArray, value: any) { + for (let ii = 0; ii < path.length; ii++) { + obj = obj[path[ii]] || (obj[path[ii]] = ii === path.length - 1 ? [] : {}); + } + obj.push(value); + return value; +} + +function setIn( + obj: T, + path: readonly [K1], + value: T[K1] +): void; +function setIn>( + obj: T, + path: readonly [K1, K2], + value: NonNullable[K2] +): void; +function setIn< + T, + K1 extends keyof T, + K2 extends keyof NonNullable, + K3 extends keyof NonNullable[K2]>, +>( + obj: T, + path: readonly [K1, K2, K3], + value: NonNullable[K2]>[K3] +): void; +function setIn< + T, + K1 extends keyof T, + K2 extends keyof NonNullable, + K3 extends keyof NonNullable[K2]>, + K4 extends keyof NonNullable[K2]>[K3]>, +>( + obj: T, + path: readonly [K1, K2, K3, K4], + value: NonNullable[K2]>[K3]>[K4] +): void; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function setIn(obj: any, path: ReadonlyArray, value: any) { + for (let ii = 0; ii < path.length - 1; ii++) { + obj = obj[path[ii]] || (obj[path[ii]] = {}); + } + obj[path[path.length - 1]] = value; +} + +function shouldIgnore(comment: TypeDoc | undefined) { + return Boolean( + comment && + comment.notes && + comment.notes.find( + (note) => note.name === 'ignore' || note.name === 'deprecated' + ) + ); +} diff --git a/website/src/static/getVersions.js b/website/src/static/getVersions.js new file mode 100644 index 0000000000..2e794ce128 --- /dev/null +++ b/website/src/static/getVersions.js @@ -0,0 +1,45 @@ +// eslint-disable-next-line @typescript-eslint/no-require-imports, no-undef +const { execSync } = require('child_process'); + +let versions; +let versionsFromGitTag; + +/** @returns {Array} */ +function getVersions() { + if (!versions) { + // VERSION does not work in sitemap generation + versions = ['v5'].concat(getVersionFromGitTag()); + } + return versions; +} + +/** @returns {Array} */ +function getVersionFromGitTag() { + if (versionsFromGitTag) { + return versionsFromGitTag; + } + + let versions = []; + const tags = execSync('git tag -l --sort=-creatordate', { + encoding: 'utf8', + }).split('\n'); + // const latestV5Tag = tags.find((t) => t.match(/^v?5/)); + const latestV4Tag = tags.find((t) => t.match(/^v?4/)); + const latestV3Tag = tags.find((t) => t.match(/^v?3/)); + + if (latestV4Tag) { + versions.push(latestV4Tag); + } + if (latestV3Tag) { + versions.push(latestV3Tag); + } + + versionsFromGitTag = versions; + + return versions; +} + +// eslint-disable-next-line no-undef +exports.getVersions = getVersions; +// eslint-disable-next-line no-undef +exports.getVersionFromGitTag = getVersionFromGitTag; diff --git a/website/src/static/markdown.ts b/website/src/static/markdown.ts new file mode 100644 index 0000000000..244b0f9e32 --- /dev/null +++ b/website/src/static/markdown.ts @@ -0,0 +1,155 @@ +import { Marked } from 'marked'; +import { markedHighlight } from 'marked-highlight'; +import prism from 'prismjs'; +import type { TypeDefs, CallSignature, TypeDefinition } from '../TypeDefs'; + +export type MarkdownContext = { + defs: TypeDefs; + typeDef?: TypeDefinition; + signatures?: Array; +}; + +function highlight(code: string): string { + return prism.highlight(code, prism.languages.javascript, 'javascript'); +} + +export function markdown(content: string, context: MarkdownContext): string { + if (!content) return content; + + const defs = context.defs; + + // functions comsidee before keywords + // the two following `insertBefore` do change the classes of the tokens, but is this still used? (visual output is the same) + prism.languages.insertBefore('javascript', 'keyword', { + var: /\b(this)\b/g, + 'block-keyword': /\b(if|else|while|for|function)\b/g, + primitive: /\b(true|false|null|undefined)\b/g, + function: prism.languages.javascript.function, + }); + + prism.languages.insertBefore('javascript', 'keyword', { + qualifier: /\b[A-Z][a-z0-9_]+/g, + }); + + const marked = new Marked( + markedHighlight({ + langPrefix: 'hljs language-', + highlight, + }) + ); + + const renderer = new marked.Renderer(); + + renderer.code = function (code: string, lang: string, escaped: boolean) { + return ( + '' + + (escaped ? code : escapeCode(code)) + + '' + ); + }; + + const TYPE_REF_RX = /^(Immutable\.)?([#.\w]+)(?:<\w*>)?(?:\(\w*\))?$/; + const PARAM_RX = /^\w+$/; + const MDN_TYPES: { [name: string]: string } = { + Array: 'Global_Objects/Array', + Object: 'Global_Objects/Object', + JSON: 'Global_Objects/JSON', + Iterable: 'Iteration_protocols#the_iterable_protocol', + Iterator: 'Iteration_protocols#the_iterator_protocol', + }; + const MDN_BASE_URL = + 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/'; + + renderer.codespan = function (text: string) { + return '' + decorateCodeSpan(text) + ''; + }; + + function decorateCodeSpan(text: string) { + if ( + context.signatures && + PARAM_RX.test(text) && + context.signatures.some( + (sig) => sig.params && sig.params.some((param) => param.name === text) + ) + ) { + return '' + text + ''; + } + + const typeRefResult = TYPE_REF_RX.exec(text); + if (typeRefResult) { + const [, immutableNS, elementsStr] = typeRefResult; + const elements = elementsStr.split(/[#.]/g); + const docLink = findTypeRefLink(immutableNS, elements); + if (docLink) { + const target = docLink.startsWith('http') + ? ' target="_blank" rel="noopener"' + : ''; + return `${text}`; + } + } + + return highlight(unescapeCode(text)); + } + + function findTypeRefLink(immutableNS: string, elements: Array) { + // Non namespaced links may resolve to an MDN url. + if (!immutableNS && MDN_TYPES[elements[0]]) { + return ( + MDN_BASE_URL + + MDN_TYPES[elements[0]] + + (elements[1] ? `/${elements[1]}` : '') + ); + } + + // Try to resolve a member relative to the contextual type def if it's not + // a direct namespace reference. + if (!immutableNS && context.typeDef) { + const ctxElements = [context.typeDef.qualifiedName].concat(elements); + const url = findDocsUrl(defs, ctxElements); + if (url) { + return url; + } + } + + return findDocsUrl(defs, elements); + } + + // @ts-expect-error -- issue with "context", probably because we are on a really old version of marked + return marked.parse(content, { renderer, context }); +} + +function findDocsUrl( + defs: TypeDefs, + elements: Array +): string | undefined { + // Try to resolve an interface member + if (elements.length > 1) { + const typeName = elements.slice(0, -1).join('.'); + const memberName = elements[elements.length - 1]; + const memberUrl = defs.types[typeName]?.interface?.members[memberName]?.url; + if (memberUrl) { + return memberUrl; + } + } + + // Otherwise try to resolve a type + return defs.types[elements.join('.')]?.url; +} + +function escapeCode(code: string): string { + return code + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} + +function unescapeCode(code: string): string { + return code + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/'/g, "'") + .replace(/&/g, '&'); +} diff --git a/website/src/static/stripUndefineds.ts b/website/src/static/stripUndefineds.ts new file mode 100644 index 0000000000..a873b5cba6 --- /dev/null +++ b/website/src/static/stripUndefineds.ts @@ -0,0 +1,22 @@ +export function stripUndefineds(obj: unknown) { + if (Array.isArray(obj)) { + for (const value of obj) { + stripUndefineds(value); + } + } else if (isObj(obj)) { + for (const prop in obj) { + if (obj.hasOwnProperty(prop)) { + const value = obj[prop]; + if (value === undefined) { + delete obj[prop]; + } else { + stripUndefineds(value); + } + } + } + } +} + +function isObj(value: unknown): value is { [prop: string]: unknown } { + return typeof value === 'object' && value !== null; +} diff --git a/website/src/useDarkMode.ts b/website/src/useDarkMode.ts new file mode 100644 index 0000000000..ccaac8d9cc --- /dev/null +++ b/website/src/useDarkMode.ts @@ -0,0 +1,18 @@ +import { useEffect, useState } from 'react'; + +export default function useDarkMode(): boolean { + const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); + const [darkMode, setDarkMode] = useState(darkModeMediaQuery.matches); + + useEffect(() => { + const handleChange = (e: MediaQueryListEvent) => { + setDarkMode(e.matches); + }; + darkModeMediaQuery.addEventListener('change', handleChange); + return () => { + darkModeMediaQuery.removeEventListener('change', handleChange); + }; + }, [darkModeMediaQuery]); + + return darkMode; +} diff --git a/website/src/utils/doc.tsx b/website/src/utils/doc.tsx new file mode 100644 index 0000000000..d519730bb4 --- /dev/null +++ b/website/src/utils/doc.tsx @@ -0,0 +1,26 @@ +import fs from 'node:fs'; +import path from 'node:path'; + +function getMDXFiles(dir: string): Array { + return fs.readdirSync(dir).filter((file) => path.extname(file) === '.mdx'); +} + +function getMDXData(dir: string): Array<{ slug: string }> { + const files = getMDXFiles(dir); + + console.log('files', files); + + return files.map((file) => { + const slug = path.basename(file, path.extname(file)); + + return { + slug, + }; + }); +} + +export function getDocFiles() { + const docsDir = path.join(process.cwd(), 'docs'); + + return getMDXData(docsDir); +} diff --git a/website/src/worker/index.ts b/website/src/worker/index.ts new file mode 100644 index 0000000000..1df4dc9eea --- /dev/null +++ b/website/src/worker/index.ts @@ -0,0 +1,138 @@ +/// +import type * as ImmutableModule from '../../../type-definitions/immutable.js'; +import normalizeResult, { DevToolsFormatter } from './normalizeResult'; + +// Declare Immutable and immutableDevTools as they come from external scripts +declare const Immutable: typeof ImmutableModule; + +declare function immutableDevTools(immutable: typeof ImmutableModule): void; + +// Declare globalThis.devtoolsFormatters +declare global { + // eslint-disable-next-line no-var + var devtoolsFormatters: DevToolsFormatter[]; +} + +importScripts( + 'https://cdn.jsdelivr.net/npm/immutable@5.1.1', + 'https://cdn.jsdelivr.net/npm/@jdeniau/immutable-devtools@0.2.0' +); + +// extract all Immutable exports to have them available in the worker automatically +/* eslint-disable @typescript-eslint/no-unused-vars */ +const { + // @ts-expect-error type is not exported but runtime is OK + version, + Collection, + // @ts-expect-error type is not exported but runtime is OK + // Note: Iterable is deprecated, alias for Collection + Iterable, + Seq, + Map, + OrderedMap, + List, + Stack, + Set, + OrderedSet, + PairSorting, + Record, + Range, + Repeat, + is, + fromJS, + hash, + isImmutable, + isCollection, + isKeyed, + isIndexed, + isAssociative, + isOrdered, + // @ts-expect-error type is not exported but runtime is OK + isPlainObject, + isValueObject, + isSeq, + isList, + isMap, + isOrderedMap, + isStack, + isSet, + isOrderedSet, + isRecord, + get, + getIn, + has, + hasIn, + merge, + mergeDeep, + mergeWith, + mergeDeepWith, + remove, + removeIn, + set, + setIn, + update, + updateIn, +} = Immutable; +/* eslint-enable @typescript-eslint/no-unused-vars */ + +immutableDevTools(Immutable); + +// hack to get the formatters from immutable-devtools as they are not exported, but they modify the "global" variable +const immutableFormaters = globalThis.devtoolsFormatters; + +self.onmessage = function (event) { + const timeoutId = setTimeout(() => { + self.postMessage({ error: 'Execution timed out' }); + self.close(); + }, 2000); + + try { + // track globalThis variables to remove them later + + // if (!globalThis.globalThisKeysBefore) { + // globalThis.globalThisKeysBefore = [...Object.keys(globalThis)]; + // } + + const code = event.data; + + // track const and let variables into global scope to record them + + // it might make a userland code fail with a conflict. + + // We might want to indicate the user in the REPL that they should not use let/const if they want to have the result returned + + // code = code.replace(/^(const|let|var) /gm, ''); + + const result = eval(code); + + // const globalThisKeys = Object.keys(globalThis).filter((key) => { + + // return !globalThisKeysBefore.includes(key) && key !== 'globalThisKeysBefore'; + + // }); + + // console.log(globalThisKeys) + + clearTimeout(timeoutId); + + // TODO handle more than one result + + // if (!result) { + + // // result = globalThis[globalThisKeys[0]]; + + // result = globalThisKeys.map((key) => { + + // globalThis[key]; + + // }); + + // } + + self.postMessage({ output: normalizeResult(immutableFormaters, result) }); + } catch (error) { + console.log(error); + clearTimeout(timeoutId); + self.postMessage({ error: String(error) }); + } +}; diff --git a/website/src/worker/jsonml-types.test.ts b/website/src/worker/jsonml-types.test.ts new file mode 100644 index 0000000000..07426d8c42 --- /dev/null +++ b/website/src/worker/jsonml-types.test.ts @@ -0,0 +1,104 @@ +import { describe, it, expect } from '@jest/globals'; +import { Element, explodeElement } from './jsonml-types'; + +describe('explodeElement', () => { + it('should explode an element', () => { + expect(explodeElement(['div'])).toEqual({ + tagName: 'div', + attributes: undefined, + children: [], + }); + }); + + it('should explode an element with attributes', () => { + expect(explodeElement(['div', { id: 'test' }])).toEqual({ + tagName: 'div', + attributes: { id: 'test' }, + children: [], + }); + }); + + it('should explode an element with children', () => { + expect(explodeElement(['div', { id: 'test' }, 'Hello'])).toEqual({ + tagName: 'div', + attributes: { id: 'test' }, + children: ['Hello'], + }); + }); + + it('should explode an element with multiple children', () => { + expect(explodeElement(['div', { id: 'test' }, 'Hello', 'World'])).toEqual({ + tagName: 'div', + attributes: { id: 'test' }, + children: ['Hello', 'World'], + }); + }); + + it('should explode an element without attributes with multiple children', () => { + expect(explodeElement(['div', 'Hello', 'World'])).toEqual({ + tagName: 'div', + attributes: undefined, + children: ['Hello', 'World'], + }); + }); + + it('should explode an element with a nested element', () => { + expect(explodeElement(['div', { id: 'test' }, ['span', 'Hello']])).toEqual({ + tagName: 'div', + attributes: { id: 'test' }, + children: [['span', 'Hello']], + }); + }); + + it('should explode an element with a nested element with attributes', () => { + expect( + explodeElement([ + 'div', + { id: 'test' }, + ['span', { class: 'test' }, 'Hello'], + ]) + ).toEqual({ + tagName: 'div', + attributes: { id: 'test' }, + children: [['span', { class: 'test' }, 'Hello']], + }); + }); + + it('should explode an element with a nested element with multiple children', () => { + expect( + explodeElement([ + 'div', + { id: 'test' }, + ['span', 'Hello'], + ['span', { id: 'world' }, 'World'], + ]) + ).toEqual({ + tagName: 'div', + attributes: { id: 'test' }, + children: [ + ['span', 'Hello'], + ['span', { id: 'world' }, 'World'], + ], + }); + }); + + it('should handle immutable list jsonml', () => { + const spanElement: Element = [ + 'span', + { style: 'color: light-dark( #881391, #D48CE6)' }, + '0: ', + ]; + const objectElement: Element = ['object', { object: ['a'] }]; + + const element: Element = ['li', spanElement, objectElement]; + + expect(explodeElement(element)).toEqual({ + tagName: 'li', + attributes: undefined, + children: [ + ['span', { style: 'color: light-dark( #881391, #D48CE6)' }, '0: '], + ['object', { object: ['a'] }], + ], + }); + }); +}); diff --git a/website/src/worker/jsonml-types.ts b/website/src/worker/jsonml-types.ts new file mode 100644 index 0000000000..1eadcef8e6 --- /dev/null +++ b/website/src/worker/jsonml-types.ts @@ -0,0 +1,76 @@ +/** + * TypeScript types representing a JsonML grammar + * + * This represents a JSON-based markup language where elements are represented as arrays: + * - First element is the tag name + * - Second element (optional) is an attributes object + * - Remaining elements are children + */ + +// Basic types +type TagName = string; +type AttributeName = string; +type AttributeValue = string | number | boolean | null | object; + +// Attributes +// type Attribute = [AttributeName, AttributeValue]; +// type AttributeList = Attribute[]; +export type Attributes = Record; + +type ElementWithAttributes = + | [TagName, Attributes, ...Element[]] // [tag-name, attributes, element-list] + | [TagName, Attributes]; // [tag-name, attributes] + +// Elements +export type Element = + | ElementWithAttributes + | [TagName, ...Element[]] // [tag-name, element-list] + | [TagName] // [tag-name] + | string; // string + +// Element list is just a list of elements +export type JsonMLElementList = Array; + +export function isElement(maybeElement: unknown): maybeElement is Element { + return ( + typeof maybeElement === 'string' || + (Array.isArray(maybeElement) && + maybeElement.length >= 1 && + typeof maybeElement[0] === 'string') + ); +} + +function hasAttributes( + maybeElementWithAttributes: Element +): maybeElementWithAttributes is ElementWithAttributes { + return ( + Array.isArray(maybeElementWithAttributes) && + typeof maybeElementWithAttributes[1] === 'object' && + !Array.isArray(maybeElementWithAttributes[1]) + ); +} + +type ExplodedElement = { + tagName: TagName; + attributes?: Attributes; + children: Element[]; +}; + +export function explodeElement(element: Element): ExplodedElement { + if (typeof element === 'string') { + return { tagName: element, children: [] }; + } + + if (hasAttributes(element)) { + const [tagName, attributes, ...children] = element; + + return { tagName, attributes, children }; + } + + const [tagName, attributes, ...children] = element; + + return { + tagName, + children: [attributes, ...children].filter(isElement), + }; +} diff --git a/website/src/worker/normalizeResult.test.ts b/website/src/worker/normalizeResult.test.ts new file mode 100644 index 0000000000..c46f512204 --- /dev/null +++ b/website/src/worker/normalizeResult.test.ts @@ -0,0 +1,117 @@ +import { describe, it, expect } from '@jest/globals'; +// @ts-expect-error immutable is loaded automatically +import * as Immutable from 'immutable'; +import normalizeResult from './normalizeResult'; + +// eslint-disable-next-line @typescript-eslint/no-require-imports -- import does not work +const installDevTools = require('@jdeniau/immutable-devtools'); + +installDevTools(Immutable); + +// hack to get the formatters from immutable-devtools as they are not exported, but they modify the "global" variable +const immutableFormaters = globalThis.devtoolsFormatters; + +describe('normalizeResult', () => { + it('should return the correct object', () => { + const result = normalizeResult(immutableFormaters, { a: 1, b: 2 }); + + expect(result).toEqual(JSON.stringify({ a: 1, b: 2 })); + }); + + it('should return the correct object for a list', () => { + const result = normalizeResult(immutableFormaters, Immutable.List(['a'])); + + expect(result).toEqual([ + 'span', + [ + 'span', + [ + 'span', + { + style: + 'color: light-dark(rgb(232,98,0), rgb(255, 150, 50)); position: relative', + }, + 'List', + ], + ['span', '[1]'], + ], + [ + 'ol', + { + style: + 'list-style-type: none; padding: 0; margin: 0 0 0 12px; font-style: normal; position: relative', + }, + [ + 'li', + ['span', { style: 'color: light-dark( #881391, #D48CE6)' }, '0: '], + ['object', { object: 'a', config: undefined }], + ], + ], + ]); + }); + + it('should return the correct object for a deep list', () => { + const result = normalizeResult( + immutableFormaters, + Immutable.List([Immutable.List(['a'])]) + ); + + expect(result).toEqual([ + 'span', + [ + 'span', + [ + 'span', + { + style: + 'color: light-dark(rgb(232,98,0), rgb(255, 150, 50)); position: relative', + }, + 'List', + ], + ['span', '[1]'], + ], + [ + 'ol', + { + style: + 'list-style-type: none; padding: 0; margin: 0 0 0 12px; font-style: normal; position: relative', + }, + [ + 'li', + ['span', { style: 'color: light-dark( #881391, #D48CE6)' }, '0: '], + [ + 'span', + [ + 'span', + [ + 'span', + { + style: + 'color: light-dark(rgb(232,98,0), rgb(255, 150, 50)); position: relative', + }, + 'List', + ], + ['span', '[1]'], + ], + [ + 'ol', + { + style: + 'list-style-type: none; padding: 0; margin: 0 0 0 12px; font-style: normal; position: relative', + }, + [ + 'li', + [ + 'span', + { style: 'color: light-dark( #881391, #D48CE6)' }, + '0: ', + ], + ['object', { object: 'a', config: undefined }], + ], + ], + ], + ], + ], + ]); + }); +}); diff --git a/website/src/worker/normalizeResult.ts b/website/src/worker/normalizeResult.ts new file mode 100644 index 0000000000..f341ed4de7 --- /dev/null +++ b/website/src/worker/normalizeResult.ts @@ -0,0 +1,90 @@ +import { + Element, + explodeElement, + isElement, + JsonMLElementList, +} from './jsonml-types'; + +export interface DevToolsFormatter { + header: (obj: unknown) => JsonMLElementList | null; + hasBody: (obj: unknown) => boolean; + body: (obj: unknown) => JsonMLElementList | null; +} + +function getFormatter( + immutableFormaters: Array, + result: unknown +) { + return immutableFormaters.find((formatter) => formatter.header(result)); +} + +export default function normalizeResult( + immutableFormaters: Array, + result: unknown +): JsonMLElementList | Element { + const formatter = getFormatter(immutableFormaters, result); + + if (!formatter) { + if (Array.isArray(result) && result[0] === 'object' && result[1]?.object) { + // handle special case for deep objects + const objectFormatter = getFormatter( + immutableFormaters, + result[1].object + ); + + if (objectFormatter) { + return normalizeResult(immutableFormaters, result[1].object); + } + } + + if (typeof result !== 'string' && isElement(result)) { + return normalizeElement(immutableFormaters, result); + } + + if (typeof result === 'string') { + return result; + } + + return JSON.stringify(result); + } + + const header = formatter.header(result) ?? []; + + let body: JsonMLElementList | null = formatter.hasBody(result) + ? formatter.body(result) + : null; + + if (body) { + body = body.map((item) => normalizeElement(immutableFormaters, item)); + } + + return ['span', header, body ?? []]; +} + +function normalizeElement( + immutableFormaters: Array, + item: Element | JsonMLElementList +): Element | JsonMLElementList { + if (!Array.isArray(item)) { + return item; + } + + if (!isElement(item)) { + return item; + } + + const explodedItem = explodeElement(item); + + const { tagName, attributes, children } = explodedItem; + + const normalizedChildren = children.map((child) => + normalizeResult(immutableFormaters, child) + ); + + if (attributes) { + // @ts-expect-error type is not perfect here because of self-reference + return [tagName, attributes, ...normalizedChildren]; + } + + return [tagName, ...normalizedChildren]; +} diff --git a/website/styles/globals.css b/website/styles/globals.css new file mode 100644 index 0000000000..fcd08657db --- /dev/null +++ b/website/styles/globals.css @@ -0,0 +1,622 @@ +@import url('https://code.cdn.mozilla.net/fonts/fira.css'); + +:root { + color-scheme: light dark; +} + +html, +body { + --link-color: #4183c4; + --link-hover-color: #2b6db0; + --header-color: #212325; + --header-bg-color: #6dbcdb; + --body-color: #626466; + --code-block-bg-color: #f4f4f4; + --code-block-color: #484a4c; + --anchor-link-color: #9ca0a3; + + background-color: #ffffff; + color: var(--body-color); + + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + margin: 0; + padding: 0; + -webkit-font-smoothing: antialiased; +} + +@media (prefers-color-scheme: dark) { + html, + body { + --link-color: #79a6f6; + --link-hover-color: #5683d4; + --header-color: #e0e0e0; + --header-bg-color: #2b3a42; + --body-color: #c0c0c0; + --code-block-bg-color: #2e2e2e; + --code-block-color: #d1d5da; + --anchor-link-color: #616161; + + background-color: #121212; + } +} + +body, +input { + color: var(--body-color); + font-family: 'Fira Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-size: 16px; + line-height: 1.625; +} + +@media only screen and (max-width: 680px) { + body, + input { + font-size: 14px; + } +} + +h1, +h2, +h3, +h4, +h5, +h6 { + color: var(--header-color); +} + +h1 { + color: light-dark(#555, #fff); + font-size: 1.5em; + margin: 1rem 0; + font-weight: bold; +} + +h1.mainTitle { + font-size: 2em; + margin: 1.34rem 0; +} + +h2 { + margin: 4rem 0 1 rem; + color: #9a9c9e; + font-size: 1.5em; + font-weight: 300; + margin: 3rem 0 2rem; +} + +h3 { + margin: 2rem 0 1rem; +} + +h4 { + margin: 1rem 0 0; + color: var(--body-color); +} + +a, +a > code { + color: var(--link-color); + text-decoration: none; +} + +a:hover { + color: var(--link-hover-color); +} + +pre, +code { + font-family: 'Fira Mono', Menlo, monospace; + background: var(--code-block-bg-color); + color: var(--code-block-color); + font-size: 0.9375em; + letter-spacing: -0.015em; +} + +code { + margin: -0.05rem -0.15em; + padding: 0.05rem 0.35em; +} + +blockquote { + margin: 1rem 0; + padding: 0 1rem; + color: #727476; + border-left: solid 3px #dcdad9; +} + +blockquote > :first-child { + margin-top: 0; +} + +blockquote > :last-child { + margin-bottom: 0; +} + +/* Markdown */ + +pre > code, +.codeBlock { + -webkit-overflow-scrolling: touch; + background: var(--code-block-bg-color); + border-left: solid 3px #eceae9; + box-sizing: border-box; + display: block; + font-size: 0.875em; + margin: 0.5rem 0; + overflow-y: scroll; + padding: 0.5rem 8px 0.5rem 12px; + white-space: pre-wrap; + position: relative; + word-break: break-all; +} + +.t.blockParams { + padding-left: 2ch; +} + +a.try-it { + position: absolute; + cursor: pointer; + right: 1em; + border: 0; + background: transparent; + border-bottom: 2px solid rgba(49, 50, 137, 0.2); + color: rgba(49, 50, 137, 1); +} + +/* Home */ + +.header { + -webkit-touch-callout: none; + user-select: none; +} + +.pageBody { + padding: 0 36px; + position: relative; +} + +@media only screen and (max-width: 1024px) { + .pageBody { + padding: 0; + } +} + +.contents { + margin: 0 auto; + max-width: 1024px; + padding: 64px 0; + position: relative; + display: flex; + flex-direction: row-reverse; +} + +.contents > .docContents { + flex-grow: 1; + max-width: calc(1024px - 340px); /* contents width minus sidebar */ +} + +img { + max-width: 1024px; +} + +.markdown h1 { + font-size: 2em; + margin: 0 0 1rem; +} + +.markdown h2 { + font-size: 1.5em; + padding-top: 100px; + margin: calc(4rem - 100px) 0 1rem; +} + +.markdown h3 { + font-size: 1.25em; + padding-top: 100px; + margin: calc(2rem - 100px) 0 1rem; +} + +.markdown h4, +.markdown h5, +.markdown h6 { + font-size: 1em; + padding-top: 100px; + margin: calc(1rem - 100px) 0 0; +} + +.miniHeader { + background: var(--header-bg-color); + position: fixed; + width: 100%; + z-index: 1; +} + +.miniHeaderContents { + margin: 0 auto; + max-width: 1024px; + padding: 12px 36px; + position: relative; + text-align: right; +} + +@media only screen and (max-width: 680px) { + .miniHeaderContents { + padding: 12px; + } +} + +.miniLogo { + float: left; + left: -140px; + top: 12px; +} + +@media only screen and (max-width: 680px) { + .miniLogo { + display: none; + } +} + +.miniLogo > .svg { + height: 24px; +} + +.miniHeaderContents .links a { + color: #fff; + font-weight: bold; + text-decoration: none; + text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); +} + +.miniHeaderContents .links > * { + margin-right: 1em; +} + +.miniHeaderContents .links > *:last-child { + margin-right: 0; +} + +.coverContainer { + background-color: #c1c6c8; + height: 70vh; + max-height: 800px; + min-height: 260px; + outline: solid 1px rgba(0, 0, 0, 0.28); + overflow: hidden; + position: relative; + width: 100%; + z-index: 1; +} + +.cover { + height: 70vh; + max-height: 800px; + min-height: 260px; + position: absolute; + width: 100%; + clip: rect(0, auto, auto, 0); +} + +.coverFixed { + align-items: center; + display: flex; + flex-direction: column; + height: 100%; + justify-content: center; + position: fixed; + width: 100%; + top: 0; + height: 70vh; + max-height: 800px; +} + +.filler { + flex: 10; + width: 100%; +} + +.synopsis { + box-sizing: border-box; + flex: 10; + max-width: 700px; + padding: 0 30px; + pointer-events: none; + position: relative; + width: 100%; +} + +.logo { + bottom: 0; + left: 60px; + position: absolute; + right: 60px; + top: 0; +} + +.logo > .svg { + height: 100%; + position: absolute; + width: 100%; +} + +.buttons { + align-items: center; + display: flex; + flex: 10; +} + +@media only screen and (max-width: 680px) { + .filler { + visibility: hidden; + } + + .coverContainer, + .cover { + max-height: 260px; + } + + .coverFixed { + max-height: 260px; + } + + .miniHeader { + position: relative; + } + + .synopsis { + max-width: 540px; + } + + .logo { + left: 30px; + right: 30px; + } + + .contents { + padding-top: 24px; + } + + .contents img { + max-width: 100%; + } + + .pageBody { + padding: 0 12px; + } +} + +/* Docs */ +.algolia-autocomplete { + width: 100%; + margin-bottom: 32px; +} + +.docSearch { + padding: 8px 16px; + border-radius: 20px; + border: solid 1px #eee; + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.15); + width: 100%; +} + +.docSearch:focus { + outline: none; + background: #f6f6f6; + border-color: var(--link-color); +} + +@media only screen and (max-width: 680px) { + .docSearch { + width: calc(100vw - 40px); + max-width: initial; + } +} + +.disclaimer { + margin: 60px 0 0 0; + border: solid 1px #eecccc; + background: #fefafa; + padding: 1em; + text-align: center; + font-size: 0.8em; + position: relative; +} + +@media only screen and (max-width: 680px) { + .disclaimer { + margin: 60px 0 0; + } +} + +.toolBar { + cursor: default; + user-select: none; + color: #888; + cursor: pointer; +} + +.toolBar .selected { + color: #141420; +} + +@media (prefers-color-scheme: dark) { + .toolBar { + color: #bbb; + } + + .toolBar .selected { + color: #fff; + } +} + +@media only screen and (max-width: 680px) { + .toolBar { + display: none; + } +} + +.sideBar { + position: sticky; + top: 64px; + height: calc(100vh - 64px - 20px); + margin-left: 40px; + cursor: default; + user-select: none; + z-index: 0; +} + +.sideBar__background { + position: fixed; + height: 100%; + background: var(--code-block-bg-color); + width: 100%; + z-index: -1; + margin-left: -20px; + top: 0; +} + +.sideBar__Link { + padding: 5px 0; +} + +.sideBar__Link--active { + font-weight: bold; + padding-bottom: 0; +} + +.sideBar__Arrow--active { + transform: rotate(180deg); +} + +@media only screen and (max-width: 680px) { + .sideBar { + display: none; + } +} + +.sideBar .scrollContent { + box-sizing: border-box; + height: 100%; + width: 300px; + overflow: hidden auto; +} + +.sideBar h2 { + font-size: 1em; + margin: 1em 0; + + position: relative; +} + +.sideBar h2 a { + font-weight: normal; +} + +.sideBar .members { + margin: 0 0 1em 0em; + border-bottom: 1px solid #dddddd; + padding-bottom: 0.5em; +} + +.sideBar .groupTitle { + color: var(--body-color); + font-size: 1em; + margin: 0.3em 0 0; +} + +.t a { + transition: background-color 0.15s; + background-color: rgba(0, 0, 0, 0.01); + border-radius: 4px; + box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.08); + margin: -2px -4px; + padding: 2px 4px; +} + +.t a:hover { + background-color: rgba(112, 170, 220, 0.2); +} + +.interfaceMember { + padding-top: 4rem; + margin-top: -5rem; +} + +.infoHeader { + color: light-dark(#555, #fff); + font-size: 10px; + letter-spacing: 0.25ch; + line-height: 16px; + margin: 1rem 0 0.125rem; + text-transform: uppercase; +} + +.docSynopsis { + margin: -0.5em 0 1em; +} + +.discussion p:first-child { + margin-top: 0.5em; +} + +.memberSignature { + border-left-color: #9cdae9; + background: var(--code-block-bg-color); +} + +.t.over { + border-bottom: solid 2px rgba(0, 0, 0, 0.05); + padding-bottom: 3px; +} + +.memberLabel { + font-size: 1em; +} + +@media only screen and (max-width: 680px) { + .memberLabel { + cursor: default; + user-select: none; + cursor: pointer; + } +} + +.detail { + box-sizing: border-box; + margin-bottom: 2.6rem; + overflow: hidden; +} + +.groupTitle { + color: #9a9c9e; + font-size: 1.5em; + font-weight: 300; + margin: 3rem 0 2rem; +} + +@media only screen and (max-width: 680px) { + .groupTitle { + margin: 2em 0 1em; + } +} + +.doc { + margin: 2em 0 3em; +} + +p:last-child { + margin-bottom: 0; +} + +.memberLabel .anchorLink { + display: none; + margin-left: 0.25em; + color: var(--anchor-link-color); +} + +.memberLabel:hover .anchorLink { + display: inline; +} diff --git a/website/styles/prism-theme.css b/website/styles/prism-theme.css new file mode 100644 index 0000000000..3a934ab4bd --- /dev/null +++ b/website/styles/prism-theme.css @@ -0,0 +1,270 @@ +/** + * prism.js default theme for JavaScript, CSS and HTML + * Based on dabblet (http://dabblet.com) + * @author Lea Verou + */ + +code[class*='language-'], +pre[class*='language-'] { + color: black; + background: none; + text-shadow: 0 1px white; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*='language-']::-moz-selection, +pre[class*='language-'] ::-moz-selection, +code[class*='language-']::-moz-selection, +code[class*='language-'] ::-moz-selection { + text-shadow: none; + background: #b3d4fc; +} + +pre[class*='language-']::selection, +pre[class*='language-'] ::selection, +code[class*='language-']::selection, +code[class*='language-'] ::selection { + text-shadow: none; + background: #b3d4fc; +} + +@media print { + code[class*='language-'], + pre[class*='language-'] { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*='language-'] { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +:not(pre) > code[class*='language-'], +pre[class*='language-'] { + background: #f5f2f0; +} + +/* Inline code */ +:not(pre) > code[class*='language-'] { + padding: 0.1em; + border-radius: 0.3em; + white-space: normal; +} + +.token.comment, +.token.prolog, +.token.doctype, +.token.cdata { + color: slategray; +} + +.token.punctuation { + color: #999; +} + +.token.namespace { + opacity: 0.7; +} + +.token.property, +.token.tag, +.token.boolean, +.token.number, +.token.constant, +.token.symbol, +.token.deleted { + color: #905; +} + +.token.selector, +.token.attr-name, +.token.string, +.token.char, +.token.builtin, +.token.inserted { + color: #690; +} + +.token.operator, +.token.entity, +.token.url, +.language-css .token.string, +.style .token.string { + color: #9a6e3a; + /* This background color was intended by the author of this theme. */ + background: hsla(0, 0%, 100%, 0.5); +} + +.token.atrule, +.token.attr-value, +.token.keyword { + color: #07a; +} + +.token.function, +.token.class-name { + color: #dd4a68; +} + +.token.regex, +.token.important, +.token.variable { + color: #e90; +} + +.token.important, +.token.bold { + font-weight: bold; +} +.token.italic { + font-style: italic; +} + +.token.entity { + cursor: help; +} + +@media (prefers-color-scheme: dark) { + /** + * okaidia theme for JavaScript, CSS and HTML + * Loosely based on Monokai textmate theme by http://www.monokai.nl/ + * @author ocodia + */ + + code[class*='language-'], + pre[class*='language-'] { + color: #f8f8f2; + background: none; + text-shadow: 0 1px rgba(0, 0, 0, 0.3); + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + } + + /* Code blocks */ + pre[class*='language-'] { + padding: 1em; + margin: 0.5em 0; + overflow: auto; + border-radius: 0.3em; + } + + :not(pre) > code[class*='language-'], + pre[class*='language-'] { + background: #272822; + } + + /* Inline code */ + :not(pre) > code[class*='language-'] { + padding: 0.1em; + border-radius: 0.3em; + white-space: normal; + } + + .token.comment, + .token.prolog, + .token.doctype, + .token.cdata { + color: #8292a2; + } + + .token.punctuation { + color: #f8f8f2; + } + + .token.namespace { + opacity: 0.7; + } + + .token.property, + .token.tag, + .token.constant, + .token.symbol, + .token.deleted { + color: #f92672; + } + + .token.boolean, + .token.number { + color: #ae81ff; + } + + .token.selector, + .token.attr-name, + .token.string, + .token.char, + .token.builtin, + .token.inserted { + color: #a6e22e; + } + + .token.operator, + .token.entity, + .token.url, + .language-css .token.string, + .style .token.string, + .token.variable { + color: #f8f8f2; + } + + .token.atrule, + .token.attr-value, + .token.function, + .token.class-name { + color: #e6db74; + } + + .token.keyword { + color: #66d9ef; + } + + .token.regex, + .token.important { + color: #fd971f; + } + + .token.important, + .token.bold { + font-weight: bold; + } + .token.italic { + font-style: italic; + } + + .token.entity { + cursor: help; + } +} diff --git a/website/tsconfig.json b/website/tsconfig.json new file mode 100644 index 0000000000..182bdd6a14 --- /dev/null +++ b/website/tsconfig.json @@ -0,0 +1,36 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "baseUrl": "src/", + "paths": { + "@/docs/*": ["../docs/*"], + "@/*": ["./*"] + }, + "plugins": [ + { + "name": "next" + } + ] + }, + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + "src/**/*.js", + ".next/types/**/*.ts" + ], + "exclude": ["node_modules"] +}