diff --git a/node_modules/side-channel-map/CHANGELOG.md b/node_modules/side-channel-map/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..b6ccea906b109d2fbdeab5033ef37fcf3c677451
--- /dev/null
+++ b/node_modules/side-channel-map/CHANGELOG.md
@@ -0,0 +1,22 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [v1.0.1](https://github.com/ljharb/side-channel-map/compare/v1.0.0...v1.0.1) - 2024-12-10
+
+### Commits
+
+- [Deps] update `call-bound` [`6d05aaa`](https://github.com/ljharb/side-channel-map/commit/6d05aaa4ce5f2be4e7825df433d650696f0ba40f)
+- [types] fix generics ordering [`11c0184`](https://github.com/ljharb/side-channel-map/commit/11c0184132ac11fdc16857e12682e148e5e9ee74)
+
+## v1.0.0 - 2024-12-10
+
+### Commits
+
+- Initial implementation, tests, readme, types [`ad877b4`](https://github.com/ljharb/side-channel-map/commit/ad877b42926d46d63fff76a2bd01d2b4a01959a9)
+- Initial commit [`28f8879`](https://github.com/ljharb/side-channel-map/commit/28f8879c512abe8fcf9b6a4dc7754a0287e5eba4)
+- npm init [`2c9604e`](https://github.com/ljharb/side-channel-map/commit/2c9604e5aa40223e425ea7cea78f8a07697504bd)
+- Only apps should have lockfiles [`5e7ba9c`](https://github.com/ljharb/side-channel-map/commit/5e7ba9cffe3ef42095815adc8ac1255b49bbadf5)
diff --git a/node_modules/side-channel-map/LICENSE b/node_modules/side-channel-map/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..f82f38963b0d282b529f64def2bcd40be3a9a947
--- /dev/null
+++ b/node_modules/side-channel-map/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2024 Jordan Harband
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/side-channel-map/README.md b/node_modules/side-channel-map/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..8fa6f77f07d10658117ff4f4ed4af647e3bd7c40
--- /dev/null
+++ b/node_modules/side-channel-map/README.md
@@ -0,0 +1,62 @@
+# side-channel-map [![Version Badge][npm-version-svg]][package-url]
+
+[![github actions][actions-image]][actions-url]
+[![coverage][codecov-image]][codecov-url]
+[![License][license-image]][license-url]
+[![Downloads][downloads-image]][downloads-url]
+
+[![npm badge][npm-badge-png]][package-url]
+
+Store information about any JS value in a side channel, using a Map.
+
+Warning: if the `key` is an object, this implementation will leak memory until you `delete` it.
+Use [`side-channel`](https://npmjs.com/side-channel) for the best available strategy.
+
+## Getting started
+
+```sh
+npm install --save side-channel-map
+```
+
+## Usage/Examples
+
+```js
+const assert = require('assert');
+const getSideChannelMap = require('side-channel-map');
+
+const channel = getSideChannelMap();
+
+const key = {};
+assert.equal(channel.has(key), false);
+assert.throws(() => channel.assert(key), TypeError);
+
+channel.set(key, 42);
+
+channel.assert(key); // does not throw
+assert.equal(channel.has(key), true);
+assert.equal(channel.get(key), 42);
+
+channel.delete(key);
+assert.equal(channel.has(key), false);
+assert.throws(() => channel.assert(key), TypeError);
+```
+
+## Tests
+
+Clone the repo, `npm install`, and run `npm test`
+
+[package-url]: https://npmjs.org/package/side-channel-map
+[npm-version-svg]: https://versionbadg.es/ljharb/side-channel-map.svg
+[deps-svg]: https://david-dm.org/ljharb/side-channel-map.svg
+[deps-url]: https://david-dm.org/ljharb/side-channel-map
+[dev-deps-svg]: https://david-dm.org/ljharb/side-channel-map/dev-status.svg
+[dev-deps-url]: https://david-dm.org/ljharb/side-channel-map#info=devDependencies
+[npm-badge-png]: https://nodei.co/npm/side-channel-map.png?downloads=true&stars=true
+[license-image]: https://img.shields.io/npm/l/side-channel-map.svg
+[license-url]: LICENSE
+[downloads-image]: https://img.shields.io/npm/dm/side-channel-map.svg
+[downloads-url]: https://npm-stat.com/charts.html?package=side-channel-map
+[codecov-image]: https://codecov.io/gh/ljharb/side-channel-map/branch/main/graphs/badge.svg
+[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel-map/
+[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel-map
+[actions-url]: https://github.com/ljharb/side-channel-map/actions
diff --git a/node_modules/side-channel-map/index.d.ts b/node_modules/side-channel-map/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..de33e899e66db27eac77bb85d1b8afe183272e85
--- /dev/null
+++ b/node_modules/side-channel-map/index.d.ts
@@ -0,0 +1,15 @@
+declare namespace getSideChannelMap {
+ type Channel = {
+ assert: (key: K) => void;
+ has: (key: K) => boolean;
+ get: (key: K) => V | undefined;
+ set: (key: K, value: V) => void;
+ delete: (key: K) => boolean;
+ };
+}
+
+declare function getSideChannelMap(): getSideChannelMap.Channel;
+
+declare const x: false | typeof getSideChannelMap;
+
+export = x;
diff --git a/node_modules/side-channel-map/index.js b/node_modules/side-channel-map/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e111100bfd6cc8b296a20276d8238e3a910f676d
--- /dev/null
+++ b/node_modules/side-channel-map/index.js
@@ -0,0 +1,68 @@
+'use strict';
+
+var GetIntrinsic = require('get-intrinsic');
+var callBound = require('call-bound');
+var inspect = require('object-inspect');
+
+var $TypeError = require('es-errors/type');
+var $Map = GetIntrinsic('%Map%', true);
+
+/** @type {(thisArg: Map, key: K) => V} */
+var $mapGet = callBound('Map.prototype.get', true);
+/** @type {(thisArg: Map, key: K, value: V) => void} */
+var $mapSet = callBound('Map.prototype.set', true);
+/** @type {(thisArg: Map, key: K) => boolean} */
+var $mapHas = callBound('Map.prototype.has', true);
+/** @type {(thisArg: Map, key: K) => boolean} */
+var $mapDelete = callBound('Map.prototype.delete', true);
+/** @type {(thisArg: Map) => number} */
+var $mapSize = callBound('Map.prototype.size', true);
+
+/** @type {import('.')} */
+module.exports = !!$Map && /** @type {Exclude} */ function getSideChannelMap() {
+ /** @typedef {ReturnType} Channel */
+ /** @typedef {Parameters[0]} K */
+ /** @typedef {Parameters[1]} V */
+
+ /** @type {Map | undefined} */ var $m;
+
+ /** @type {Channel} */
+ var channel = {
+ assert: function (key) {
+ if (!channel.has(key)) {
+ throw new $TypeError('Side channel does not contain ' + inspect(key));
+ }
+ },
+ 'delete': function (key) {
+ if ($m) {
+ var result = $mapDelete($m, key);
+ if ($mapSize($m) === 0) {
+ $m = void undefined;
+ }
+ return result;
+ }
+ return false;
+ },
+ get: function (key) { // eslint-disable-line consistent-return
+ if ($m) {
+ return $mapGet($m, key);
+ }
+ },
+ has: function (key) {
+ if ($m) {
+ return $mapHas($m, key);
+ }
+ return false;
+ },
+ set: function (key, value) {
+ if (!$m) {
+ // @ts-expect-error TS can't handle narrowing a variable inside a closure
+ $m = new $Map();
+ }
+ $mapSet($m, key, value);
+ }
+ };
+
+ // @ts-expect-error TODO: figure out why TS is erroring here
+ return channel;
+};
diff --git a/node_modules/side-channel-map/package.json b/node_modules/side-channel-map/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..18e80805905c32cf286aa286e1a0c8f8248ec574
--- /dev/null
+++ b/node_modules/side-channel-map/package.json
@@ -0,0 +1,80 @@
+{
+ "name": "side-channel-map",
+ "version": "1.0.1",
+ "description": "Store information about any JS value in a side channel, using a Map",
+ "main": "index.js",
+ "exports": {
+ ".": "./index.js",
+ "./package.json": "./package.json"
+ },
+ "types": "./index.d.ts",
+ "scripts": {
+ "prepack": "npmignore --auto --commentLines=autogenerated",
+ "prepublishOnly": "safe-publish-latest",
+ "prepublish": "not-in-publish || npm run prepublishOnly",
+ "prelint": "evalmd README.md && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
+ "lint": "eslint --ext=js,mjs .",
+ "postlint": "tsc -p . && attw -P",
+ "pretest": "npm run lint",
+ "tests-only": "nyc tape 'test/**/*.js'",
+ "test": "npm run tests-only",
+ "posttest": "npx npm@'>= 10.2' audit --production",
+ "version": "auto-changelog && git add CHANGELOG.md",
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/ljharb/side-channel-map.git"
+ },
+ "keywords": [],
+ "author": "Jordan Harband ",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ },
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/ljharb/side-channel-map/issues"
+ },
+ "homepage": "https://github.com/ljharb/side-channel-map#readme",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "devDependencies": {
+ "@arethetypeswrong/cli": "^0.17.1",
+ "@ljharb/eslint-config": "^21.1.1",
+ "@ljharb/tsconfig": "^0.2.2",
+ "@types/get-intrinsic": "^1.2.3",
+ "@types/object-inspect": "^1.13.0",
+ "@types/tape": "^5.6.5",
+ "auto-changelog": "^2.5.0",
+ "eclint": "^2.8.1",
+ "encoding": "^0.1.13",
+ "eslint": "=8.8.0",
+ "evalmd": "^0.0.19",
+ "in-publish": "^2.0.1",
+ "npmignore": "^0.3.1",
+ "nyc": "^10.3.2",
+ "safe-publish-latest": "^2.0.0",
+ "tape": "^5.9.0",
+ "typescript": "next"
+ },
+ "auto-changelog": {
+ "output": "CHANGELOG.md",
+ "template": "keepachangelog",
+ "unreleased": false,
+ "commitLimit": false,
+ "backfillLimit": false,
+ "hideCredit": true
+ },
+ "publishConfig": {
+ "ignore": [
+ ".github/workflows"
+ ]
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+}
diff --git a/node_modules/side-channel-map/test/index.js b/node_modules/side-channel-map/test/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..17433239ee490b8f734c5c60198eae699e201c65
--- /dev/null
+++ b/node_modules/side-channel-map/test/index.js
@@ -0,0 +1,114 @@
+'use strict';
+
+var test = require('tape');
+
+var getSideChannelMap = require('../');
+
+test('getSideChannelMap', { skip: typeof Map !== 'function' }, function (t) {
+ var getSideChannel = getSideChannelMap || function () {
+ throw new EvalError('should never happen');
+ };
+
+ t.test('export', function (st) {
+ st.equal(typeof getSideChannel, 'function', 'is a function');
+
+ st.equal(getSideChannel.length, 0, 'takes no arguments');
+
+ var channel = getSideChannel();
+ st.ok(channel, 'is truthy');
+ st.equal(typeof channel, 'object', 'is an object');
+ st.end();
+ });
+
+ t.test('assert', function (st) {
+ var channel = getSideChannel();
+ st['throws'](
+ function () { channel.assert({}); },
+ TypeError,
+ 'nonexistent value throws'
+ );
+
+ var o = {};
+ channel.set(o, 'data');
+ st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops');
+
+ st.end();
+ });
+
+ t.test('has', function (st) {
+ var channel = getSideChannel();
+ /** @type {unknown[]} */ var o = [];
+
+ st.equal(channel.has(o), false, 'nonexistent value yields false');
+
+ channel.set(o, 'foo');
+ st.equal(channel.has(o), true, 'existent value yields true');
+
+ st.equal(channel.has('abc'), false, 'non object value non existent yields false');
+
+ channel.set('abc', 'foo');
+ st.equal(channel.has('abc'), true, 'non object value that exists yields true');
+
+ st.end();
+ });
+
+ t.test('get', function (st) {
+ var channel = getSideChannel();
+ var o = {};
+ st.equal(channel.get(o), undefined, 'nonexistent value yields undefined');
+
+ var data = {};
+ channel.set(o, data);
+ st.equal(channel.get(o), data, '"get" yields data set by "set"');
+
+ st.end();
+ });
+
+ t.test('set', function (st) {
+ var channel = getSideChannel();
+ var o = function () {};
+ st.equal(channel.get(o), undefined, 'value not set');
+
+ channel.set(o, 42);
+ st.equal(channel.get(o), 42, 'value was set');
+
+ channel.set(o, Infinity);
+ st.equal(channel.get(o), Infinity, 'value was set again');
+
+ var o2 = {};
+ channel.set(o2, 17);
+ st.equal(channel.get(o), Infinity, 'o is not modified');
+ st.equal(channel.get(o2), 17, 'o2 is set');
+
+ channel.set(o, 14);
+ st.equal(channel.get(o), 14, 'o is modified');
+ st.equal(channel.get(o2), 17, 'o2 is not modified');
+
+ st.end();
+ });
+
+ t.test('delete', function (st) {
+ var channel = getSideChannel();
+ var o = {};
+ st.equal(channel['delete']({}), false, 'nonexistent value yields false');
+
+ channel.set(o, 42);
+ st.equal(channel.has(o), true, 'value is set');
+
+ st.equal(channel['delete']({}), false, 'nonexistent value still yields false');
+
+ st.equal(channel['delete'](o), true, 'deleted value yields true');
+
+ st.equal(channel.has(o), false, 'value is no longer set');
+
+ st.end();
+ });
+
+ t.end();
+});
+
+test('getSideChannelMap, no Maps', { skip: typeof Map === 'function' }, function (t) {
+ t.equal(getSideChannelMap, false, 'is false');
+
+ t.end();
+});
diff --git a/node_modules/side-channel-map/tsconfig.json b/node_modules/side-channel-map/tsconfig.json
new file mode 100644
index 0000000000000000000000000000000000000000..d9a6668c3ae6be748c78fbd5694053706b3d6942
--- /dev/null
+++ b/node_modules/side-channel-map/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "@ljharb/tsconfig",
+ "compilerOptions": {
+ "target": "es2021",
+ },
+ "exclude": [
+ "coverage",
+ ],
+}
diff --git a/node_modules/side-channel-weakmap/.editorconfig b/node_modules/side-channel-weakmap/.editorconfig
new file mode 100644
index 0000000000000000000000000000000000000000..72e0ebaa7f319d2bde03e55c8e58748245095f06
--- /dev/null
+++ b/node_modules/side-channel-weakmap/.editorconfig
@@ -0,0 +1,9 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = tab
+indent_size = 2
+trim_trailing_whitespace = true
diff --git a/node_modules/side-channel-weakmap/.eslintrc b/node_modules/side-channel-weakmap/.eslintrc
new file mode 100644
index 0000000000000000000000000000000000000000..9b13ad8ba555410581c1b389ca2cdfbd9d91310d
--- /dev/null
+++ b/node_modules/side-channel-weakmap/.eslintrc
@@ -0,0 +1,12 @@
+{
+ "root": true,
+
+ "extends": "@ljharb",
+
+ "rules": {
+ "id-length": 0,
+ "max-lines-per-function": 0,
+ "multiline-comment-style": 1,
+ "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }],
+ },
+}
diff --git a/node_modules/side-channel-weakmap/.github/FUNDING.yml b/node_modules/side-channel-weakmap/.github/FUNDING.yml
new file mode 100644
index 0000000000000000000000000000000000000000..2ae71cdb9425d0394e2ee363df151086c081c4c9
--- /dev/null
+++ b/node_modules/side-channel-weakmap/.github/FUNDING.yml
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: [ljharb]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: npm/side-channel-weakmap
+community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff --git a/node_modules/side-channel-weakmap/.nycrc b/node_modules/side-channel-weakmap/.nycrc
new file mode 100644
index 0000000000000000000000000000000000000000..1826526e091b89c896e7099ccd891db79165e329
--- /dev/null
+++ b/node_modules/side-channel-weakmap/.nycrc
@@ -0,0 +1,13 @@
+{
+ "all": true,
+ "check-coverage": false,
+ "reporter": ["text-summary", "text", "html", "json"],
+ "lines": 86,
+ "statements": 85.93,
+ "functions": 82.43,
+ "branches": 76.06,
+ "exclude": [
+ "coverage",
+ "test"
+ ]
+}
diff --git a/node_modules/side-channel-weakmap/CHANGELOG.md b/node_modules/side-channel-weakmap/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..aba7ab0412975a41899d61be28ff104c1db3fbf8
--- /dev/null
+++ b/node_modules/side-channel-weakmap/CHANGELOG.md
@@ -0,0 +1,28 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [v1.0.2](https://github.com/ljharb/side-channel-weakmap/compare/v1.0.1...v1.0.2) - 2024-12-10
+
+### Commits
+
+- [types] fix generics ordering [`1b62e94`](https://github.com/ljharb/side-channel-weakmap/commit/1b62e94a2ad6ed30b640ba73c4a2535836c67289)
+
+## [v1.0.1](https://github.com/ljharb/side-channel-weakmap/compare/v1.0.0...v1.0.1) - 2024-12-10
+
+### Commits
+
+- [types] fix generics ordering [`08a4a5d`](https://github.com/ljharb/side-channel-weakmap/commit/08a4a5dbffedc3ebc79f1aaaf5a3dd6d2196dc1b)
+- [Deps] update `side-channel-map` [`b53fe44`](https://github.com/ljharb/side-channel-weakmap/commit/b53fe447dfdd3a9aebedfd015b384eac17fce916)
+
+## v1.0.0 - 2024-12-10
+
+### Commits
+
+- Initial implementation, tests, readme, types [`53c0fa4`](https://github.com/ljharb/side-channel-weakmap/commit/53c0fa4788435a006f58b9d7b43cb65989ecee49)
+- Initial commit [`a157947`](https://github.com/ljharb/side-channel-weakmap/commit/a157947f26fcaf2c4a941d3a044e76bf67343532)
+- npm init [`54dfc55`](https://github.com/ljharb/side-channel-weakmap/commit/54dfc55bafb16265910d5aad4e743c43aee5bbbb)
+- Only apps should have lockfiles [`0ddd6c7`](https://github.com/ljharb/side-channel-weakmap/commit/0ddd6c7b07fe8ee04d67b2e9f7255af7ce62c07d)
diff --git a/node_modules/side-channel-weakmap/LICENSE b/node_modules/side-channel-weakmap/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..3900dd7e2ffe6d5205fde1cd3f890aa51ea36234
--- /dev/null
+++ b/node_modules/side-channel-weakmap/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2019 Jordan Harband
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/side-channel-weakmap/README.md b/node_modules/side-channel-weakmap/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..856ee3643b0832a52930b5e346539d9593640094
--- /dev/null
+++ b/node_modules/side-channel-weakmap/README.md
@@ -0,0 +1,62 @@
+# side-channel-weakmap [![Version Badge][npm-version-svg]][package-url]
+
+[![github actions][actions-image]][actions-url]
+[![coverage][codecov-image]][codecov-url]
+[![License][license-image]][license-url]
+[![Downloads][downloads-image]][downloads-url]
+
+[![npm badge][npm-badge-png]][package-url]
+
+Store information about any JS value in a side channel. Uses WeakMap if available.
+
+Warning: this implementation will leak memory until you `delete` the `key`.
+Use [`side-channel`](https://npmjs.com/side-channel) for the best available strategy.
+
+## Getting started
+
+```sh
+npm install --save side-channel-weakmap
+```
+
+## Usage/Examples
+
+```js
+const assert = require('assert');
+const getSideChannelList = require('side-channel-weakmap');
+
+const channel = getSideChannelList();
+
+const key = {};
+assert.equal(channel.has(key), false);
+assert.throws(() => channel.assert(key), TypeError);
+
+channel.set(key, 42);
+
+channel.assert(key); // does not throw
+assert.equal(channel.has(key), true);
+assert.equal(channel.get(key), 42);
+
+channel.delete(key);
+assert.equal(channel.has(key), false);
+assert.throws(() => channel.assert(key), TypeError);
+```
+
+## Tests
+
+Clone the repo, `npm install`, and run `npm test`
+
+[package-url]: https://npmjs.org/package/side-channel-weakmap
+[npm-version-svg]: https://versionbadg.es/ljharb/side-channel-weakmap.svg
+[deps-svg]: https://david-dm.org/ljharb/side-channel-weakmap.svg
+[deps-url]: https://david-dm.org/ljharb/side-channel-weakmap
+[dev-deps-svg]: https://david-dm.org/ljharb/side-channel-weakmap/dev-status.svg
+[dev-deps-url]: https://david-dm.org/ljharb/side-channel-weakmap#info=devDependencies
+[npm-badge-png]: https://nodei.co/npm/side-channel-weakmap.png?downloads=true&stars=true
+[license-image]: https://img.shields.io/npm/l/side-channel-weakmap.svg
+[license-url]: LICENSE
+[downloads-image]: https://img.shields.io/npm/dm/side-channel-weakmap.svg
+[downloads-url]: https://npm-stat.com/charts.html?package=side-channel-weakmap
+[codecov-image]: https://codecov.io/gh/ljharb/side-channel-weakmap/branch/main/graphs/badge.svg
+[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel-weakmap/
+[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel-weakmap
+[actions-url]: https://github.com/ljharb/side-channel-weakmap/actions
diff --git a/node_modules/side-channel-weakmap/index.d.ts b/node_modules/side-channel-weakmap/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ce1bc2a4ae2ea0be0eac679b305b6d20d69a7793
--- /dev/null
+++ b/node_modules/side-channel-weakmap/index.d.ts
@@ -0,0 +1,15 @@
+declare namespace getSideChannelWeakMap {
+ type Channel = {
+ assert: (key: K) => void;
+ has: (key: K) => boolean;
+ get: (key: K) => V | undefined;
+ set: (key: K, value: V) => void;
+ delete: (key: K) => boolean;
+ }
+}
+
+declare function getSideChannelWeakMap(): getSideChannelWeakMap.Channel;
+
+declare const x: false | typeof getSideChannelWeakMap;
+
+export = x;
diff --git a/node_modules/side-channel-weakmap/index.js b/node_modules/side-channel-weakmap/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..e5b8183d9717d5917efee321be4bf12c01c025cb
--- /dev/null
+++ b/node_modules/side-channel-weakmap/index.js
@@ -0,0 +1,84 @@
+'use strict';
+
+var GetIntrinsic = require('get-intrinsic');
+var callBound = require('call-bound');
+var inspect = require('object-inspect');
+var getSideChannelMap = require('side-channel-map');
+
+var $TypeError = require('es-errors/type');
+var $WeakMap = GetIntrinsic('%WeakMap%', true);
+
+/** @type {(thisArg: WeakMap, key: K) => V} */
+var $weakMapGet = callBound('WeakMap.prototype.get', true);
+/** @type {(thisArg: WeakMap, key: K, value: V) => void} */
+var $weakMapSet = callBound('WeakMap.prototype.set', true);
+/** @type {(thisArg: WeakMap, key: K) => boolean} */
+var $weakMapHas = callBound('WeakMap.prototype.has', true);
+/** @type {(thisArg: WeakMap, key: K) => boolean} */
+var $weakMapDelete = callBound('WeakMap.prototype.delete', true);
+
+/** @type {import('.')} */
+module.exports = $WeakMap
+ ? /** @type {Exclude} */ function getSideChannelWeakMap() {
+ /** @typedef {ReturnType} Channel */
+ /** @typedef {Parameters[0]} K */
+ /** @typedef {Parameters[1]} V */
+
+ /** @type {WeakMap | undefined} */ var $wm;
+ /** @type {Channel | undefined} */ var $m;
+
+ /** @type {Channel} */
+ var channel = {
+ assert: function (key) {
+ if (!channel.has(key)) {
+ throw new $TypeError('Side channel does not contain ' + inspect(key));
+ }
+ },
+ 'delete': function (key) {
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
+ if ($wm) {
+ return $weakMapDelete($wm, key);
+ }
+ } else if (getSideChannelMap) {
+ if ($m) {
+ return $m['delete'](key);
+ }
+ }
+ return false;
+ },
+ get: function (key) {
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
+ if ($wm) {
+ return $weakMapGet($wm, key);
+ }
+ }
+ return $m && $m.get(key);
+ },
+ has: function (key) {
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
+ if ($wm) {
+ return $weakMapHas($wm, key);
+ }
+ }
+ return !!$m && $m.has(key);
+ },
+ set: function (key, value) {
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
+ if (!$wm) {
+ $wm = new $WeakMap();
+ }
+ $weakMapSet($wm, key, value);
+ } else if (getSideChannelMap) {
+ if (!$m) {
+ $m = getSideChannelMap();
+ }
+ // eslint-disable-next-line no-extra-parens
+ /** @type {NonNullable} */ ($m).set(key, value);
+ }
+ }
+ };
+
+ // @ts-expect-error TODO: figure out why this is erroring
+ return channel;
+ }
+ : getSideChannelMap;
diff --git a/node_modules/side-channel-weakmap/package.json b/node_modules/side-channel-weakmap/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..9ef6583335d8670f8f86c7508cd047c6ae224a68
--- /dev/null
+++ b/node_modules/side-channel-weakmap/package.json
@@ -0,0 +1,87 @@
+{
+ "name": "side-channel-weakmap",
+ "version": "1.0.2",
+ "description": "Store information about any JS value in a side channel. Uses WeakMap if available.",
+ "main": "index.js",
+ "exports": {
+ ".": "./index.js",
+ "./package.json": "./package.json"
+ },
+ "types": "./index.d.ts",
+ "scripts": {
+ "prepack": "npmignore --auto --commentLines=autogenerated",
+ "prepublishOnly": "safe-publish-latest",
+ "prepublish": "not-in-publish || npm run prepublishOnly",
+ "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
+ "lint": "eslint --ext=js,mjs .",
+ "postlint": "tsc -p . && attw -P",
+ "pretest": "npm run lint",
+ "tests-only": "nyc tape 'test/**/*.js'",
+ "test": "npm run tests-only",
+ "posttest": "npx npm@'>=10.2' audit --production",
+ "version": "auto-changelog && git add CHANGELOG.md",
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/ljharb/side-channel-weakmap.git"
+ },
+ "keywords": [
+ "weakmap",
+ "map",
+ "side",
+ "channel",
+ "metadata"
+ ],
+ "author": "Jordan Harband ",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ },
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/ljharb/side-channel-weakmap/issues"
+ },
+ "homepage": "https://github.com/ljharb/side-channel-weakmap#readme",
+ "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"
+ },
+ "devDependencies": {
+ "@arethetypeswrong/cli": "^0.17.1",
+ "@ljharb/eslint-config": "^21.1.1",
+ "@ljharb/tsconfig": "^0.2.2",
+ "@types/call-bind": "^1.0.5",
+ "@types/get-intrinsic": "^1.2.3",
+ "@types/object-inspect": "^1.13.0",
+ "@types/tape": "^5.6.5",
+ "auto-changelog": "^2.5.0",
+ "eclint": "^2.8.1",
+ "encoding": "^0.1.13",
+ "eslint": "=8.8.0",
+ "in-publish": "^2.0.1",
+ "npmignore": "^0.3.1",
+ "nyc": "^10.3.2",
+ "safe-publish-latest": "^2.0.0",
+ "tape": "^5.9.0",
+ "typescript": "next"
+ },
+ "auto-changelog": {
+ "output": "CHANGELOG.md",
+ "template": "keepachangelog",
+ "unreleased": false,
+ "commitLimit": false,
+ "backfillLimit": false,
+ "hideCredit": true
+ },
+ "publishConfig": {
+ "ignore": [
+ ".github/workflows"
+ ]
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+}
diff --git a/node_modules/side-channel-weakmap/test/index.js b/node_modules/side-channel-weakmap/test/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..a01248b5729c1308909cdd62a8344b8de9b19c89
--- /dev/null
+++ b/node_modules/side-channel-weakmap/test/index.js
@@ -0,0 +1,114 @@
+'use strict';
+
+var test = require('tape');
+
+var getSideChannelWeakMap = require('../');
+
+test('getSideChannelMap', { skip: typeof WeakMap !== 'function' && typeof Map !== 'function' }, function (t) {
+ var getSideChannel = getSideChannelWeakMap || function () {
+ throw new EvalError('should never happen');
+ };
+
+ t.test('export', function (st) {
+ st.equal(typeof getSideChannel, 'function', 'is a function');
+
+ st.equal(getSideChannel.length, 0, 'takes no arguments');
+
+ var channel = getSideChannel();
+ st.ok(channel, 'is truthy');
+ st.equal(typeof channel, 'object', 'is an object');
+ st.end();
+ });
+
+ t.test('assert', function (st) {
+ var channel = getSideChannel();
+ st['throws'](
+ function () { channel.assert({}); },
+ TypeError,
+ 'nonexistent value throws'
+ );
+
+ var o = {};
+ channel.set(o, 'data');
+ st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops');
+
+ st.end();
+ });
+
+ t.test('has', function (st) {
+ var channel = getSideChannel();
+ /** @type {unknown[]} */ var o = [];
+
+ st.equal(channel.has(o), false, 'nonexistent value yields false');
+
+ channel.set(o, 'foo');
+ st.equal(channel.has(o), true, 'existent value yields true');
+
+ st.equal(channel.has('abc'), false, 'non object value non existent yields false');
+
+ channel.set('abc', 'foo');
+ st.equal(channel.has('abc'), true, 'non object value that exists yields true');
+
+ st.end();
+ });
+
+ t.test('get', function (st) {
+ var channel = getSideChannel();
+ var o = {};
+ st.equal(channel.get(o), undefined, 'nonexistent value yields undefined');
+
+ var data = {};
+ channel.set(o, data);
+ st.equal(channel.get(o), data, '"get" yields data set by "set"');
+
+ st.end();
+ });
+
+ t.test('set', function (st) {
+ var channel = getSideChannel();
+ var o = function () {};
+ st.equal(channel.get(o), undefined, 'value not set');
+
+ channel.set(o, 42);
+ st.equal(channel.get(o), 42, 'value was set');
+
+ channel.set(o, Infinity);
+ st.equal(channel.get(o), Infinity, 'value was set again');
+
+ var o2 = {};
+ channel.set(o2, 17);
+ st.equal(channel.get(o), Infinity, 'o is not modified');
+ st.equal(channel.get(o2), 17, 'o2 is set');
+
+ channel.set(o, 14);
+ st.equal(channel.get(o), 14, 'o is modified');
+ st.equal(channel.get(o2), 17, 'o2 is not modified');
+
+ st.end();
+ });
+
+ t.test('delete', function (st) {
+ var channel = getSideChannel();
+ var o = {};
+ st.equal(channel['delete']({}), false, 'nonexistent value yields false');
+
+ channel.set(o, 42);
+ st.equal(channel.has(o), true, 'value is set');
+
+ st.equal(channel['delete']({}), false, 'nonexistent value still yields false');
+
+ st.equal(channel['delete'](o), true, 'deleted value yields true');
+
+ st.equal(channel.has(o), false, 'value is no longer set');
+
+ st.end();
+ });
+
+ t.end();
+});
+
+test('getSideChannelMap, no WeakMaps and/or Maps', { skip: typeof WeakMap === 'function' || typeof Map === 'function' }, function (t) {
+ t.equal(getSideChannelWeakMap, false, 'is false');
+
+ t.end();
+});
diff --git a/node_modules/side-channel-weakmap/tsconfig.json b/node_modules/side-channel-weakmap/tsconfig.json
new file mode 100644
index 0000000000000000000000000000000000000000..d9a6668c3ae6be748c78fbd5694053706b3d6942
--- /dev/null
+++ b/node_modules/side-channel-weakmap/tsconfig.json
@@ -0,0 +1,9 @@
+{
+ "extends": "@ljharb/tsconfig",
+ "compilerOptions": {
+ "target": "es2021",
+ },
+ "exclude": [
+ "coverage",
+ ],
+}
diff --git a/node_modules/siginfo/.travis.yml b/node_modules/siginfo/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..4f54568c078cb484fb8e3f258fceb8b4f4a96252
--- /dev/null
+++ b/node_modules/siginfo/.travis.yml
@@ -0,0 +1,13 @@
+notifications:
+ email: false
+language: node_js
+node_js:
+- node
+deploy:
+ provider: npm
+ email:
+ secure: Y10Dvn9UbfpZPbulnl/e7dsiN/1xr06h7k6nJZyxRzr9Hh0UUFPism6k5CFaSegyPIF7sODNBQz4lvXIi2NwcvTLQruw5ehXW0NJ/G7x1TU94pzzhVJ31KBlRWzjKdvVTDsDzFxe5wKWxagPUTkieiIN9CWTQjafByNs3zbK8HL7cmu4Nc42JquVGbtpGgLs7Js+tY+WVB1dMQ4SfqpFgWjm2h05uyXCWHLK5amEAZJLP755lOVgMzw/jQGRg7J4vX4+eRE0r/g0v09x9FUU3ROEmJvqYa14CmGESRhSUyRlv4pnMIs/aK8ZDD8ia3eoTSvMJv8mzdvpkvKzWV1HSZFUX3QZVgWJEmeoF6XP+mdkWu5gnZVlOIBc8NANcS60Dr8QwF470xpPxsyAyf2o9UzX8Xy2qO8XNY/TykGO4soCfOEuVNdw5F9hHEldMHY8p9Z8EJSCn/xfM//LEvxRKREYsMqFtsnwUsv+qiAkHPSHXWQo6HYp+/xDchv63NxtjGHdPs9VpUFr1F8CxZjdis2HZfOnx51W0JIwNYlXNxeqC3WjRUqvRp2NknS982lRHCkHtZfHijGvMm7kj3QL+Ufc7pIfEGnMAKKiNv9kOryjQc29046pRZww9lWjrhoCeEPRhFbkgFV7Mo3bvOExstsSdRnOTlogCe4NviKOwfE=
+ api_key:
+ secure: cAmf8extX/sPl+sxC/6sWTmaiSGrXQY9C/lLg9c76Qn12MLysxDYgCRXfl8Az3RIbRuajq0SbyWXeDa/4wZc1PazuUGjZG82na+kuEDg8m5z0gLiJlhp60C0nj3WMJaRBRsOha1Jbs59eU3XNy+H0U5VczHrdw6v2yCHTlauhT/NYiPXMyKmTIJPB/X7gryFuXVhCPNdRBp3rPicbt0d68J+vWv9KNpjA1WB0WDUSl5rMUQbjjsRF2/DKj9WxXjmci+ac+/pCN3rQxgYZ0Ot5o5/RcWucc21ZdFgsLo8dq5YZDl/EQf/pPmkhquiiLRhiTyCBbEw1sDzYHTbTJThrukrZALg0on7XvxbXSQrxgc/IMJ/RT0PoGLEqyAZUSzGa6HPVlHUBt4LB3zgrswGmGUVkZmbiag0foIFeCKlydwEyBYfnFdRddxF6n3irft1l1NJ1HKNxKLnKvyt8iaOlGteXOOfLXzU17DgMgwTsZsvFmtFQcs6yolLHW9RnRTLf56+x/kJZ4kVJjHuyb/98pS4F7etJ2SpZqt1cVUFd/AYtnxL3jKiUhJLNL8hNUIH3eSpMfZUOUxGv1OWuwgyEhSONkITF2VPn4yuyxS23Ewq4LLj/u/9sPlLaGSN4Avaw21gi6L+M9x620sTZHYtNLniVMTAu6aPiM32zPreK2I=
+ on:
+ tags: true
diff --git a/node_modules/siginfo/LICENSE b/node_modules/siginfo/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..b45703b88a6742577786fa46c73b018dbe75cf26
--- /dev/null
+++ b/node_modules/siginfo/LICENSE
@@ -0,0 +1,13 @@
+Copyright (c) 2017, Emil Bay
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/siginfo/README.md b/node_modules/siginfo/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..3552e2ad95f08f009f8fc6c495d299ddc8ae790e
--- /dev/null
+++ b/node_modules/siginfo/README.md
@@ -0,0 +1,47 @@
+# `siginfo`
+
+[](https://travis-ci.org/eemilbayes/siginfo)
+
+> Utility module to print pretty messages on SIGINFO/SIGUSR1
+
+`SIGINFO` on BSD / macOS and `SIGUSR1` on Linux, usually triggered by
+`Ctrl + T`, are by convention used to print information about
+a long running process internal state. Eg. `dd` will tell you how many blocks it
+has written and at what speed, while `xz` will tell you progress, compression
+ratio and estimated time remaining.
+
+This module wraps both signals, checks if the process is connected to TTY and
+lets you do whatever you want.
+
+## Usage
+
+```js
+var siginfo = require('siginfo')
+var pkg = require('./package.json')
+
+siginfo(function () {
+ console.dir({
+ version: pkg.version,
+ uptime: process.uptime()
+ })
+})
+
+```
+
+## API
+
+### `var removeListener = siginfo(queryFn, [force])`
+
+`queryFn` can be used for whatever you want (logging, sending a UDP message, etc.).
+Setting `force = true` will attach the event handlers whether a TTY is present
+or not.
+
+## Install
+
+```sh
+npm install siginfo
+```
+
+## License
+
+[ISC](LICENSE)
diff --git a/node_modules/siginfo/index.js b/node_modules/siginfo/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..5092b6115d70e97ec511c1ed98e622f83eef9925
--- /dev/null
+++ b/node_modules/siginfo/index.js
@@ -0,0 +1,20 @@
+module.exports = function (query, force) {
+ var isAttached = false
+ if (process.stderr.isTTY || force === true) {
+ isAttached = true
+ process.on('SIGINFO', onsiginfo)
+ process.on('SIGUSR1', onsiginfo)
+ }
+
+ return function () {
+ if (isAttached === true) {
+ process.removeListener('SIGINFO', onsiginfo)
+ process.removeListener('SIGUSR1', onsiginfo)
+ isAttached = false
+ }
+ }
+
+ function onsiginfo () {
+ query()
+ }
+}
diff --git a/node_modules/siginfo/package.json b/node_modules/siginfo/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..4f0e7154346583f6d5df9c690ef0abc76531e6dc
--- /dev/null
+++ b/node_modules/siginfo/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "siginfo",
+ "version": "2.0.0",
+ "description": "Utility module to print pretty messages on SIGINFO/SIGUSR1",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "standard": "^14.3.4"
+ },
+ "scripts": {
+ "test": "standard"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/emilbayes/siginfo.git"
+ },
+ "keywords": [
+ "siginfo",
+ "sigusr1",
+ "ctrl",
+ "t",
+ "info",
+ "progress",
+ "inspect"
+ ],
+ "author": "Emil Bay ",
+ "license": "ISC",
+ "bugs": {
+ "url": "https://github.com/emilbayes/siginfo/issues"
+ },
+ "homepage": "https://github.com/emilbayes/siginfo#readme"
+}
diff --git a/node_modules/siginfo/test.js b/node_modules/siginfo/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..eaf6824f64e295ce5ff64a08fcc316fc9524ed9d
--- /dev/null
+++ b/node_modules/siginfo/test.js
@@ -0,0 +1,16 @@
+var siginfo = require('.')
+var pkg = require('./package.json')
+
+var stop = siginfo(function () {
+ console.dir({
+ version: pkg.version,
+ uptime: process.uptime()
+ })
+})
+
+process.stdout.resume()
+
+setTimeout(function () {
+ stop()
+ process.exit(0)
+}, 2000)
diff --git a/node_modules/signal-exit/LICENSE.txt b/node_modules/signal-exit/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..954f2fa8235009998fe29a775bbaf8c23f5e2d50
--- /dev/null
+++ b/node_modules/signal-exit/LICENSE.txt
@@ -0,0 +1,16 @@
+The ISC License
+
+Copyright (c) 2015-2023 Benjamin Coe, Isaac Z. Schlueter, and Contributors
+
+Permission to use, copy, modify, and/or distribute this software
+for any purpose with or without fee is hereby granted, provided
+that the above copyright notice and this permission notice
+appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
+LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/node_modules/signal-exit/README.md b/node_modules/signal-exit/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c55cd45ee316e8025759f5da2a124446814cc387
--- /dev/null
+++ b/node_modules/signal-exit/README.md
@@ -0,0 +1,74 @@
+# signal-exit
+
+When you want to fire an event no matter how a process exits:
+
+- reaching the end of execution.
+- explicitly having `process.exit(code)` called.
+- having `process.kill(pid, sig)` called.
+- receiving a fatal signal from outside the process
+
+Use `signal-exit`.
+
+```js
+// Hybrid module, either works
+import { onExit } from 'signal-exit'
+// or:
+// const { onExit } = require('signal-exit')
+
+onExit((code, signal) => {
+ console.log('process exited!', code, signal)
+})
+```
+
+## API
+
+`remove = onExit((code, signal) => {}, options)`
+
+The return value of the function is a function that will remove
+the handler.
+
+Note that the function _only_ fires for signals if the signal
+would cause the process to exit. That is, there are no other
+listeners, and it is a fatal signal.
+
+If the global `process` object is not suitable for this purpose
+(ie, it's unset, or doesn't have an `emit` method, etc.) then the
+`onExit` function is a no-op that returns a no-op `remove` method.
+
+### Options
+
+- `alwaysLast`: Run this handler after any other signal or exit
+ handlers. This causes `process.emit` to be monkeypatched.
+
+### Capturing Signal Exits
+
+If the handler returns an exact boolean `true`, and the exit is a
+due to signal, then the signal will be considered handled, and
+will _not_ trigger a synthetic `process.kill(process.pid,
+signal)` after firing the `onExit` handlers.
+
+In this case, it your responsibility as the caller to exit with a
+signal (for example, by calling `process.kill()`) if you wish to
+preserve the same exit status that would otherwise have occurred.
+If you do not, then the process will likely exit gracefully with
+status 0 at some point, assuming that no other terminating signal
+or other exit trigger occurs.
+
+Prior to calling handlers, the `onExit` machinery is unloaded, so
+any subsequent exits or signals will not be handled, even if the
+signal is captured and the exit is thus prevented.
+
+Note that numeric code exits may indicate that the process is
+already committed to exiting, for example due to a fatal
+exception or unhandled promise rejection, and so there is no way to
+prevent it safely.
+
+### Browser Fallback
+
+The `'signal-exit/browser'` module is the same fallback shim that
+just doesn't do anything, but presents the same function
+interface.
+
+Patches welcome to add something that hooks onto
+`window.onbeforeunload` or similar, but it might just not be a
+thing that makes sense there.
diff --git a/node_modules/signal-exit/package.json b/node_modules/signal-exit/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..ac176cec743748840fdb8f143beb60bf47e599ac
--- /dev/null
+++ b/node_modules/signal-exit/package.json
@@ -0,0 +1,106 @@
+{
+ "name": "signal-exit",
+ "version": "4.1.0",
+ "description": "when you want to fire an event no matter how a process exits.",
+ "main": "./dist/cjs/index.js",
+ "module": "./dist/mjs/index.js",
+ "browser": "./dist/mjs/browser.js",
+ "types": "./dist/mjs/index.d.ts",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./dist/mjs/index.d.ts",
+ "default": "./dist/mjs/index.js"
+ },
+ "require": {
+ "types": "./dist/cjs/index.d.ts",
+ "default": "./dist/cjs/index.js"
+ }
+ },
+ "./signals": {
+ "import": {
+ "types": "./dist/mjs/signals.d.ts",
+ "default": "./dist/mjs/signals.js"
+ },
+ "require": {
+ "types": "./dist/cjs/signals.d.ts",
+ "default": "./dist/cjs/signals.js"
+ }
+ },
+ "./browser": {
+ "import": {
+ "types": "./dist/mjs/browser.d.ts",
+ "default": "./dist/mjs/browser.js"
+ },
+ "require": {
+ "types": "./dist/cjs/browser.d.ts",
+ "default": "./dist/cjs/browser.js"
+ }
+ }
+ },
+ "files": [
+ "dist"
+ ],
+ "engines": {
+ "node": ">=14"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/tapjs/signal-exit.git"
+ },
+ "keywords": [
+ "signal",
+ "exit"
+ ],
+ "author": "Ben Coe ",
+ "license": "ISC",
+ "devDependencies": {
+ "@types/cross-spawn": "^6.0.2",
+ "@types/node": "^18.15.11",
+ "@types/signal-exit": "^3.0.1",
+ "@types/tap": "^15.0.8",
+ "c8": "^7.13.0",
+ "prettier": "^2.8.6",
+ "tap": "^16.3.4",
+ "ts-node": "^10.9.1",
+ "typedoc": "^0.23.28",
+ "typescript": "^5.0.2"
+ },
+ "scripts": {
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
+ "preprepare": "rm -rf dist",
+ "prepare": "tsc -p tsconfig.json && tsc -p tsconfig-esm.json && bash ./scripts/fixup.sh",
+ "pretest": "npm run prepare",
+ "presnap": "npm run prepare",
+ "test": "c8 tap",
+ "snap": "c8 tap",
+ "format": "prettier --write . --loglevel warn",
+ "typedoc": "typedoc --tsconfig tsconfig-esm.json ./src/*.ts"
+ },
+ "prettier": {
+ "semi": false,
+ "printWidth": 75,
+ "tabWidth": 2,
+ "useTabs": false,
+ "singleQuote": true,
+ "jsxSingleQuote": false,
+ "bracketSameLine": true,
+ "arrowParens": "avoid",
+ "endOfLine": "lf"
+ },
+ "tap": {
+ "coverage": false,
+ "jobs": 1,
+ "node-arg": [
+ "--no-warnings",
+ "--loader",
+ "ts-node/esm"
+ ],
+ "ts": false
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+}
diff --git a/node_modules/simple-concat/.travis.yml b/node_modules/simple-concat/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..c159f6acecab74f3b3ec5c09a970e9f3c226e667
--- /dev/null
+++ b/node_modules/simple-concat/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - lts/*
diff --git a/node_modules/simple-concat/LICENSE b/node_modules/simple-concat/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..c7e6852752b72edbf0eb6b2adef53f0863ae5876
--- /dev/null
+++ b/node_modules/simple-concat/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) Feross Aboukhadijeh
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/simple-concat/README.md b/node_modules/simple-concat/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7d39bdea998f5dc6ad2c3d9637586eb453a87b3
--- /dev/null
+++ b/node_modules/simple-concat/README.md
@@ -0,0 +1,44 @@
+# simple-concat [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
+
+[travis-image]: https://img.shields.io/travis/feross/simple-concat/master.svg
+[travis-url]: https://travis-ci.org/feross/simple-concat
+[npm-image]: https://img.shields.io/npm/v/simple-concat.svg
+[npm-url]: https://npmjs.org/package/simple-concat
+[downloads-image]: https://img.shields.io/npm/dm/simple-concat.svg
+[downloads-url]: https://npmjs.org/package/simple-concat
+[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
+[standard-url]: https://standardjs.com
+
+### Super-minimalist version of [`concat-stream`](https://github.com/maxogden/concat-stream). Less than 15 lines!
+
+## install
+
+```
+npm install simple-concat
+```
+
+## usage
+
+This example is longer than the implementation.
+
+```js
+var s = new stream.PassThrough()
+concat(s, function (err, buf) {
+ if (err) throw err
+ console.error(buf)
+})
+s.write('abc')
+setTimeout(function () {
+ s.write('123')
+}, 10)
+setTimeout(function () {
+ s.write('456')
+}, 20)
+setTimeout(function () {
+ s.end('789')
+}, 30)
+```
+
+## license
+
+MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).
diff --git a/node_modules/simple-concat/index.js b/node_modules/simple-concat/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..59237fc6284738fdb149b4c4a9be0e123711a295
--- /dev/null
+++ b/node_modules/simple-concat/index.js
@@ -0,0 +1,15 @@
+/*! simple-concat. MIT License. Feross Aboukhadijeh */
+module.exports = function (stream, cb) {
+ var chunks = []
+ stream.on('data', function (chunk) {
+ chunks.push(chunk)
+ })
+ stream.once('end', function () {
+ if (cb) cb(null, Buffer.concat(chunks))
+ cb = null
+ })
+ stream.once('error', function (err) {
+ if (cb) cb(err)
+ cb = null
+ })
+}
diff --git a/node_modules/simple-concat/package.json b/node_modules/simple-concat/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..2bb2c60a2f9e995a7e3d5c94a9c93290ba047aea
--- /dev/null
+++ b/node_modules/simple-concat/package.json
@@ -0,0 +1,47 @@
+{
+ "name": "simple-concat",
+ "description": "Super-minimalist version of `concat-stream`. Less than 15 lines!",
+ "version": "1.0.1",
+ "author": {
+ "name": "Feross Aboukhadijeh",
+ "email": "feross@feross.org",
+ "url": "https://feross.org"
+ },
+ "bugs": {
+ "url": "https://github.com/feross/simple-concat/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "standard": "*",
+ "tape": "^5.0.1"
+ },
+ "homepage": "https://github.com/feross/simple-concat",
+ "keywords": [
+ "concat",
+ "concat-stream",
+ "concat stream"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/feross/simple-concat.git"
+ },
+ "scripts": {
+ "test": "standard && tape test/*.js"
+ },
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+}
diff --git a/node_modules/simple-concat/test/basic.js b/node_modules/simple-concat/test/basic.js
new file mode 100644
index 0000000000000000000000000000000000000000..4bf6f9c2d9d82844996f27791e73defb2c66933e
--- /dev/null
+++ b/node_modules/simple-concat/test/basic.js
@@ -0,0 +1,41 @@
+var concat = require('../')
+var stream = require('stream')
+var test = require('tape')
+
+test('basic', function (t) {
+ t.plan(2)
+ var s = new stream.PassThrough()
+ concat(s, function (err, buf) {
+ t.error(err)
+ t.deepEqual(buf, Buffer.from('abc123456789'))
+ })
+ s.write('abc')
+ setTimeout(function () {
+ s.write('123')
+ }, 10)
+ setTimeout(function () {
+ s.write('456')
+ }, 20)
+ setTimeout(function () {
+ s.end('789')
+ }, 30)
+})
+
+test('error', function (t) {
+ t.plan(2)
+ var s = new stream.PassThrough()
+ concat(s, function (err, buf) {
+ t.ok(err, 'got expected error')
+ t.ok(!buf)
+ })
+ s.write('abc')
+ setTimeout(function () {
+ s.write('123')
+ }, 10)
+ setTimeout(function () {
+ s.write('456')
+ }, 20)
+ setTimeout(function () {
+ s.emit('error', new Error('error'))
+ }, 30)
+})
diff --git a/node_modules/simple-get/.github/dependabot.yml b/node_modules/simple-get/.github/dependabot.yml
new file mode 100644
index 0000000000000000000000000000000000000000..0221fbcbc3977776e0c6d60f760fbe147f2e81e5
--- /dev/null
+++ b/node_modules/simple-get/.github/dependabot.yml
@@ -0,0 +1,15 @@
+version: 2
+updates:
+ - package-ecosystem: npm
+ directory: /
+ schedule:
+ interval: daily
+ labels:
+ - dependency
+ versioning-strategy: increase-if-necessary
+ - package-ecosystem: github-actions
+ directory: /
+ schedule:
+ interval: daily
+ labels:
+ - dependency
diff --git a/node_modules/simple-get/.github/workflows/ci.yml b/node_modules/simple-get/.github/workflows/ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..822d21cc9d5264b5439f9bfaea12f0e162064cc3
--- /dev/null
+++ b/node_modules/simple-get/.github/workflows/ci.yml
@@ -0,0 +1,23 @@
+name: ci
+'on':
+ - push
+ - pull_request
+jobs:
+ test:
+ name: Node ${{ matrix.node }} / ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os:
+ - ubuntu-latest
+ node:
+ - '14'
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v2
+ with:
+ node-version: ${{ matrix.node }}
+ - run: npm install
+ - run: npm run build --if-present
+ - run: npm test
diff --git a/node_modules/simple-get/LICENSE b/node_modules/simple-get/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..c7e6852752b72edbf0eb6b2adef53f0863ae5876
--- /dev/null
+++ b/node_modules/simple-get/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) Feross Aboukhadijeh
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/simple-get/README.md b/node_modules/simple-get/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..63c6a6bae8888b6749dcc0fab06816e16ee5d485
--- /dev/null
+++ b/node_modules/simple-get/README.md
@@ -0,0 +1,333 @@
+# simple-get [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
+
+[ci-image]: https://img.shields.io/github/workflow/status/feross/simple-get/ci/master
+[ci-url]: https://github.com/feross/simple-get/actions
+[npm-image]: https://img.shields.io/npm/v/simple-get.svg
+[npm-url]: https://npmjs.org/package/simple-get
+[downloads-image]: https://img.shields.io/npm/dm/simple-get.svg
+[downloads-url]: https://npmjs.org/package/simple-get
+[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
+[standard-url]: https://standardjs.com
+
+### Simplest way to make http get requests
+
+## features
+
+This module is the lightest possible wrapper on top of node.js `http`, but supporting these essential features:
+
+- follows redirects
+- automatically handles gzip/deflate responses
+- supports HTTPS
+- supports specifying a timeout
+- supports convenience `url` key so there's no need to use `url.parse` on the url when specifying options
+- composes well with npm packages for features like cookies, proxies, form data, & OAuth
+
+All this in < 100 lines of code.
+
+## install
+
+```
+npm install simple-get
+```
+
+## usage
+
+Note, all these examples also work in the browser with [browserify](http://browserify.org/).
+
+### simple GET request
+
+Doesn't get easier than this:
+
+```js
+const get = require('simple-get')
+
+get('http://example.com', function (err, res) {
+ if (err) throw err
+ console.log(res.statusCode) // 200
+ res.pipe(process.stdout) // `res` is a stream
+})
+```
+
+### even simpler GET request
+
+If you just want the data, and don't want to deal with streams:
+
+```js
+const get = require('simple-get')
+
+get.concat('http://example.com', function (err, res, data) {
+ if (err) throw err
+ console.log(res.statusCode) // 200
+ console.log(data) // Buffer('this is the server response')
+})
+```
+
+### POST, PUT, PATCH, HEAD, DELETE support
+
+For `POST`, call `get.post` or use option `{ method: 'POST' }`.
+
+```js
+const get = require('simple-get')
+
+const opts = {
+ url: 'http://example.com',
+ body: 'this is the POST body'
+}
+get.post(opts, function (err, res) {
+ if (err) throw err
+ res.pipe(process.stdout) // `res` is a stream
+})
+```
+
+#### A more complex example:
+
+```js
+const get = require('simple-get')
+
+get({
+ url: 'http://example.com',
+ method: 'POST',
+ body: 'this is the POST body',
+
+ // simple-get accepts all options that node.js `http` accepts
+ // See: http://nodejs.org/api/http.html#http_http_request_options_callback
+ headers: {
+ 'user-agent': 'my cool app'
+ }
+}, function (err, res) {
+ if (err) throw err
+
+ // All properties/methods from http.IncomingResponse are available,
+ // even if a gunzip/inflate transform stream was returned.
+ // See: http://nodejs.org/api/http.html#http_http_incomingmessage
+ res.setTimeout(10000)
+ console.log(res.headers)
+
+ res.on('data', function (chunk) {
+ // `chunk` is the decoded response, after it's been gunzipped or inflated
+ // (if applicable)
+ console.log('got a chunk of the response: ' + chunk)
+ }))
+
+})
+```
+
+### JSON
+
+You can serialize/deserialize request and response with JSON:
+
+```js
+const get = require('simple-get')
+
+const opts = {
+ method: 'POST',
+ url: 'http://example.com',
+ body: {
+ key: 'value'
+ },
+ json: true
+}
+get.concat(opts, function (err, res, data) {
+ if (err) throw err
+ console.log(data.key) // `data` is an object
+})
+```
+
+### Timeout
+
+You can set a timeout (in milliseconds) on the request with the `timeout` option.
+If the request takes longer than `timeout` to complete, then the entire request
+will fail with an `Error`.
+
+```js
+const get = require('simple-get')
+
+const opts = {
+ url: 'http://example.com',
+ timeout: 2000 // 2 second timeout
+}
+
+get(opts, function (err, res) {})
+```
+
+### One Quick Tip
+
+It's a good idea to set the `'user-agent'` header so the provider can more easily
+see how their resource is used.
+
+```js
+const get = require('simple-get')
+const pkg = require('./package.json')
+
+get('http://example.com', {
+ headers: {
+ 'user-agent': `my-module/${pkg.version} (https://github.com/username/my-module)`
+ }
+})
+```
+
+### Proxies
+
+You can use the [`tunnel`](https://github.com/koichik/node-tunnel) module with the
+`agent` option to work with proxies:
+
+```js
+const get = require('simple-get')
+const tunnel = require('tunnel')
+
+const opts = {
+ url: 'http://example.com',
+ agent: tunnel.httpOverHttp({
+ proxy: {
+ host: 'localhost'
+ }
+ })
+}
+
+get(opts, function (err, res) {})
+```
+
+### Cookies
+
+You can use the [`cookie`](https://github.com/jshttp/cookie) module to include
+cookies in a request:
+
+```js
+const get = require('simple-get')
+const cookie = require('cookie')
+
+const opts = {
+ url: 'http://example.com',
+ headers: {
+ cookie: cookie.serialize('foo', 'bar')
+ }
+}
+
+get(opts, function (err, res) {})
+```
+
+### Form data
+
+You can use the [`form-data`](https://github.com/form-data/form-data) module to
+create POST request with form data:
+
+```js
+const fs = require('fs')
+const get = require('simple-get')
+const FormData = require('form-data')
+const form = new FormData()
+
+form.append('my_file', fs.createReadStream('/foo/bar.jpg'))
+
+const opts = {
+ url: 'http://example.com',
+ body: form
+}
+
+get.post(opts, function (err, res) {})
+```
+
+#### Or, include `application/x-www-form-urlencoded` form data manually:
+
+```js
+const get = require('simple-get')
+
+const opts = {
+ url: 'http://example.com',
+ form: {
+ key: 'value'
+ }
+}
+get.post(opts, function (err, res) {})
+```
+
+### Specifically disallowing redirects
+
+```js
+const get = require('simple-get')
+
+const opts = {
+ url: 'http://example.com/will-redirect-elsewhere',
+ followRedirects: false
+}
+// res.statusCode will be 301, no error thrown
+get(opts, function (err, res) {})
+```
+
+### Basic Auth
+
+```js
+const user = 'someuser'
+const pass = 'pa$$word'
+const encodedAuth = Buffer.from(`${user}:${pass}`).toString('base64')
+
+get('http://example.com', {
+ headers: {
+ authorization: `Basic ${encodedAuth}`
+ }
+})
+```
+
+### OAuth
+
+You can use the [`oauth-1.0a`](https://github.com/ddo/oauth-1.0a) module to create
+a signed OAuth request:
+
+```js
+const get = require('simple-get')
+const crypto = require('crypto')
+const OAuth = require('oauth-1.0a')
+
+const oauth = OAuth({
+ consumer: {
+ key: process.env.CONSUMER_KEY,
+ secret: process.env.CONSUMER_SECRET
+ },
+ signature_method: 'HMAC-SHA1',
+ hash_function: (baseString, key) => crypto.createHmac('sha1', key).update(baseString).digest('base64')
+})
+
+const token = {
+ key: process.env.ACCESS_TOKEN,
+ secret: process.env.ACCESS_TOKEN_SECRET
+}
+
+const url = 'https://api.twitter.com/1.1/statuses/home_timeline.json'
+
+const opts = {
+ url: url,
+ headers: oauth.toHeader(oauth.authorize({url, method: 'GET'}, token)),
+ json: true
+}
+
+get(opts, function (err, res) {})
+```
+
+### Throttle requests
+
+You can use [limiter](https://github.com/jhurliman/node-rate-limiter) to throttle requests. This is useful when calling an API that is rate limited.
+
+```js
+const simpleGet = require('simple-get')
+const RateLimiter = require('limiter').RateLimiter
+const limiter = new RateLimiter(1, 'second')
+
+const get = (opts, cb) => limiter.removeTokens(1, () => simpleGet(opts, cb))
+get.concat = (opts, cb) => limiter.removeTokens(1, () => simpleGet.concat(opts, cb))
+
+var opts = {
+ url: 'http://example.com'
+}
+
+get.concat(opts, processResult)
+get.concat(opts, processResult)
+
+function processResult (err, res, data) {
+ if (err) throw err
+ console.log(data.toString())
+}
+```
+
+## license
+
+MIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).
diff --git a/node_modules/simple-get/index.js b/node_modules/simple-get/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..80e52e8ccade8e92c290462ae404a7ce70a937f1
--- /dev/null
+++ b/node_modules/simple-get/index.js
@@ -0,0 +1,108 @@
+/*! simple-get. MIT License. Feross Aboukhadijeh */
+module.exports = simpleGet
+
+const concat = require('simple-concat')
+const decompressResponse = require('decompress-response') // excluded from browser build
+const http = require('http')
+const https = require('https')
+const once = require('once')
+const querystring = require('querystring')
+const url = require('url')
+
+const isStream = o => o !== null && typeof o === 'object' && typeof o.pipe === 'function'
+
+function simpleGet (opts, cb) {
+ opts = Object.assign({ maxRedirects: 10 }, typeof opts === 'string' ? { url: opts } : opts)
+ cb = once(cb)
+
+ if (opts.url) {
+ const { hostname, port, protocol, auth, path } = url.parse(opts.url) // eslint-disable-line node/no-deprecated-api
+ delete opts.url
+ if (!hostname && !port && !protocol && !auth) opts.path = path // Relative redirect
+ else Object.assign(opts, { hostname, port, protocol, auth, path }) // Absolute redirect
+ }
+
+ const headers = { 'accept-encoding': 'gzip, deflate' }
+ if (opts.headers) Object.keys(opts.headers).forEach(k => (headers[k.toLowerCase()] = opts.headers[k]))
+ opts.headers = headers
+
+ let body
+ if (opts.body) {
+ body = opts.json && !isStream(opts.body) ? JSON.stringify(opts.body) : opts.body
+ } else if (opts.form) {
+ body = typeof opts.form === 'string' ? opts.form : querystring.stringify(opts.form)
+ opts.headers['content-type'] = 'application/x-www-form-urlencoded'
+ }
+
+ if (body) {
+ if (!opts.method) opts.method = 'POST'
+ if (!isStream(body)) opts.headers['content-length'] = Buffer.byteLength(body)
+ if (opts.json && !opts.form) opts.headers['content-type'] = 'application/json'
+ }
+ delete opts.body; delete opts.form
+
+ if (opts.json) opts.headers.accept = 'application/json'
+ if (opts.method) opts.method = opts.method.toUpperCase()
+
+ const originalHost = opts.hostname // hostname before potential redirect
+ const protocol = opts.protocol === 'https:' ? https : http // Support http/https urls
+ const req = protocol.request(opts, res => {
+ if (opts.followRedirects !== false && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
+ opts.url = res.headers.location // Follow 3xx redirects
+ delete opts.headers.host // Discard `host` header on redirect (see #32)
+ res.resume() // Discard response
+
+ const redirectHost = url.parse(opts.url).hostname // eslint-disable-line node/no-deprecated-api
+ // If redirected host is different than original host, drop headers to prevent cookie leak (#73)
+ if (redirectHost !== null && redirectHost !== originalHost) {
+ delete opts.headers.cookie
+ delete opts.headers.authorization
+ }
+
+ if (opts.method === 'POST' && [301, 302].includes(res.statusCode)) {
+ opts.method = 'GET' // On 301/302 redirect, change POST to GET (see #35)
+ delete opts.headers['content-length']; delete opts.headers['content-type']
+ }
+
+ if (opts.maxRedirects-- === 0) return cb(new Error('too many redirects'))
+ else return simpleGet(opts, cb)
+ }
+
+ const tryUnzip = typeof decompressResponse === 'function' && opts.method !== 'HEAD'
+ cb(null, tryUnzip ? decompressResponse(res) : res)
+ })
+ req.on('timeout', () => {
+ req.abort()
+ cb(new Error('Request timed out'))
+ })
+ req.on('error', cb)
+
+ if (isStream(body)) body.on('error', cb).pipe(req)
+ else req.end(body)
+
+ return req
+}
+
+simpleGet.concat = (opts, cb) => {
+ return simpleGet(opts, (err, res) => {
+ if (err) return cb(err)
+ concat(res, (err, data) => {
+ if (err) return cb(err)
+ if (opts.json) {
+ try {
+ data = JSON.parse(data.toString())
+ } catch (err) {
+ return cb(err, res, data)
+ }
+ }
+ cb(null, res, data)
+ })
+ })
+}
+
+;['get', 'post', 'put', 'patch', 'head', 'delete'].forEach(method => {
+ simpleGet[method] = (opts, cb) => {
+ if (typeof opts === 'string') opts = { url: opts }
+ return simpleGet(Object.assign({ method: method.toUpperCase() }, opts), cb)
+ }
+})
diff --git a/node_modules/simple-get/package.json b/node_modules/simple-get/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..e80fc5eb315786b6f7410be415256000977f8fe9
--- /dev/null
+++ b/node_modules/simple-get/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "simple-get",
+ "description": "Simplest way to make http get requests. Supports HTTPS, redirects, gzip/deflate, streams in < 100 lines.",
+ "version": "4.0.1",
+ "author": {
+ "name": "Feross Aboukhadijeh",
+ "email": "feross@feross.org",
+ "url": "https://feross.org"
+ },
+ "browser": {
+ "decompress-response": false
+ },
+ "bugs": {
+ "url": "https://github.com/feross/simple-get/issues"
+ },
+ "dependencies": {
+ "decompress-response": "^6.0.0",
+ "once": "^1.3.1",
+ "simple-concat": "^1.0.0"
+ },
+ "devDependencies": {
+ "self-signed-https": "^1.0.5",
+ "standard": "*",
+ "string-to-stream": "^3.0.0",
+ "tape": "^5.0.0"
+ },
+ "homepage": "https://github.com/feross/simple-get",
+ "keywords": [
+ "request",
+ "http",
+ "GET",
+ "get request",
+ "http.get",
+ "redirects",
+ "follow redirects",
+ "gzip",
+ "deflate",
+ "https",
+ "http-https",
+ "stream",
+ "simple request",
+ "simple get"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/feross/simple-get.git"
+ },
+ "scripts": {
+ "test": "standard && tape test/*.js"
+ },
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ]
+}
diff --git a/node_modules/simple-update-notifier/LICENSE b/node_modules/simple-update-notifier/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..1e0b0c116923cb899cb0ebc49528551dde1f6ab9
--- /dev/null
+++ b/node_modules/simple-update-notifier/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2022 Alex Brazier
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/simple-update-notifier/README.md b/node_modules/simple-update-notifier/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..ec177944638c4be4d4d8cf639d00bab0cc774acc
--- /dev/null
+++ b/node_modules/simple-update-notifier/README.md
@@ -0,0 +1,82 @@
+# simple-update-notifier [](https://github.com/alexbrazier/simple-update-notifier/stargazers)
+
+[](https://github.com/alexbrazier/simple-update-notifier/actions)
+[](https://www.npmjs.com/package/simple-update-notifier?activeTab=dependencies)
+[](https://www.npmjs.com/package/simple-update-notifier)
+[](https://bundlephobia.com/result?p=simple-update-notifier)
+[](https://www.npmjs.com/package/simple-update-notifier)
+[](./LICENSE)
+
+Simple update notifier to check for npm updates for cli applications.
+
+
+
+Checks for updates for an npm module and outputs to the command line if there is one available. The result is cached for the specified time so it doesn't check every time the app runs.
+
+## Install
+
+```bash
+npm install simple-update-notifier
+OR
+yarn add simple-update-notifier
+```
+
+## Usage
+
+```js
+import updateNotifier from 'simple-update-notifier';
+import packageJson from './package.json' assert { type: 'json' };
+
+updateNotifier({ pkg: packageJson });
+```
+
+### Options
+
+#### pkg
+
+Type: `object`
+
+##### name
+
+_Required_\
+Type: `string`
+
+##### version
+
+_Required_\
+Type: `string`
+
+#### updateCheckInterval
+
+Type: `number`\
+Default: `1000 * 60 * 60 * 24` _(1 day)_
+
+How often to check for updates.
+
+#### shouldNotifyInNpmScript
+
+Type: `boolean`\
+Default: `false`
+
+Allows notification to be shown when running as an npm script.
+
+#### distTag
+
+Type: `string`\
+Default: `'latest'`
+
+Which [dist-tag](https://docs.npmjs.com/adding-dist-tags-to-packages) to use to find the latest version.
+
+#### alwaysRun
+
+Type: `boolean`\
+Default: `false`
+
+When set, `updateCheckInterval` will not be respected and a check for an update will always be performed.
+
+#### debug
+
+Type: `boolean`\
+Default: `false`
+
+When set, logs explaining the decision will be output to `stderr` whenever the module opts to not print an update notification
diff --git a/node_modules/simple-update-notifier/build/index.d.ts b/node_modules/simple-update-notifier/build/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..60f53e0560e592029577d1e0c965d55c252b5e36
--- /dev/null
+++ b/node_modules/simple-update-notifier/build/index.d.ts
@@ -0,0 +1,13 @@
+interface IUpdate {
+ pkg: {
+ name: string;
+ version: string;
+ };
+ updateCheckInterval?: number;
+ shouldNotifyInNpmScript?: boolean;
+ distTag?: string;
+ alwaysRun?: boolean;
+ debug?: boolean;
+}
+declare const simpleUpdateNotifier: (args: IUpdate) => Promise;
+export { simpleUpdateNotifier as default };
diff --git a/node_modules/simple-update-notifier/build/index.js b/node_modules/simple-update-notifier/build/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..d7c3cde2ef4e3a4b4e97ed23d3645735f3f6d0cb
--- /dev/null
+++ b/node_modules/simple-update-notifier/build/index.js
@@ -0,0 +1,210 @@
+'use strict';
+
+var process$1 = require('process');
+var semver = require('semver');
+var os = require('os');
+var path = require('path');
+var fs = require('fs');
+var https = require('https');
+
+/******************************************************************************
+Copyright (c) Microsoft Corporation.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+***************************************************************************** */
+/* global Reflect, Promise */
+
+
+function __awaiter(thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+}
+
+function __generator(thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [op[0] & 2, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+}
+
+var packageJson = process$1.env.npm_package_json;
+var userAgent = process$1.env.npm_config_user_agent;
+var isNpm6 = Boolean(userAgent && userAgent.startsWith('npm'));
+var isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json'));
+var isNpm = isNpm6 || isNpm7;
+var isYarn = Boolean(userAgent && userAgent.startsWith('yarn'));
+var isNpmOrYarn = isNpm || isYarn;
+
+var homeDirectory = os.homedir();
+var configDir = process.env.XDG_CONFIG_HOME ||
+ path.join(homeDirectory, '.config', 'simple-update-notifier');
+var getConfigFile = function (packageName) {
+ return path.join(configDir, "".concat(packageName.replace('@', '').replace('/', '__'), ".json"));
+};
+var createConfigDir = function () {
+ if (!fs.existsSync(configDir)) {
+ fs.mkdirSync(configDir, { recursive: true });
+ }
+};
+var getLastUpdate = function (packageName) {
+ var configFile = getConfigFile(packageName);
+ try {
+ if (!fs.existsSync(configFile)) {
+ return undefined;
+ }
+ var file = JSON.parse(fs.readFileSync(configFile, 'utf8'));
+ return file.lastUpdateCheck;
+ }
+ catch (_a) {
+ return undefined;
+ }
+};
+var saveLastUpdate = function (packageName) {
+ var configFile = getConfigFile(packageName);
+ fs.writeFileSync(configFile, JSON.stringify({ lastUpdateCheck: new Date().getTime() }));
+};
+
+var getDistVersion = function (packageName, distTag) { return __awaiter(void 0, void 0, void 0, function () {
+ var url;
+ return __generator(this, function (_a) {
+ url = "https://registry.npmjs.org/-/package/".concat(packageName, "/dist-tags");
+ return [2 /*return*/, new Promise(function (resolve, reject) {
+ https
+ .get(url, function (res) {
+ var body = '';
+ res.on('data', function (chunk) { return (body += chunk); });
+ res.on('end', function () {
+ try {
+ var json = JSON.parse(body);
+ var version = json[distTag];
+ if (!version) {
+ reject(new Error('Error getting version'));
+ }
+ resolve(version);
+ }
+ catch (_a) {
+ reject(new Error('Could not parse version response'));
+ }
+ });
+ })
+ .on('error', function (err) { return reject(err); });
+ })];
+ });
+}); };
+
+var hasNewVersion = function (_a) {
+ var pkg = _a.pkg, _b = _a.updateCheckInterval, updateCheckInterval = _b === void 0 ? 1000 * 60 * 60 * 24 : _b, _c = _a.distTag, distTag = _c === void 0 ? 'latest' : _c, alwaysRun = _a.alwaysRun, debug = _a.debug;
+ return __awaiter(void 0, void 0, void 0, function () {
+ var lastUpdateCheck, latestVersion;
+ return __generator(this, function (_d) {
+ switch (_d.label) {
+ case 0:
+ createConfigDir();
+ lastUpdateCheck = getLastUpdate(pkg.name);
+ if (!(alwaysRun ||
+ !lastUpdateCheck ||
+ lastUpdateCheck < new Date().getTime() - updateCheckInterval)) return [3 /*break*/, 2];
+ return [4 /*yield*/, getDistVersion(pkg.name, distTag)];
+ case 1:
+ latestVersion = _d.sent();
+ saveLastUpdate(pkg.name);
+ if (semver.gt(latestVersion, pkg.version)) {
+ return [2 /*return*/, latestVersion];
+ }
+ else if (debug) {
+ console.error("Latest version (".concat(latestVersion, ") not newer than current version (").concat(pkg.version, ")"));
+ }
+ return [3 /*break*/, 3];
+ case 2:
+ if (debug) {
+ console.error("Too recent to check for a new update. simpleUpdateNotifier() interval set to ".concat(updateCheckInterval, "ms but only ").concat(new Date().getTime() - lastUpdateCheck, "ms since last check."));
+ }
+ _d.label = 3;
+ case 3: return [2 /*return*/, false];
+ }
+ });
+ });
+};
+
+var borderedText = function (text) {
+ var lines = text.split('\n');
+ var width = Math.max.apply(Math, lines.map(function (l) { return l.length; }));
+ var res = ["\u250C".concat('─'.repeat(width + 2), "\u2510")];
+ for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
+ var line = lines_1[_i];
+ res.push("\u2502 ".concat(line.padEnd(width), " \u2502"));
+ }
+ res.push("\u2514".concat('─'.repeat(width + 2), "\u2518"));
+ return res.join('\n');
+};
+
+var simpleUpdateNotifier = function (args) { return __awaiter(void 0, void 0, void 0, function () {
+ var latestVersion, err_1;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ if (!args.alwaysRun &&
+ (!process.stdout.isTTY || (isNpmOrYarn && !args.shouldNotifyInNpmScript))) {
+ if (args.debug) {
+ console.error('Opting out of running simpleUpdateNotifier()');
+ }
+ return [2 /*return*/];
+ }
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, hasNewVersion(args)];
+ case 2:
+ latestVersion = _a.sent();
+ if (latestVersion) {
+ console.error(borderedText("New version of ".concat(args.pkg.name, " available!\nCurrent Version: ").concat(args.pkg.version, "\nLatest Version: ").concat(latestVersion)));
+ }
+ return [3 /*break*/, 4];
+ case 3:
+ err_1 = _a.sent();
+ // Catch any network errors or cache writing errors so module doesn't cause a crash
+ if (args.debug && err_1 instanceof Error) {
+ console.error('Unexpected error in simpleUpdateNotifier():', err_1);
+ }
+ return [3 /*break*/, 4];
+ case 4: return [2 /*return*/];
+ }
+ });
+}); };
+
+module.exports = simpleUpdateNotifier;
diff --git a/node_modules/simple-update-notifier/package.json b/node_modules/simple-update-notifier/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..4d710a72e90eba53c3e080174ce488e85608e6d4
--- /dev/null
+++ b/node_modules/simple-update-notifier/package.json
@@ -0,0 +1,100 @@
+{
+ "name": "simple-update-notifier",
+ "version": "2.0.0",
+ "description": "Simple update notifier to check for npm updates for cli applications",
+ "main": "build/index.js",
+ "types": "build/index.d.ts",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/alexbrazier/simple-update-notifier.git"
+ },
+ "homepage": "https://github.com/alexbrazier/simple-update-notifier.git",
+ "author": "alexbrazier",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "scripts": {
+ "test": "jest src --noStackTrace",
+ "build": "rollup -c rollup.config.js --bundleConfigAsCjs",
+ "prettier:check": "prettier --check src/**/*.ts",
+ "prettier": "prettier --write src/**/*.ts",
+ "eslint": "eslint src/**/*.ts",
+ "lint": "yarn prettier:check && yarn eslint",
+ "prepare": "yarn lint && yarn build",
+ "release": "release-it"
+ },
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
+ "devDependencies": {
+ "@babel/preset-env": "^7.22.5",
+ "@babel/preset-typescript": "^7.22.5",
+ "@release-it/conventional-changelog": "^5.1.1",
+ "@types/jest": "^29.5.2",
+ "@types/node": "^20.3.1",
+ "@typescript-eslint/eslint-plugin": "^5.60.0",
+ "@typescript-eslint/parser": "^5.60.0",
+ "eslint": "^8.43.0",
+ "eslint-config-prettier": "^8.8.0",
+ "eslint-plugin-prettier": "^4.0.0",
+ "jest": "^29.5.0",
+ "prettier": "^2.8.8",
+ "release-it": "^15.11.0",
+ "rollup": "^3.25.2",
+ "rollup-plugin-ts": "^3.2.0",
+ "typescript": "^5.1.3"
+ },
+ "resolutions": {
+ "semver": "^7.5.3"
+ },
+ "publishConfig": {
+ "registry": "https://registry.npmjs.org/"
+ },
+ "files": [
+ "build",
+ "src"
+ ],
+ "release-it": {
+ "git": {
+ "commitMessage": "chore: release ${version}",
+ "tagName": "v${version}"
+ },
+ "npm": {
+ "publish": true
+ },
+ "github": {
+ "release": true
+ },
+ "plugins": {
+ "@release-it/conventional-changelog": {
+ "preset": "angular",
+ "infile": "CHANGELOG.md"
+ }
+ }
+ },
+ "eslintConfig": {
+ "plugins": [
+ "@typescript-eslint",
+ "prettier"
+ ],
+ "extends": [
+ "prettier",
+ "eslint:recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "parser": "@typescript-eslint/parser",
+ "rules": {
+ "prettier/prettier": [
+ "error",
+ {
+ "quoteProps": "consistent",
+ "singleQuote": true,
+ "tabWidth": 2,
+ "trailingComma": "es5",
+ "useTabs": false
+ }
+ ]
+ }
+ }
+}
diff --git a/node_modules/simple-update-notifier/src/borderedText.ts b/node_modules/simple-update-notifier/src/borderedText.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7145ac2f43189ec3c945d1009df3dfe3d4c92d36
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/borderedText.ts
@@ -0,0 +1,12 @@
+const borderedText = (text: string) => {
+ const lines = text.split('\n');
+ const width = Math.max(...lines.map((l) => l.length));
+ const res = [`┌${'─'.repeat(width + 2)}┐`];
+ for (const line of lines) {
+ res.push(`│ ${line.padEnd(width)} │`);
+ }
+ res.push(`└${'─'.repeat(width + 2)}┘`);
+ return res.join('\n');
+};
+
+export default borderedText;
diff --git a/node_modules/simple-update-notifier/src/cache.spec.ts b/node_modules/simple-update-notifier/src/cache.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..49e1cb276993af3991196dca44a43f9f14da17a9
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/cache.spec.ts
@@ -0,0 +1,17 @@
+import { createConfigDir, getLastUpdate, saveLastUpdate } from './cache';
+
+createConfigDir();
+
+jest.useFakeTimers().setSystemTime(new Date('2022-01-01'));
+
+const fakeTime = new Date('2022-01-01').getTime();
+
+test('can save update then get the update details', () => {
+ saveLastUpdate('test');
+ expect(getLastUpdate('test')).toBe(fakeTime);
+});
+
+test('prefixed module can save update then get the update details', () => {
+ saveLastUpdate('@alexbrazier/test');
+ expect(getLastUpdate('@alexbrazier/test')).toBe(fakeTime);
+});
diff --git a/node_modules/simple-update-notifier/src/cache.ts b/node_modules/simple-update-notifier/src/cache.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e11deba0ae1e8694311a9cc792014d727534d0df
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/cache.ts
@@ -0,0 +1,44 @@
+import os from 'os';
+import path from 'path';
+import fs from 'fs';
+
+const homeDirectory = os.homedir();
+const configDir =
+ process.env.XDG_CONFIG_HOME ||
+ path.join(homeDirectory, '.config', 'simple-update-notifier');
+
+const getConfigFile = (packageName: string) => {
+ return path.join(
+ configDir,
+ `${packageName.replace('@', '').replace('/', '__')}.json`
+ );
+};
+
+export const createConfigDir = () => {
+ if (!fs.existsSync(configDir)) {
+ fs.mkdirSync(configDir, { recursive: true });
+ }
+};
+
+export const getLastUpdate = (packageName: string) => {
+ const configFile = getConfigFile(packageName);
+
+ try {
+ if (!fs.existsSync(configFile)) {
+ return undefined;
+ }
+ const file = JSON.parse(fs.readFileSync(configFile, 'utf8'));
+ return file.lastUpdateCheck as number;
+ } catch {
+ return undefined;
+ }
+};
+
+export const saveLastUpdate = (packageName: string) => {
+ const configFile = getConfigFile(packageName);
+
+ fs.writeFileSync(
+ configFile,
+ JSON.stringify({ lastUpdateCheck: new Date().getTime() })
+ );
+};
diff --git a/node_modules/simple-update-notifier/src/getDistVersion.spec.ts b/node_modules/simple-update-notifier/src/getDistVersion.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b78a42e5aa90f08aa6508eb9243e612b8f7c9040
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/getDistVersion.spec.ts
@@ -0,0 +1,35 @@
+import Stream from 'stream';
+import https from 'https';
+import getDistVersion from './getDistVersion';
+
+jest.mock('https', () => ({
+ get: jest.fn(),
+}));
+
+test('Valid response returns version', async () => {
+ const st = new Stream();
+ (https.get as jest.Mock).mockImplementation((url, cb) => {
+ cb(st);
+
+ st.emit('data', '{"latest":"1.0.0"}');
+ st.emit('end');
+ });
+
+ const version = await getDistVersion('test', 'latest');
+
+ expect(version).toEqual('1.0.0');
+});
+
+test('Invalid response throws error', async () => {
+ const st = new Stream();
+ (https.get as jest.Mock).mockImplementation((url, cb) => {
+ cb(st);
+
+ st.emit('data', 'some invalid json');
+ st.emit('end');
+ });
+
+ expect(getDistVersion('test', 'latest')).rejects.toThrow(
+ 'Could not parse version response'
+ );
+});
diff --git a/node_modules/simple-update-notifier/src/getDistVersion.ts b/node_modules/simple-update-notifier/src/getDistVersion.ts
new file mode 100644
index 0000000000000000000000000000000000000000..d474e1f9ead19135a390c930e5801f4e6910c0a4
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/getDistVersion.ts
@@ -0,0 +1,29 @@
+import https from 'https';
+
+const getDistVersion = async (packageName: string, distTag: string) => {
+ const url = `https://registry.npmjs.org/-/package/${packageName}/dist-tags`;
+
+ return new Promise((resolve, reject) => {
+ https
+ .get(url, (res) => {
+ let body = '';
+
+ res.on('data', (chunk) => (body += chunk));
+ res.on('end', () => {
+ try {
+ const json = JSON.parse(body);
+ const version = json[distTag];
+ if (!version) {
+ reject(new Error('Error getting version'));
+ }
+ resolve(version);
+ } catch {
+ reject(new Error('Could not parse version response'));
+ }
+ });
+ })
+ .on('error', (err) => reject(err));
+ });
+};
+
+export default getDistVersion;
diff --git a/node_modules/simple-update-notifier/src/hasNewVersion.spec.ts b/node_modules/simple-update-notifier/src/hasNewVersion.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..af7ab22cacee30687de862601171a819fd95c782
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/hasNewVersion.spec.ts
@@ -0,0 +1,82 @@
+import hasNewVersion from './hasNewVersion';
+import { getLastUpdate } from './cache';
+import getDistVersion from './getDistVersion';
+
+jest.mock('./getDistVersion', () => jest.fn().mockReturnValue('1.0.0'));
+jest.mock('./cache', () => ({
+ getLastUpdate: jest.fn().mockReturnValue(undefined),
+ createConfigDir: jest.fn(),
+ saveLastUpdate: jest.fn(),
+}));
+
+const pkg = { name: 'test', version: '1.0.0' };
+
+afterEach(() => jest.clearAllMocks());
+
+const defaultArgs = {
+ pkg,
+ shouldNotifyInNpmScript: true,
+ alwaysRun: true,
+};
+
+test('it should not trigger update for same version', async () => {
+ const newVersion = await hasNewVersion(defaultArgs);
+
+ expect(newVersion).toBe(false);
+});
+
+test('it should trigger update for patch version bump', async () => {
+ (getDistVersion as jest.Mock).mockReturnValue('1.0.1');
+
+ const newVersion = await hasNewVersion(defaultArgs);
+
+ expect(newVersion).toBe('1.0.1');
+});
+
+test('it should trigger update for minor version bump', async () => {
+ (getDistVersion as jest.Mock).mockReturnValue('1.1.0');
+
+ const newVersion = await hasNewVersion(defaultArgs);
+
+ expect(newVersion).toBe('1.1.0');
+});
+
+test('it should trigger update for major version bump', async () => {
+ (getDistVersion as jest.Mock).mockReturnValue('2.0.0');
+
+ const newVersion = await hasNewVersion(defaultArgs);
+
+ expect(newVersion).toBe('2.0.0');
+});
+
+test('it should not trigger update if version is lower', async () => {
+ (getDistVersion as jest.Mock).mockReturnValue('0.0.9');
+
+ const newVersion = await hasNewVersion(defaultArgs);
+
+ expect(newVersion).toBe(false);
+});
+
+it('should trigger update check if last update older than config', async () => {
+ const TWO_WEEKS = new Date().getTime() - 1000 * 60 * 60 * 24 * 14;
+ (getLastUpdate as jest.Mock).mockReturnValue(TWO_WEEKS);
+ const newVersion = await hasNewVersion({
+ pkg,
+ shouldNotifyInNpmScript: true,
+ });
+
+ expect(newVersion).toBe(false);
+ expect(getDistVersion).toHaveBeenCalled();
+});
+
+it('should not trigger update check if last update is too recent', async () => {
+ const TWELVE_HOURS = new Date().getTime() - 1000 * 60 * 60 * 12;
+ (getLastUpdate as jest.Mock).mockReturnValue(TWELVE_HOURS);
+ const newVersion = await hasNewVersion({
+ pkg,
+ shouldNotifyInNpmScript: true,
+ });
+
+ expect(newVersion).toBe(false);
+ expect(getDistVersion).not.toHaveBeenCalled();
+});
diff --git a/node_modules/simple-update-notifier/src/hasNewVersion.ts b/node_modules/simple-update-notifier/src/hasNewVersion.ts
new file mode 100644
index 0000000000000000000000000000000000000000..31d5069f97d3abf90d2c105374c21c44bde35b82
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/hasNewVersion.ts
@@ -0,0 +1,40 @@
+import semver from 'semver';
+import { createConfigDir, getLastUpdate, saveLastUpdate } from './cache';
+import getDistVersion from './getDistVersion';
+import { IUpdate } from './types';
+
+const hasNewVersion = async ({
+ pkg,
+ updateCheckInterval = 1000 * 60 * 60 * 24,
+ distTag = 'latest',
+ alwaysRun,
+ debug,
+}: IUpdate) => {
+ createConfigDir();
+ const lastUpdateCheck = getLastUpdate(pkg.name);
+ if (
+ alwaysRun ||
+ !lastUpdateCheck ||
+ lastUpdateCheck < new Date().getTime() - updateCheckInterval
+ ) {
+ const latestVersion = await getDistVersion(pkg.name, distTag);
+ saveLastUpdate(pkg.name);
+ if (semver.gt(latestVersion, pkg.version)) {
+ return latestVersion;
+ } else if (debug) {
+ console.error(
+ `Latest version (${latestVersion}) not newer than current version (${pkg.version})`
+ );
+ }
+ } else if (debug) {
+ console.error(
+ `Too recent to check for a new update. simpleUpdateNotifier() interval set to ${updateCheckInterval}ms but only ${
+ new Date().getTime() - lastUpdateCheck
+ }ms since last check.`
+ );
+ }
+
+ return false;
+};
+
+export default hasNewVersion;
diff --git a/node_modules/simple-update-notifier/src/index.spec.ts b/node_modules/simple-update-notifier/src/index.spec.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98ffb5a9201cc15e27251e3bbe4f190a422ab0eb
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/index.spec.ts
@@ -0,0 +1,27 @@
+import simpleUpdateNotifier from '.';
+import hasNewVersion from './hasNewVersion';
+
+const consoleSpy = jest.spyOn(console, 'error');
+
+jest.mock('./hasNewVersion', () => jest.fn().mockResolvedValue('2.0.0'));
+
+beforeEach(jest.clearAllMocks);
+
+test('it logs message if update is available', async () => {
+ await simpleUpdateNotifier({
+ pkg: { name: 'test', version: '1.0.0' },
+ alwaysRun: true,
+ });
+
+ expect(consoleSpy).toHaveBeenCalledTimes(1);
+});
+
+test('it does not log message if update is not available', async () => {
+ (hasNewVersion as jest.Mock).mockResolvedValue(false);
+ await simpleUpdateNotifier({
+ pkg: { name: 'test', version: '2.0.0' },
+ alwaysRun: true,
+ });
+
+ expect(consoleSpy).toHaveBeenCalledTimes(0);
+});
diff --git a/node_modules/simple-update-notifier/src/index.ts b/node_modules/simple-update-notifier/src/index.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2b0d2cfcd7a4d1596e2257c7fe0d73cdf9bb49e4
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/index.ts
@@ -0,0 +1,34 @@
+import isNpmOrYarn from './isNpmOrYarn';
+import hasNewVersion from './hasNewVersion';
+import { IUpdate } from './types';
+import borderedText from './borderedText';
+
+const simpleUpdateNotifier = async (args: IUpdate) => {
+ if (
+ !args.alwaysRun &&
+ (!process.stdout.isTTY || (isNpmOrYarn && !args.shouldNotifyInNpmScript))
+ ) {
+ if (args.debug) {
+ console.error('Opting out of running simpleUpdateNotifier()');
+ }
+ return;
+ }
+
+ try {
+ const latestVersion = await hasNewVersion(args);
+ if (latestVersion) {
+ console.error(
+ borderedText(`New version of ${args.pkg.name} available!
+Current Version: ${args.pkg.version}
+Latest Version: ${latestVersion}`)
+ );
+ }
+ } catch (err) {
+ // Catch any network errors or cache writing errors so module doesn't cause a crash
+ if (args.debug && err instanceof Error) {
+ console.error('Unexpected error in simpleUpdateNotifier():', err);
+ }
+ }
+};
+
+export default simpleUpdateNotifier;
diff --git a/node_modules/simple-update-notifier/src/isNpmOrYarn.ts b/node_modules/simple-update-notifier/src/isNpmOrYarn.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ee4c8371afc074e93c8bd48bfe6ba9257c19cbee
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/isNpmOrYarn.ts
@@ -0,0 +1,12 @@
+import process from 'process';
+
+const packageJson = process.env.npm_package_json;
+const userAgent = process.env.npm_config_user_agent;
+const isNpm6 = Boolean(userAgent && userAgent.startsWith('npm'));
+const isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json'));
+
+const isNpm = isNpm6 || isNpm7;
+const isYarn = Boolean(userAgent && userAgent.startsWith('yarn'));
+const isNpmOrYarn = isNpm || isYarn;
+
+export default isNpmOrYarn;
diff --git a/node_modules/simple-update-notifier/src/types.ts b/node_modules/simple-update-notifier/src/types.ts
new file mode 100644
index 0000000000000000000000000000000000000000..c395eb002762d0d4cca2b254b073b33db8b83da4
--- /dev/null
+++ b/node_modules/simple-update-notifier/src/types.ts
@@ -0,0 +1,8 @@
+export interface IUpdate {
+ pkg: { name: string; version: string };
+ updateCheckInterval?: number;
+ shouldNotifyInNpmScript?: boolean;
+ distTag?: string;
+ alwaysRun?: boolean;
+ debug?: boolean;
+}
diff --git a/node_modules/simple-xml-to-json/README.md b/node_modules/simple-xml-to-json/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..de175a793945c47b61a197ee0e116b8d627db834
--- /dev/null
+++ b/node_modules/simple-xml-to-json/README.md
@@ -0,0 +1,87 @@
+# A simple XML to JSON converter
+
+[](https://www.npmjs.com/package/simple-xml-to-json)
+[](https://github.com/nirgit/simple-xml-to-json/actions/workflows/node.js.yml)
+[](https://codecov.io/gh/nirgit/simple-xml-to-json)
+
+## Install
+Simply install using NPM in your project directory
+> npm install simple-xml-to-json
+
+
+## Usage and API
+### 1. convertXML(xmlToConvert [,customConverter])
+ * `xmlToConvert` \
+ * `customConverter` \
+ * Returns: \ by default or other if `customConverter` is used
+
+### 2. createAST(xmlToConvert)
+ * `xmlToConvert` \
+ * Returns: An AST representation of the XML \
+
+**CommonJS (Node.js):**
+```javascript
+const { convertXML, createAST } = require("simple-xml-to-json")
+
+const myJson = convertXML(myXMLString)
+const myYaml = convertXML(myXMLString, yamlConverter)
+const myAst = createAST(myXMLString)
+```
+
+**ESM (modern frontend apps, Node.js with `"type": "module"`, bundlers):**
+```javascript
+import { convertXML, createAST } from "simple-xml-to-json"
+
+const myJson = convertXML(myXMLString)
+const myYaml = convertXML(myXMLString, yamlConverter)
+const myAst = createAST(myXMLString)
+```
+
+---
+###  Typescript compatible
+---
+
+## Notes and how to use code
+1. The easiest thing to start is to run `node example/example.js` (CJS) or `node example/example.mjs` (ESM) in your terminal and see what happens.
+2. There's the `xmlToJson.js` file for convenience. Just pass in the XML as a String.
+3. MIT licensed allowing code customization
+4. Profit
+
+## How this works in a nutshell
+1. The library converts the XML to an AST
+2. There is a JSON converter that takes the AST and spits out a JSON
+3. You can write your own converters if you need XML-to-ANY-OTHER-FORMAT
+
+## Benchmark
+
+_Take these results with a grain of salt._\
+According to a __simple__ benchmark test I performed in __April 2024__ with a random XML. _YMMV_.
+
+
+* The chart results __may be__ outdated. [Run the test yourself](https://runkit.com/nirgit/6620cf27943a41000847221d)
+
+
+## Current Drawbacks
+1. All values are translated to strings in JSON
+2. There are currently reserved words in the JSON converter:
+ * "content" - up to version 1.2.3
+ * "children"
+
+### Default Mapping & Collisions
+
+By default, an element's **text content** is mapped to a `"content"` property, while its **attributes** are mapped directly to JSON properties of the same name.
+
+#### The Risk
+If an XML element possesses an attribute actually named `content` while also containing text content, a **name collision** occurs. This typically results in a parsing error or data loss due to duplicate keys.
+
+**Example Collision:**
+```xml
+text-content
+ ```
+
+### Version 1.2.3+ Fix
+To prevent these collisions, versions newer than 1.2.3 will specifically prefix the `"content"` attribute name with an `@` symbol. So the attribute `"content"` now becomes the `"@content"` JSON property.
+
+
+> [!NOTE]
+> If you need to, you can write your own converter from the AST created by the parser, and pass it as a 2nd parameter after the xml string
diff --git a/node_modules/simple-xml-to-json/lib/simpleXmlToJson.js b/node_modules/simple-xml-to-json/lib/simpleXmlToJson.js
new file mode 100644
index 0000000000000000000000000000000000000000..9eeb8f8316e15f591b5a665889495ea45c3fea3b
--- /dev/null
+++ b/node_modules/simple-xml-to-json/lib/simpleXmlToJson.js
@@ -0,0 +1,590 @@
+'use strict';
+
+function getDefaultExportFromCjs (x) {
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
+}
+
+var constants;
+var hasRequiredConstants;
+
+function requireConstants () {
+ if (hasRequiredConstants) return constants;
+ hasRequiredConstants = 1;
+
+ constants = {
+ BUILD: {
+ COMPTIME: true
+ },
+ NODE_TYPE: {
+ ATTRIBUTE: 'ATTRIBUTE',
+ CONTENT: 'CONTENT',
+ ELEMENT: 'ELEMENT',
+ ROOT: 'ROOT'
+ },
+ TOKEN_TYPE: {
+ OPEN_BRACKET: 'OPEN_BRACKET',
+ ELEMENT_TYPE: 'ELEMENT_TYPE',
+ CLOSE_ELEMENT: 'CLOSE_ELEMENT',
+ ATTRIB_NAME: 'ATTRIB_NAME',
+ ATTRIB_VALUE: 'ATTRIB_VALUE',
+ ASSIGN: 'ASSIGN',
+ CLOSE_BRACKET: 'CLOSE_BRACKET',
+ CONTENT: 'CONTENT',
+ EOF: 'EOF'
+ }
+ };
+ return constants;
+}
+
+var astToJson;
+var hasRequiredAstToJson;
+
+function requireAstToJson () {
+ if (hasRequiredAstToJson) return astToJson;
+ hasRequiredAstToJson = 1;
+
+ const { NODE_TYPE } = requireConstants();
+
+ const convertToJSON = ast => {
+ return buildJSONFromNode(ast.value.children[0])
+ };
+
+ const buildJSONFromNode = node => {
+ if (!node) return null
+ const json = {};
+ switch (node.type) {
+ case "ELEMENT": {
+ let element = {};
+ const attribs = buildAttributes(node.value.attributes);
+ const children = buildJSONFromNode(node.value.children);
+ if (attribs) {
+ element = Object.assign(element, attribs);
+ }
+ if (children) {
+ const jsonChildren = buildChildren(node.value.children);
+ element = Object.assign(element, jsonChildren);
+ }
+ json[node.value.type] = element;
+ break
+ }
+ case "ATTRIBUTE": {
+ const attribNameAndValue = node.value;
+ json[attribNameAndValue.name] = attribNameAndValue.value;
+ break
+ }
+ case "CONTENT": {
+ return {content: node.value}
+ }
+ }
+
+ return json
+ };
+
+ const buildChildren = children => {
+ if (!children || !Array.isArray(children) || children.length === 0) return null
+ if (isContentChildren(children)) {
+ return {
+ content: children[0].value
+ }
+ }
+ return {
+ children: children.map(buildJSONFromNode)
+ }
+ };
+
+ const isContentChildren = children => children && Array.isArray(children) && children.length === 1 && children[0].type === "CONTENT";
+
+ const buildAttributes = arrayNodes => {
+ if (arrayNodes && Array.isArray(arrayNodes)) {
+ const jsonArray = arrayNodes.map(buildJSONFromNode);
+ return jsonArray.reduce((agg, j) => Object.assign(agg, j), {})
+ }
+ return null
+ };
+
+ astToJson = {
+ convert: convertToJSON
+ };
+ return astToJson;
+}
+
+var model;
+var hasRequiredModel;
+
+function requireModel () {
+ if (hasRequiredModel) return model;
+ hasRequiredModel = 1;
+
+ const Token = (type, value) => ({
+ type,
+ value
+ });
+
+ model = {
+ Token
+ };
+ return model;
+}
+
+var lexer;
+var hasRequiredLexer;
+
+function requireLexer () {
+ if (hasRequiredLexer) return lexer;
+ hasRequiredLexer = 1;
+
+ const { BUILD, TOKEN_TYPE } = requireConstants();
+ const { Token } = requireModel();
+
+ const EOF_TOKEN = Token("EOF");
+
+ const isCharBlank = (char) =>
+ char === ' ' || char === '\n' || char === '\r' || char === '\t';
+
+ const skipXMLDocumentHeader = (xmlAsString, pos) => {
+ if (xmlAsString.startsWith('') {
+ return pos + 2 // skip "?>""
+ } else {
+ pos++;
+ }
+ }
+ }
+ return pos
+ };
+
+ const replaceQuotes = (str) => str.replace(/'/g, "'");
+
+ const getInitialPosForLexer = (xmlAsString) => {
+ let pos = 0;
+ while (pos < xmlAsString.length && isCharBlank(xmlAsString[pos])) pos++;
+ return skipXMLDocumentHeader(xmlAsString, pos)
+ };
+
+ function createLexer(xmlAsString) {
+ let currentToken = null;
+ let pos = getInitialPosForLexer(xmlAsString);
+ let scopingElement = [];
+
+ const peek = () => xmlAsString[pos];
+ const hasNext = () => currentToken !== EOF_TOKEN && pos < xmlAsString.length;
+ const isBlankSpace = () => isCharBlank(xmlAsString[pos]);
+
+ const skipQuotes = () => {
+ if (hasNext() && isQuote(peek())) pos++;
+ };
+
+ const isQuote = (char) => '"' === char || "'" === char;
+
+ const skipSpaces = () => {
+ while (hasNext() && isBlankSpace()) pos++;
+ };
+
+ const readAlphaNumericCharsOrBrackets = (areSpecialCharsSupported) => {
+ if (hasNext()) {
+ if (xmlAsString[pos] === '<') {
+ let buffer = '<';
+ pos++;
+ if (hasNext() && xmlAsString[pos] === '/') {
+ pos++;
+ buffer = '';
+ } else if (
+ hasNext() &&
+ xmlAsString[pos] === '!' &&
+ xmlAsString[pos + 1] === '-' &&
+ xmlAsString[pos + 2] === '-'
+ ) {
+ // its a comment
+ pos++;
+ pos++;
+ pos++;
+ buffer = '
+
+--------------------------------------------------------------------------------
+
+
+
+
+
+## Table of Contents
+
+- [Examples](#examples)
+ - [Consuming a source map](#consuming-a-source-map)
+ - [Generating a source map](#generating-a-source-map)
+ - [With SourceNode (high level API)](#with-sourcenode-high-level-api)
+ - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api)
+- [API](#api)
+ - [SourceMapConsumer](#sourcemapconsumer)
+ - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap)
+ - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans)
+ - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition)
+ - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition)
+ - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition)
+ - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources)
+ - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing)
+ - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order)
+ - [SourceMapGenerator](#sourcemapgenerator)
+ - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap)
+ - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer)
+ - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping)
+ - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent)
+ - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath)
+ - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring)
+ - [SourceNode](#sourcenode)
+ - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name)
+ - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath)
+ - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk)
+ - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk)
+ - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent)
+ - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn)
+ - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn)
+ - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep)
+ - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement)
+ - [SourceNode.prototype.toString()](#sourcenodeprototypetostring)
+ - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap)
+
+
+
+## Examples
+
+### Consuming a source map
+
+```js
+var rawSourceMap = {
+ version: 3,
+ file: 'min.js',
+ names: ['bar', 'baz', 'n'],
+ sources: ['one.js', 'two.js'],
+ sourceRoot: 'http://example.com/www/js/',
+ mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA'
+};
+
+var smc = new SourceMapConsumer(rawSourceMap);
+
+console.log(smc.sources);
+// [ 'http://example.com/www/js/one.js',
+// 'http://example.com/www/js/two.js' ]
+
+console.log(smc.originalPositionFor({
+ line: 2,
+ column: 28
+}));
+// { source: 'http://example.com/www/js/two.js',
+// line: 2,
+// column: 10,
+// name: 'n' }
+
+console.log(smc.generatedPositionFor({
+ source: 'http://example.com/www/js/two.js',
+ line: 2,
+ column: 10
+}));
+// { line: 2, column: 28 }
+
+smc.eachMapping(function (m) {
+ // ...
+});
+```
+
+### Generating a source map
+
+In depth guide:
+[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/)
+
+#### With SourceNode (high level API)
+
+```js
+function compile(ast) {
+ switch (ast.type) {
+ case 'BinaryExpression':
+ return new SourceNode(
+ ast.location.line,
+ ast.location.column,
+ ast.location.source,
+ [compile(ast.left), " + ", compile(ast.right)]
+ );
+ case 'Literal':
+ return new SourceNode(
+ ast.location.line,
+ ast.location.column,
+ ast.location.source,
+ String(ast.value)
+ );
+ // ...
+ default:
+ throw new Error("Bad AST");
+ }
+}
+
+var ast = parse("40 + 2", "add.js");
+console.log(compile(ast).toStringWithSourceMap({
+ file: 'add.js'
+}));
+// { code: '40 + 2',
+// map: [object SourceMapGenerator] }
+```
+
+#### With SourceMapGenerator (low level API)
+
+```js
+var map = new SourceMapGenerator({
+ file: "source-mapped.js"
+});
+
+map.addMapping({
+ generated: {
+ line: 10,
+ column: 35
+ },
+ source: "foo.js",
+ original: {
+ line: 33,
+ column: 2
+ },
+ name: "christopher"
+});
+
+console.log(map.toString());
+// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}'
+```
+
+## API
+
+Get a reference to the module:
+
+```js
+// Node.js
+var sourceMap = require('source-map');
+
+// Browser builds
+var sourceMap = window.sourceMap;
+
+// Inside Firefox
+const sourceMap = require("devtools/toolkit/sourcemap/source-map.js");
+```
+
+### SourceMapConsumer
+
+A SourceMapConsumer instance represents a parsed source map which we can query
+for information about the original file positions by giving it a file position
+in the generated source.
+
+#### new SourceMapConsumer(rawSourceMap)
+
+The only parameter is the raw source map (either as a string which can be
+`JSON.parse`'d, or an object). According to the spec, source maps have the
+following attributes:
+
+* `version`: Which version of the source map spec this map is following.
+
+* `sources`: An array of URLs to the original source files.
+
+* `names`: An array of identifiers which can be referenced by individual
+ mappings.
+
+* `sourceRoot`: Optional. The URL root from which all sources are relative.
+
+* `sourcesContent`: Optional. An array of contents of the original source files.
+
+* `mappings`: A string of base64 VLQs which contain the actual mappings.
+
+* `file`: Optional. The generated filename this source map is associated with.
+
+```js
+var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData);
+```
+
+#### SourceMapConsumer.prototype.computeColumnSpans()
+
+Compute the last column for each generated mapping. The last column is
+inclusive.
+
+```js
+// Before:
+consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
+// [ { line: 2,
+// column: 1 },
+// { line: 2,
+// column: 10 },
+// { line: 2,
+// column: 20 } ]
+
+consumer.computeColumnSpans();
+
+// After:
+consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" })
+// [ { line: 2,
+// column: 1,
+// lastColumn: 9 },
+// { line: 2,
+// column: 10,
+// lastColumn: 19 },
+// { line: 2,
+// column: 20,
+// lastColumn: Infinity } ]
+
+```
+
+#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition)
+
+Returns the original source, line, and column information for the generated
+source's line and column positions provided. The only argument is an object with
+the following properties:
+
+* `line`: The line number in the generated source. Line numbers in
+ this library are 1-based (note that the underlying source map
+ specification uses 0-based line numbers -- this library handles the
+ translation).
+
+* `column`: The column number in the generated source. Column numbers
+ in this library are 0-based.
+
+* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or
+ `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest
+ element that is smaller than or greater than the one we are searching for,
+ respectively, if the exact element cannot be found. Defaults to
+ `SourceMapConsumer.GREATEST_LOWER_BOUND`.
+
+and an object is returned with the following properties:
+
+* `source`: The original source file, or null if this information is not
+ available.
+
+* `line`: The line number in the original source, or null if this information is
+ not available. The line number is 1-based.
+
+* `column`: The column number in the original source, or null if this
+ information is not available. The column number is 0-based.
+
+* `name`: The original identifier, or null if this information is not available.
+
+```js
+consumer.originalPositionFor({ line: 2, column: 10 })
+// { source: 'foo.coffee',
+// line: 2,
+// column: 2,
+// name: null }
+
+consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 })
+// { source: null,
+// line: null,
+// column: null,
+// name: null }
+```
+
+#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition)
+
+Returns the generated line and column information for the original source,
+line, and column positions provided. The only argument is an object with
+the following properties:
+
+* `source`: The filename of the original source.
+
+* `line`: The line number in the original source. The line number is
+ 1-based.
+
+* `column`: The column number in the original source. The column
+ number is 0-based.
+
+and an object is returned with the following properties:
+
+* `line`: The line number in the generated source, or null. The line
+ number is 1-based.
+
+* `column`: The column number in the generated source, or null. The
+ column number is 0-based.
+
+```js
+consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 })
+// { line: 1,
+// column: 56 }
+```
+
+#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)
+
+Returns all generated line and column information for the original source, line,
+and column provided. If no column is provided, returns all mappings
+corresponding to a either the line we are searching for or the next closest line
+that has any mappings. Otherwise, returns all mappings corresponding to the
+given line and either the column we are searching for or the next closest column
+that has any offsets.
+
+The only argument is an object with the following properties:
+
+* `source`: The filename of the original source.
+
+* `line`: The line number in the original source. The line number is
+ 1-based.
+
+* `column`: Optional. The column number in the original source. The
+ column number is 0-based.
+
+and an array of objects is returned, each with the following properties:
+
+* `line`: The line number in the generated source, or null. The line
+ number is 1-based.
+
+* `column`: The column number in the generated source, or null. The
+ column number is 0-based.
+
+```js
+consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" })
+// [ { line: 2,
+// column: 1 },
+// { line: 2,
+// column: 10 },
+// { line: 2,
+// column: 20 } ]
+```
+
+#### SourceMapConsumer.prototype.hasContentsOfAllSources()
+
+Return true if we have the embedded source content for every source listed in
+the source map, false otherwise.
+
+In other words, if this method returns `true`, then
+`consumer.sourceContentFor(s)` will succeed for every source `s` in
+`consumer.sources`.
+
+```js
+// ...
+if (consumer.hasContentsOfAllSources()) {
+ consumerReadyCallback(consumer);
+} else {
+ fetchSources(consumer, consumerReadyCallback);
+}
+// ...
+```
+
+#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])
+
+Returns the original source content for the source provided. The only
+argument is the URL of the original source file.
+
+If the source content for the given source is not found, then an error is
+thrown. Optionally, pass `true` as the second param to have `null` returned
+instead.
+
+```js
+consumer.sources
+// [ "my-cool-lib.clj" ]
+
+consumer.sourceContentFor("my-cool-lib.clj")
+// "..."
+
+consumer.sourceContentFor("this is not in the source map");
+// Error: "this is not in the source map" is not in the source map
+
+consumer.sourceContentFor("this is not in the source map", true);
+// null
+```
+
+#### SourceMapConsumer.prototype.eachMapping(callback, context, order)
+
+Iterate over each mapping between an original source/line/column and a
+generated line/column in this source map.
+
+* `callback`: The function that is called with each mapping. Mappings have the
+ form `{ source, generatedLine, generatedColumn, originalLine, originalColumn,
+ name }`
+
+* `context`: Optional. If specified, this object will be the value of `this`
+ every time that `callback` is called.
+
+* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or
+ `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over
+ the mappings sorted by the generated file's line/column order or the
+ original's source/line/column order, respectively. Defaults to
+ `SourceMapConsumer.GENERATED_ORDER`.
+
+```js
+consumer.eachMapping(function (m) { console.log(m); })
+// ...
+// { source: 'illmatic.js',
+// generatedLine: 1,
+// generatedColumn: 0,
+// originalLine: 1,
+// originalColumn: 0,
+// name: null }
+// { source: 'illmatic.js',
+// generatedLine: 2,
+// generatedColumn: 0,
+// originalLine: 2,
+// originalColumn: 0,
+// name: null }
+// ...
+```
+### SourceMapGenerator
+
+An instance of the SourceMapGenerator represents a source map which is being
+built incrementally.
+
+#### new SourceMapGenerator([startOfSourceMap])
+
+You may pass an object with the following properties:
+
+* `file`: The filename of the generated source that this source map is
+ associated with.
+
+* `sourceRoot`: A root for all relative URLs in this source map.
+
+* `skipValidation`: Optional. When `true`, disables validation of mappings as
+ they are added. This can improve performance but should be used with
+ discretion, as a last resort. Even then, one should avoid using this flag when
+ running tests, if possible.
+
+* `ignoreInvalidMapping`: Optional. When `true`, instead of throwing error on
+ invalid mapping, it will be ignored.
+
+```js
+var generator = new sourceMap.SourceMapGenerator({
+ file: "my-generated-javascript-file.js",
+ sourceRoot: "http://example.com/app/js/"
+});
+```
+
+#### SourceMapGenerator.fromSourceMap(sourceMapConsumer, sourceMapGeneratorOptions)
+
+Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance.
+
+* `sourceMapConsumer` The SourceMap.
+
+* `sourceMapGeneratorOptions` options that will be passed to the SourceMapGenerator constructor which used under the hood.
+
+```js
+var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer, {
+ ignoreInvalidMapping: true,
+});
+```
+
+#### SourceMapGenerator.prototype.addMapping(mapping)
+
+Add a single mapping from original source line and column to the generated
+source's line and column for this source map being created. The mapping object
+should have the following properties:
+
+* `generated`: An object with the generated line and column positions.
+
+* `original`: An object with the original line and column positions.
+
+* `source`: The original source file (relative to the sourceRoot).
+
+* `name`: An optional original token name for this mapping.
+
+```js
+generator.addMapping({
+ source: "module-one.scm",
+ original: { line: 128, column: 0 },
+ generated: { line: 3, column: 456 }
+})
+```
+
+#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)
+
+Set the source content for an original source file.
+
+* `sourceFile` the URL of the original source file.
+
+* `sourceContent` the content of the source file.
+
+```js
+generator.setSourceContent("module-one.scm",
+ fs.readFileSync("path/to/module-one.scm"))
+```
+
+#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])
+
+Applies a SourceMap for a source file to the SourceMap.
+Each mapping to the supplied source file is rewritten using the
+supplied SourceMap. Note: The resolution for the resulting mappings
+is the minimum of this map and the supplied map.
+
+* `sourceMapConsumer`: The SourceMap to be applied.
+
+* `sourceFile`: Optional. The filename of the source file.
+ If omitted, sourceMapConsumer.file will be used, if it exists.
+ Otherwise an error will be thrown.
+
+* `sourceMapPath`: Optional. The dirname of the path to the SourceMap
+ to be applied. If relative, it is relative to the SourceMap.
+
+ This parameter is needed when the two SourceMaps aren't in the same
+ directory, and the SourceMap to be applied contains relative source
+ paths. If so, those relative source paths need to be rewritten
+ relative to the SourceMap.
+
+ If omitted, it is assumed that both SourceMaps are in the same directory,
+ thus not needing any rewriting. (Supplying `'.'` has the same effect.)
+
+#### SourceMapGenerator.prototype.toString()
+
+Renders the source map being generated to a string.
+
+```js
+generator.toString()
+// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}'
+```
+
+### SourceNode
+
+SourceNodes provide a way to abstract over interpolating and/or concatenating
+snippets of generated JavaScript source code, while maintaining the line and
+column information associated between those snippets and the original source
+code. This is useful as the final intermediate representation a compiler might
+use before outputting the generated JS and source map.
+
+#### new SourceNode([line, column, source[, chunk[, name]]])
+
+* `line`: The original line number associated with this source node, or null if
+ it isn't associated with an original line. The line number is 1-based.
+
+* `column`: The original column number associated with this source node, or null
+ if it isn't associated with an original column. The column number
+ is 0-based.
+
+* `source`: The original source's filename; null if no filename is provided.
+
+* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see
+ below.
+
+* `name`: Optional. The original identifier.
+
+```js
+var node = new SourceNode(1, 2, "a.cpp", [
+ new SourceNode(3, 4, "b.cpp", "extern int status;\n"),
+ new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"),
+ new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"),
+]);
+```
+
+#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])
+
+Creates a SourceNode from generated code and a SourceMapConsumer.
+
+* `code`: The generated code
+
+* `sourceMapConsumer` The SourceMap for the generated code
+
+* `relativePath` The optional path that relative sources in `sourceMapConsumer`
+ should be relative to.
+
+```js
+var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8"));
+var node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"),
+ consumer);
+```
+
+#### SourceNode.prototype.add(chunk)
+
+Add a chunk of generated JS to this source node.
+
+* `chunk`: A string snippet of generated JS code, another instance of
+ `SourceNode`, or an array where each member is one of those things.
+
+```js
+node.add(" + ");
+node.add(otherNode);
+node.add([leftHandOperandNode, " + ", rightHandOperandNode]);
+```
+
+#### SourceNode.prototype.prepend(chunk)
+
+Prepend a chunk of generated JS to this source node.
+
+* `chunk`: A string snippet of generated JS code, another instance of
+ `SourceNode`, or an array where each member is one of those things.
+
+```js
+node.prepend("/** Build Id: f783haef86324gf **/\n\n");
+```
+
+#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent)
+
+Set the source content for a source file. This will be added to the
+`SourceMap` in the `sourcesContent` field.
+
+* `sourceFile`: The filename of the source file
+
+* `sourceContent`: The content of the source file
+
+```js
+node.setSourceContent("module-one.scm",
+ fs.readFileSync("path/to/module-one.scm"))
+```
+
+#### SourceNode.prototype.walk(fn)
+
+Walk over the tree of JS snippets in this node and its children. The walking
+function is called once for each snippet of JS and is passed that snippet and
+the its original associated source's line/column location.
+
+* `fn`: The traversal function.
+
+```js
+var node = new SourceNode(1, 2, "a.js", [
+ new SourceNode(3, 4, "b.js", "uno"),
+ "dos",
+ [
+ "tres",
+ new SourceNode(5, 6, "c.js", "quatro")
+ ]
+]);
+
+node.walk(function (code, loc) { console.log("WALK:", code, loc); })
+// WALK: uno { source: 'b.js', line: 3, column: 4, name: null }
+// WALK: dos { source: 'a.js', line: 1, column: 2, name: null }
+// WALK: tres { source: 'a.js', line: 1, column: 2, name: null }
+// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null }
+```
+
+#### SourceNode.prototype.walkSourceContents(fn)
+
+Walk over the tree of SourceNodes. The walking function is called for each
+source file content and is passed the filename and source content.
+
+* `fn`: The traversal function.
+
+```js
+var a = new SourceNode(1, 2, "a.js", "generated from a");
+a.setSourceContent("a.js", "original a");
+var b = new SourceNode(1, 2, "b.js", "generated from b");
+b.setSourceContent("b.js", "original b");
+var c = new SourceNode(1, 2, "c.js", "generated from c");
+c.setSourceContent("c.js", "original c");
+
+var node = new SourceNode(null, null, null, [a, b, c]);
+node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); })
+// WALK: a.js : original a
+// WALK: b.js : original b
+// WALK: c.js : original c
+```
+
+#### SourceNode.prototype.join(sep)
+
+Like `Array.prototype.join` except for SourceNodes. Inserts the separator
+between each of this source node's children.
+
+* `sep`: The separator.
+
+```js
+var lhs = new SourceNode(1, 2, "a.rs", "my_copy");
+var operand = new SourceNode(3, 4, "a.rs", "=");
+var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()");
+
+var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]);
+var joinedNode = node.join(" ");
+```
+
+#### SourceNode.prototype.replaceRight(pattern, replacement)
+
+Call `String.prototype.replace` on the very right-most source snippet. Useful
+for trimming white space from the end of a source node, etc.
+
+* `pattern`: The pattern to replace.
+
+* `replacement`: The thing to replace the pattern with.
+
+```js
+// Trim trailing white space.
+node.replaceRight(/\s*$/, "");
+```
+
+#### SourceNode.prototype.toString()
+
+Return the string representation of this source node. Walks over the tree and
+concatenates all the various snippets together to one string.
+
+```js
+var node = new SourceNode(1, 2, "a.js", [
+ new SourceNode(3, 4, "b.js", "uno"),
+ "dos",
+ [
+ "tres",
+ new SourceNode(5, 6, "c.js", "quatro")
+ ]
+]);
+
+node.toString()
+// 'unodostresquatro'
+```
+
+#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])
+
+Returns the string representation of this tree of source nodes, plus a
+SourceMapGenerator which contains all the mappings between the generated and
+original sources.
+
+The arguments are the same as those to `new SourceMapGenerator`.
+
+```js
+var node = new SourceNode(1, 2, "a.js", [
+ new SourceNode(3, 4, "b.js", "uno"),
+ "dos",
+ [
+ "tres",
+ new SourceNode(5, 6, "c.js", "quatro")
+ ]
+]);
+
+node.toStringWithSourceMap({ file: "my-output-file.js" })
+// { code: 'unodostresquatro',
+// map: [object SourceMapGenerator] }
+```
diff --git a/node_modules/source-map-js/lib/array-set.js b/node_modules/source-map-js/lib/array-set.js
new file mode 100644
index 0000000000000000000000000000000000000000..fbd5c81cae66fa6401f871ac7fb02e96fdb9c213
--- /dev/null
+++ b/node_modules/source-map-js/lib/array-set.js
@@ -0,0 +1,121 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var util = require('./util');
+var has = Object.prototype.hasOwnProperty;
+var hasNativeMap = typeof Map !== "undefined";
+
+/**
+ * A data structure which is a combination of an array and a set. Adding a new
+ * member is O(1), testing for membership is O(1), and finding the index of an
+ * element is O(1). Removing elements from the set is not supported. Only
+ * strings are supported for membership.
+ */
+function ArraySet() {
+ this._array = [];
+ this._set = hasNativeMap ? new Map() : Object.create(null);
+}
+
+/**
+ * Static method for creating ArraySet instances from an existing array.
+ */
+ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
+ var set = new ArraySet();
+ for (var i = 0, len = aArray.length; i < len; i++) {
+ set.add(aArray[i], aAllowDuplicates);
+ }
+ return set;
+};
+
+/**
+ * Return how many unique items are in this ArraySet. If duplicates have been
+ * added, than those do not count towards the size.
+ *
+ * @returns Number
+ */
+ArraySet.prototype.size = function ArraySet_size() {
+ return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
+};
+
+/**
+ * Add the given string to this set.
+ *
+ * @param String aStr
+ */
+ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
+ var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
+ var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
+ var idx = this._array.length;
+ if (!isDuplicate || aAllowDuplicates) {
+ this._array.push(aStr);
+ }
+ if (!isDuplicate) {
+ if (hasNativeMap) {
+ this._set.set(aStr, idx);
+ } else {
+ this._set[sStr] = idx;
+ }
+ }
+};
+
+/**
+ * Is the given string a member of this set?
+ *
+ * @param String aStr
+ */
+ArraySet.prototype.has = function ArraySet_has(aStr) {
+ if (hasNativeMap) {
+ return this._set.has(aStr);
+ } else {
+ var sStr = util.toSetString(aStr);
+ return has.call(this._set, sStr);
+ }
+};
+
+/**
+ * What is the index of the given string in the array?
+ *
+ * @param String aStr
+ */
+ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
+ if (hasNativeMap) {
+ var idx = this._set.get(aStr);
+ if (idx >= 0) {
+ return idx;
+ }
+ } else {
+ var sStr = util.toSetString(aStr);
+ if (has.call(this._set, sStr)) {
+ return this._set[sStr];
+ }
+ }
+
+ throw new Error('"' + aStr + '" is not in the set.');
+};
+
+/**
+ * What is the element at the given index?
+ *
+ * @param Number aIdx
+ */
+ArraySet.prototype.at = function ArraySet_at(aIdx) {
+ if (aIdx >= 0 && aIdx < this._array.length) {
+ return this._array[aIdx];
+ }
+ throw new Error('No element indexed by ' + aIdx);
+};
+
+/**
+ * Returns the array representation of this set (which has the proper indices
+ * indicated by indexOf). Note that this is a copy of the internal array used
+ * for storing the members so that no one can mess with internal state.
+ */
+ArraySet.prototype.toArray = function ArraySet_toArray() {
+ return this._array.slice();
+};
+
+exports.ArraySet = ArraySet;
diff --git a/node_modules/source-map-js/lib/base64-vlq.js b/node_modules/source-map-js/lib/base64-vlq.js
new file mode 100644
index 0000000000000000000000000000000000000000..612b404018ece911ab71fc0a8db326d16e6b1287
--- /dev/null
+++ b/node_modules/source-map-js/lib/base64-vlq.js
@@ -0,0 +1,140 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ *
+ * Based on the Base 64 VLQ implementation in Closure Compiler:
+ * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
+ *
+ * Copyright 2011 The Closure Compiler Authors. All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * 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 of Google Inc. 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
+ * OWNER 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.
+ */
+
+var base64 = require('./base64');
+
+// A single base 64 digit can contain 6 bits of data. For the base 64 variable
+// length quantities we use in the source map spec, the first bit is the sign,
+// the next four bits are the actual value, and the 6th bit is the
+// continuation bit. The continuation bit tells us whether there are more
+// digits in this value following this digit.
+//
+// Continuation
+// | Sign
+// | |
+// V V
+// 101011
+
+var VLQ_BASE_SHIFT = 5;
+
+// binary: 100000
+var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
+
+// binary: 011111
+var VLQ_BASE_MASK = VLQ_BASE - 1;
+
+// binary: 100000
+var VLQ_CONTINUATION_BIT = VLQ_BASE;
+
+/**
+ * Converts from a two-complement value to a value where the sign bit is
+ * placed in the least significant bit. For example, as decimals:
+ * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
+ * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
+ */
+function toVLQSigned(aValue) {
+ return aValue < 0
+ ? ((-aValue) << 1) + 1
+ : (aValue << 1) + 0;
+}
+
+/**
+ * Converts to a two-complement value from a value where the sign bit is
+ * placed in the least significant bit. For example, as decimals:
+ * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
+ * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
+ */
+function fromVLQSigned(aValue) {
+ var isNegative = (aValue & 1) === 1;
+ var shifted = aValue >> 1;
+ return isNegative
+ ? -shifted
+ : shifted;
+}
+
+/**
+ * Returns the base 64 VLQ encoded value.
+ */
+exports.encode = function base64VLQ_encode(aValue) {
+ var encoded = "";
+ var digit;
+
+ var vlq = toVLQSigned(aValue);
+
+ do {
+ digit = vlq & VLQ_BASE_MASK;
+ vlq >>>= VLQ_BASE_SHIFT;
+ if (vlq > 0) {
+ // There are still more digits in this value, so we must make sure the
+ // continuation bit is marked.
+ digit |= VLQ_CONTINUATION_BIT;
+ }
+ encoded += base64.encode(digit);
+ } while (vlq > 0);
+
+ return encoded;
+};
+
+/**
+ * Decodes the next base 64 VLQ value from the given string and returns the
+ * value and the rest of the string via the out parameter.
+ */
+exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
+ var strLen = aStr.length;
+ var result = 0;
+ var shift = 0;
+ var continuation, digit;
+
+ do {
+ if (aIndex >= strLen) {
+ throw new Error("Expected more digits in base 64 VLQ value.");
+ }
+
+ digit = base64.decode(aStr.charCodeAt(aIndex++));
+ if (digit === -1) {
+ throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
+ }
+
+ continuation = !!(digit & VLQ_CONTINUATION_BIT);
+ digit &= VLQ_BASE_MASK;
+ result = result + (digit << shift);
+ shift += VLQ_BASE_SHIFT;
+ } while (continuation);
+
+ aOutParam.value = fromVLQSigned(result);
+ aOutParam.rest = aIndex;
+};
diff --git a/node_modules/source-map-js/lib/base64.js b/node_modules/source-map-js/lib/base64.js
new file mode 100644
index 0000000000000000000000000000000000000000..8aa86b30264363990334a7df0aa0d0c9cc1aecfc
--- /dev/null
+++ b/node_modules/source-map-js/lib/base64.js
@@ -0,0 +1,67 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
+
+/**
+ * Encode an integer in the range of 0 to 63 to a single base 64 digit.
+ */
+exports.encode = function (number) {
+ if (0 <= number && number < intToCharMap.length) {
+ return intToCharMap[number];
+ }
+ throw new TypeError("Must be between 0 and 63: " + number);
+};
+
+/**
+ * Decode a single base 64 character code digit to an integer. Returns -1 on
+ * failure.
+ */
+exports.decode = function (charCode) {
+ var bigA = 65; // 'A'
+ var bigZ = 90; // 'Z'
+
+ var littleA = 97; // 'a'
+ var littleZ = 122; // 'z'
+
+ var zero = 48; // '0'
+ var nine = 57; // '9'
+
+ var plus = 43; // '+'
+ var slash = 47; // '/'
+
+ var littleOffset = 26;
+ var numberOffset = 52;
+
+ // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ if (bigA <= charCode && charCode <= bigZ) {
+ return (charCode - bigA);
+ }
+
+ // 26 - 51: abcdefghijklmnopqrstuvwxyz
+ if (littleA <= charCode && charCode <= littleZ) {
+ return (charCode - littleA + littleOffset);
+ }
+
+ // 52 - 61: 0123456789
+ if (zero <= charCode && charCode <= nine) {
+ return (charCode - zero + numberOffset);
+ }
+
+ // 62: +
+ if (charCode == plus) {
+ return 62;
+ }
+
+ // 63: /
+ if (charCode == slash) {
+ return 63;
+ }
+
+ // Invalid base64 digit.
+ return -1;
+};
diff --git a/node_modules/source-map-js/lib/binary-search.js b/node_modules/source-map-js/lib/binary-search.js
new file mode 100644
index 0000000000000000000000000000000000000000..010ac941e1568d59c89b67cb649051a14608ee79
--- /dev/null
+++ b/node_modules/source-map-js/lib/binary-search.js
@@ -0,0 +1,111 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+exports.GREATEST_LOWER_BOUND = 1;
+exports.LEAST_UPPER_BOUND = 2;
+
+/**
+ * Recursive implementation of binary search.
+ *
+ * @param aLow Indices here and lower do not contain the needle.
+ * @param aHigh Indices here and higher do not contain the needle.
+ * @param aNeedle The element being searched for.
+ * @param aHaystack The non-empty array being searched.
+ * @param aCompare Function which takes two elements and returns -1, 0, or 1.
+ * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
+ * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
+ * closest element that is smaller than or greater than the one we are
+ * searching for, respectively, if the exact element cannot be found.
+ */
+function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
+ // This function terminates when one of the following is true:
+ //
+ // 1. We find the exact element we are looking for.
+ //
+ // 2. We did not find the exact element, but we can return the index of
+ // the next-closest element.
+ //
+ // 3. We did not find the exact element, and there is no next-closest
+ // element than the one we are searching for, so we return -1.
+ var mid = Math.floor((aHigh - aLow) / 2) + aLow;
+ var cmp = aCompare(aNeedle, aHaystack[mid], true);
+ if (cmp === 0) {
+ // Found the element we are looking for.
+ return mid;
+ }
+ else if (cmp > 0) {
+ // Our needle is greater than aHaystack[mid].
+ if (aHigh - mid > 1) {
+ // The element is in the upper half.
+ return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
+ }
+
+ // The exact needle element was not found in this haystack. Determine if
+ // we are in termination case (3) or (2) and return the appropriate thing.
+ if (aBias == exports.LEAST_UPPER_BOUND) {
+ return aHigh < aHaystack.length ? aHigh : -1;
+ } else {
+ return mid;
+ }
+ }
+ else {
+ // Our needle is less than aHaystack[mid].
+ if (mid - aLow > 1) {
+ // The element is in the lower half.
+ return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
+ }
+
+ // we are in termination case (3) or (2) and return the appropriate thing.
+ if (aBias == exports.LEAST_UPPER_BOUND) {
+ return mid;
+ } else {
+ return aLow < 0 ? -1 : aLow;
+ }
+ }
+}
+
+/**
+ * This is an implementation of binary search which will always try and return
+ * the index of the closest element if there is no exact hit. This is because
+ * mappings between original and generated line/col pairs are single points,
+ * and there is an implicit region between each of them, so a miss just means
+ * that you aren't on the very start of a region.
+ *
+ * @param aNeedle The element you are looking for.
+ * @param aHaystack The array that is being searched.
+ * @param aCompare A function which takes the needle and an element in the
+ * array and returns -1, 0, or 1 depending on whether the needle is less
+ * than, equal to, or greater than the element, respectively.
+ * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
+ * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
+ * closest element that is smaller than or greater than the one we are
+ * searching for, respectively, if the exact element cannot be found.
+ * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
+ */
+exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
+ if (aHaystack.length === 0) {
+ return -1;
+ }
+
+ var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
+ aCompare, aBias || exports.GREATEST_LOWER_BOUND);
+ if (index < 0) {
+ return -1;
+ }
+
+ // We have found either the exact element, or the next-closest element than
+ // the one we are searching for. However, there may be more than one such
+ // element. Make sure we always return the smallest of these.
+ while (index - 1 >= 0) {
+ if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
+ break;
+ }
+ --index;
+ }
+
+ return index;
+};
diff --git a/node_modules/source-map-js/lib/mapping-list.js b/node_modules/source-map-js/lib/mapping-list.js
new file mode 100644
index 0000000000000000000000000000000000000000..06d1274a025a8a30879f31c9c6703a14f79f73b9
--- /dev/null
+++ b/node_modules/source-map-js/lib/mapping-list.js
@@ -0,0 +1,79 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2014 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var util = require('./util');
+
+/**
+ * Determine whether mappingB is after mappingA with respect to generated
+ * position.
+ */
+function generatedPositionAfter(mappingA, mappingB) {
+ // Optimized for most common case
+ var lineA = mappingA.generatedLine;
+ var lineB = mappingB.generatedLine;
+ var columnA = mappingA.generatedColumn;
+ var columnB = mappingB.generatedColumn;
+ return lineB > lineA || lineB == lineA && columnB >= columnA ||
+ util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
+}
+
+/**
+ * A data structure to provide a sorted view of accumulated mappings in a
+ * performance conscious manner. It trades a neglibable overhead in general
+ * case for a large speedup in case of mappings being added in order.
+ */
+function MappingList() {
+ this._array = [];
+ this._sorted = true;
+ // Serves as infimum
+ this._last = {generatedLine: -1, generatedColumn: 0};
+}
+
+/**
+ * Iterate through internal items. This method takes the same arguments that
+ * `Array.prototype.forEach` takes.
+ *
+ * NOTE: The order of the mappings is NOT guaranteed.
+ */
+MappingList.prototype.unsortedForEach =
+ function MappingList_forEach(aCallback, aThisArg) {
+ this._array.forEach(aCallback, aThisArg);
+ };
+
+/**
+ * Add the given source mapping.
+ *
+ * @param Object aMapping
+ */
+MappingList.prototype.add = function MappingList_add(aMapping) {
+ if (generatedPositionAfter(this._last, aMapping)) {
+ this._last = aMapping;
+ this._array.push(aMapping);
+ } else {
+ this._sorted = false;
+ this._array.push(aMapping);
+ }
+};
+
+/**
+ * Returns the flat, sorted array of mappings. The mappings are sorted by
+ * generated position.
+ *
+ * WARNING: This method returns internal data without copying, for
+ * performance. The return value must NOT be mutated, and should be treated as
+ * an immutable borrow. If you want to take ownership, you must make your own
+ * copy.
+ */
+MappingList.prototype.toArray = function MappingList_toArray() {
+ if (!this._sorted) {
+ this._array.sort(util.compareByGeneratedPositionsInflated);
+ this._sorted = true;
+ }
+ return this._array;
+};
+
+exports.MappingList = MappingList;
diff --git a/node_modules/source-map-js/lib/quick-sort.js b/node_modules/source-map-js/lib/quick-sort.js
new file mode 100644
index 0000000000000000000000000000000000000000..23f9eda57f7383b5291361e4593cf2fdef5409ba
--- /dev/null
+++ b/node_modules/source-map-js/lib/quick-sort.js
@@ -0,0 +1,132 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+// It turns out that some (most?) JavaScript engines don't self-host
+// `Array.prototype.sort`. This makes sense because C++ will likely remain
+// faster than JS when doing raw CPU-intensive sorting. However, when using a
+// custom comparator function, calling back and forth between the VM's C++ and
+// JIT'd JS is rather slow *and* loses JIT type information, resulting in
+// worse generated code for the comparator function than would be optimal. In
+// fact, when sorting with a comparator, these costs outweigh the benefits of
+// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
+// a ~3500ms mean speed-up in `bench/bench.html`.
+
+function SortTemplate(comparator) {
+
+/**
+ * Swap the elements indexed by `x` and `y` in the array `ary`.
+ *
+ * @param {Array} ary
+ * The array.
+ * @param {Number} x
+ * The index of the first item.
+ * @param {Number} y
+ * The index of the second item.
+ */
+function swap(ary, x, y) {
+ var temp = ary[x];
+ ary[x] = ary[y];
+ ary[y] = temp;
+}
+
+/**
+ * Returns a random integer within the range `low .. high` inclusive.
+ *
+ * @param {Number} low
+ * The lower bound on the range.
+ * @param {Number} high
+ * The upper bound on the range.
+ */
+function randomIntInRange(low, high) {
+ return Math.round(low + (Math.random() * (high - low)));
+}
+
+/**
+ * The Quick Sort algorithm.
+ *
+ * @param {Array} ary
+ * An array to sort.
+ * @param {function} comparator
+ * Function to use to compare two items.
+ * @param {Number} p
+ * Start index of the array
+ * @param {Number} r
+ * End index of the array
+ */
+function doQuickSort(ary, comparator, p, r) {
+ // If our lower bound is less than our upper bound, we (1) partition the
+ // array into two pieces and (2) recurse on each half. If it is not, this is
+ // the empty array and our base case.
+
+ if (p < r) {
+ // (1) Partitioning.
+ //
+ // The partitioning chooses a pivot between `p` and `r` and moves all
+ // elements that are less than or equal to the pivot to the before it, and
+ // all the elements that are greater than it after it. The effect is that
+ // once partition is done, the pivot is in the exact place it will be when
+ // the array is put in sorted order, and it will not need to be moved
+ // again. This runs in O(n) time.
+
+ // Always choose a random pivot so that an input array which is reverse
+ // sorted does not cause O(n^2) running time.
+ var pivotIndex = randomIntInRange(p, r);
+ var i = p - 1;
+
+ swap(ary, pivotIndex, r);
+ var pivot = ary[r];
+
+ // Immediately after `j` is incremented in this loop, the following hold
+ // true:
+ //
+ // * Every element in `ary[p .. i]` is less than or equal to the pivot.
+ //
+ // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
+ for (var j = p; j < r; j++) {
+ if (comparator(ary[j], pivot, false) <= 0) {
+ i += 1;
+ swap(ary, i, j);
+ }
+ }
+
+ swap(ary, i + 1, j);
+ var q = i + 1;
+
+ // (2) Recurse on each half.
+
+ doQuickSort(ary, comparator, p, q - 1);
+ doQuickSort(ary, comparator, q + 1, r);
+ }
+}
+
+ return doQuickSort;
+}
+
+function cloneSort(comparator) {
+ let template = SortTemplate.toString();
+ let templateFn = new Function(`return ${template}`)();
+ return templateFn(comparator);
+}
+
+/**
+ * Sort the given array in-place with the given comparator function.
+ *
+ * @param {Array} ary
+ * An array to sort.
+ * @param {function} comparator
+ * Function to use to compare two items.
+ */
+
+let sortCache = new WeakMap();
+exports.quickSort = function (ary, comparator, start = 0) {
+ let doQuickSort = sortCache.get(comparator);
+ if (doQuickSort === void 0) {
+ doQuickSort = cloneSort(comparator);
+ sortCache.set(comparator, doQuickSort);
+ }
+ doQuickSort(ary, comparator, start, ary.length - 1);
+};
diff --git a/node_modules/source-map-js/lib/source-map-consumer.d.ts b/node_modules/source-map-js/lib/source-map-consumer.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..744bda73d103b79b7e654972b9a42c3c95ff432a
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-map-consumer.d.ts
@@ -0,0 +1 @@
+export { SourceMapConsumer } from '..';
diff --git a/node_modules/source-map-js/lib/source-map-consumer.js b/node_modules/source-map-js/lib/source-map-consumer.js
new file mode 100644
index 0000000000000000000000000000000000000000..ee66114636c1e3f1b455457ad9e91b0eeeb2d360
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-map-consumer.js
@@ -0,0 +1,1188 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var util = require('./util');
+var binarySearch = require('./binary-search');
+var ArraySet = require('./array-set').ArraySet;
+var base64VLQ = require('./base64-vlq');
+var quickSort = require('./quick-sort').quickSort;
+
+function SourceMapConsumer(aSourceMap, aSourceMapURL) {
+ var sourceMap = aSourceMap;
+ if (typeof aSourceMap === 'string') {
+ sourceMap = util.parseSourceMapInput(aSourceMap);
+ }
+
+ return sourceMap.sections != null
+ ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
+ : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
+}
+
+SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
+ return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
+}
+
+/**
+ * The version of the source mapping spec that we are consuming.
+ */
+SourceMapConsumer.prototype._version = 3;
+
+// `__generatedMappings` and `__originalMappings` are arrays that hold the
+// parsed mapping coordinates from the source map's "mappings" attribute. They
+// are lazily instantiated, accessed via the `_generatedMappings` and
+// `_originalMappings` getters respectively, and we only parse the mappings
+// and create these arrays once queried for a source location. We jump through
+// these hoops because there can be many thousands of mappings, and parsing
+// them is expensive, so we only want to do it if we must.
+//
+// Each object in the arrays is of the form:
+//
+// {
+// generatedLine: The line number in the generated code,
+// generatedColumn: The column number in the generated code,
+// source: The path to the original source file that generated this
+// chunk of code,
+// originalLine: The line number in the original source that
+// corresponds to this chunk of generated code,
+// originalColumn: The column number in the original source that
+// corresponds to this chunk of generated code,
+// name: The name of the original symbol which generated this chunk of
+// code.
+// }
+//
+// All properties except for `generatedLine` and `generatedColumn` can be
+// `null`.
+//
+// `_generatedMappings` is ordered by the generated positions.
+//
+// `_originalMappings` is ordered by the original positions.
+
+SourceMapConsumer.prototype.__generatedMappings = null;
+Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
+ configurable: true,
+ enumerable: true,
+ get: function () {
+ if (!this.__generatedMappings) {
+ this._parseMappings(this._mappings, this.sourceRoot);
+ }
+
+ return this.__generatedMappings;
+ }
+});
+
+SourceMapConsumer.prototype.__originalMappings = null;
+Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
+ configurable: true,
+ enumerable: true,
+ get: function () {
+ if (!this.__originalMappings) {
+ this._parseMappings(this._mappings, this.sourceRoot);
+ }
+
+ return this.__originalMappings;
+ }
+});
+
+SourceMapConsumer.prototype._charIsMappingSeparator =
+ function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
+ var c = aStr.charAt(index);
+ return c === ";" || c === ",";
+ };
+
+/**
+ * Parse the mappings in a string in to a data structure which we can easily
+ * query (the ordered arrays in the `this.__generatedMappings` and
+ * `this.__originalMappings` properties).
+ */
+SourceMapConsumer.prototype._parseMappings =
+ function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
+ throw new Error("Subclasses must implement _parseMappings");
+ };
+
+SourceMapConsumer.GENERATED_ORDER = 1;
+SourceMapConsumer.ORIGINAL_ORDER = 2;
+
+SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
+SourceMapConsumer.LEAST_UPPER_BOUND = 2;
+
+/**
+ * Iterate over each mapping between an original source/line/column and a
+ * generated line/column in this source map.
+ *
+ * @param Function aCallback
+ * The function that is called with each mapping.
+ * @param Object aContext
+ * Optional. If specified, this object will be the value of `this` every
+ * time that `aCallback` is called.
+ * @param aOrder
+ * Either `SourceMapConsumer.GENERATED_ORDER` or
+ * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
+ * iterate over the mappings sorted by the generated file's line/column
+ * order or the original's source/line/column order, respectively. Defaults to
+ * `SourceMapConsumer.GENERATED_ORDER`.
+ */
+SourceMapConsumer.prototype.eachMapping =
+ function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
+ var context = aContext || null;
+ var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
+
+ var mappings;
+ switch (order) {
+ case SourceMapConsumer.GENERATED_ORDER:
+ mappings = this._generatedMappings;
+ break;
+ case SourceMapConsumer.ORIGINAL_ORDER:
+ mappings = this._originalMappings;
+ break;
+ default:
+ throw new Error("Unknown order of iteration.");
+ }
+
+ var sourceRoot = this.sourceRoot;
+ var boundCallback = aCallback.bind(context);
+ var names = this._names;
+ var sources = this._sources;
+ var sourceMapURL = this._sourceMapURL;
+
+ for (var i = 0, n = mappings.length; i < n; i++) {
+ var mapping = mappings[i];
+ var source = mapping.source === null ? null : sources.at(mapping.source);
+ if(source !== null) {
+ source = util.computeSourceURL(sourceRoot, source, sourceMapURL);
+ }
+ boundCallback({
+ source: source,
+ generatedLine: mapping.generatedLine,
+ generatedColumn: mapping.generatedColumn,
+ originalLine: mapping.originalLine,
+ originalColumn: mapping.originalColumn,
+ name: mapping.name === null ? null : names.at(mapping.name)
+ });
+ }
+ };
+
+/**
+ * Returns all generated line and column information for the original source,
+ * line, and column provided. If no column is provided, returns all mappings
+ * corresponding to a either the line we are searching for or the next
+ * closest line that has any mappings. Otherwise, returns all mappings
+ * corresponding to the given line and either the column we are searching for
+ * or the next closest column that has any offsets.
+ *
+ * The only argument is an object with the following properties:
+ *
+ * - source: The filename of the original source.
+ * - line: The line number in the original source. The line number is 1-based.
+ * - column: Optional. the column number in the original source.
+ * The column number is 0-based.
+ *
+ * and an array of objects is returned, each with the following properties:
+ *
+ * - line: The line number in the generated source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the generated source, or null.
+ * The column number is 0-based.
+ */
+SourceMapConsumer.prototype.allGeneratedPositionsFor =
+ function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
+ var line = util.getArg(aArgs, 'line');
+
+ // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
+ // returns the index of the closest mapping less than the needle. By
+ // setting needle.originalColumn to 0, we thus find the last mapping for
+ // the given line, provided such a mapping exists.
+ var needle = {
+ source: util.getArg(aArgs, 'source'),
+ originalLine: line,
+ originalColumn: util.getArg(aArgs, 'column', 0)
+ };
+
+ needle.source = this._findSourceIndex(needle.source);
+ if (needle.source < 0) {
+ return [];
+ }
+
+ var mappings = [];
+
+ var index = this._findMapping(needle,
+ this._originalMappings,
+ "originalLine",
+ "originalColumn",
+ util.compareByOriginalPositions,
+ binarySearch.LEAST_UPPER_BOUND);
+ if (index >= 0) {
+ var mapping = this._originalMappings[index];
+
+ if (aArgs.column === undefined) {
+ var originalLine = mapping.originalLine;
+
+ // Iterate until either we run out of mappings, or we run into
+ // a mapping for a different line than the one we found. Since
+ // mappings are sorted, this is guaranteed to find all mappings for
+ // the line we found.
+ while (mapping && mapping.originalLine === originalLine) {
+ mappings.push({
+ line: util.getArg(mapping, 'generatedLine', null),
+ column: util.getArg(mapping, 'generatedColumn', null),
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
+ });
+
+ mapping = this._originalMappings[++index];
+ }
+ } else {
+ var originalColumn = mapping.originalColumn;
+
+ // Iterate until either we run out of mappings, or we run into
+ // a mapping for a different line than the one we were searching for.
+ // Since mappings are sorted, this is guaranteed to find all mappings for
+ // the line we are searching for.
+ while (mapping &&
+ mapping.originalLine === line &&
+ mapping.originalColumn == originalColumn) {
+ mappings.push({
+ line: util.getArg(mapping, 'generatedLine', null),
+ column: util.getArg(mapping, 'generatedColumn', null),
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
+ });
+
+ mapping = this._originalMappings[++index];
+ }
+ }
+ }
+
+ return mappings;
+ };
+
+exports.SourceMapConsumer = SourceMapConsumer;
+
+/**
+ * A BasicSourceMapConsumer instance represents a parsed source map which we can
+ * query for information about the original file positions by giving it a file
+ * position in the generated source.
+ *
+ * The first parameter is the raw source map (either as a JSON string, or
+ * already parsed to an object). According to the spec, source maps have the
+ * following attributes:
+ *
+ * - version: Which version of the source map spec this map is following.
+ * - sources: An array of URLs to the original source files.
+ * - names: An array of identifiers which can be referrenced by individual mappings.
+ * - sourceRoot: Optional. The URL root from which all sources are relative.
+ * - sourcesContent: Optional. An array of contents of the original source files.
+ * - mappings: A string of base64 VLQs which contain the actual mappings.
+ * - file: Optional. The generated file this source map is associated with.
+ *
+ * Here is an example source map, taken from the source map spec[0]:
+ *
+ * {
+ * version : 3,
+ * file: "out.js",
+ * sourceRoot : "",
+ * sources: ["foo.js", "bar.js"],
+ * names: ["src", "maps", "are", "fun"],
+ * mappings: "AA,AB;;ABCDE;"
+ * }
+ *
+ * The second parameter, if given, is a string whose value is the URL
+ * at which the source map was found. This URL is used to compute the
+ * sources array.
+ *
+ * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
+ */
+function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
+ var sourceMap = aSourceMap;
+ if (typeof aSourceMap === 'string') {
+ sourceMap = util.parseSourceMapInput(aSourceMap);
+ }
+
+ var version = util.getArg(sourceMap, 'version');
+ var sources = util.getArg(sourceMap, 'sources');
+ // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
+ // requires the array) to play nice here.
+ var names = util.getArg(sourceMap, 'names', []);
+ var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
+ var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
+ var mappings = util.getArg(sourceMap, 'mappings');
+ var file = util.getArg(sourceMap, 'file', null);
+
+ // Once again, Sass deviates from the spec and supplies the version as a
+ // string rather than a number, so we use loose equality checking here.
+ if (version != this._version) {
+ throw new Error('Unsupported version: ' + version);
+ }
+
+ if (sourceRoot) {
+ sourceRoot = util.normalize(sourceRoot);
+ }
+
+ sources = sources
+ .map(String)
+ // Some source maps produce relative source paths like "./foo.js" instead of
+ // "foo.js". Normalize these first so that future comparisons will succeed.
+ // See bugzil.la/1090768.
+ .map(util.normalize)
+ // Always ensure that absolute sources are internally stored relative to
+ // the source root, if the source root is absolute. Not doing this would
+ // be particularly problematic when the source root is a prefix of the
+ // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
+ .map(function (source) {
+ return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
+ ? util.relative(sourceRoot, source)
+ : source;
+ });
+
+ // Pass `true` below to allow duplicate names and sources. While source maps
+ // are intended to be compressed and deduplicated, the TypeScript compiler
+ // sometimes generates source maps with duplicates in them. See Github issue
+ // #72 and bugzil.la/889492.
+ this._names = ArraySet.fromArray(names.map(String), true);
+ this._sources = ArraySet.fromArray(sources, true);
+
+ this._absoluteSources = this._sources.toArray().map(function (s) {
+ return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
+ });
+
+ this.sourceRoot = sourceRoot;
+ this.sourcesContent = sourcesContent;
+ this._mappings = mappings;
+ this._sourceMapURL = aSourceMapURL;
+ this.file = file;
+}
+
+BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
+BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
+
+/**
+ * Utility function to find the index of a source. Returns -1 if not
+ * found.
+ */
+BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
+ var relativeSource = aSource;
+ if (this.sourceRoot != null) {
+ relativeSource = util.relative(this.sourceRoot, relativeSource);
+ }
+
+ if (this._sources.has(relativeSource)) {
+ return this._sources.indexOf(relativeSource);
+ }
+
+ // Maybe aSource is an absolute URL as returned by |sources|. In
+ // this case we can't simply undo the transform.
+ var i;
+ for (i = 0; i < this._absoluteSources.length; ++i) {
+ if (this._absoluteSources[i] == aSource) {
+ return i;
+ }
+ }
+
+ return -1;
+};
+
+/**
+ * Create a BasicSourceMapConsumer from a SourceMapGenerator.
+ *
+ * @param SourceMapGenerator aSourceMap
+ * The source map that will be consumed.
+ * @param String aSourceMapURL
+ * The URL at which the source map can be found (optional)
+ * @returns BasicSourceMapConsumer
+ */
+BasicSourceMapConsumer.fromSourceMap =
+ function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
+ var smc = Object.create(BasicSourceMapConsumer.prototype);
+
+ var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
+ var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
+ smc.sourceRoot = aSourceMap._sourceRoot;
+ smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
+ smc.sourceRoot);
+ smc.file = aSourceMap._file;
+ smc._sourceMapURL = aSourceMapURL;
+ smc._absoluteSources = smc._sources.toArray().map(function (s) {
+ return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
+ });
+
+ // Because we are modifying the entries (by converting string sources and
+ // names to indices into the sources and names ArraySets), we have to make
+ // a copy of the entry or else bad things happen. Shared mutable state
+ // strikes again! See github issue #191.
+
+ var generatedMappings = aSourceMap._mappings.toArray().slice();
+ var destGeneratedMappings = smc.__generatedMappings = [];
+ var destOriginalMappings = smc.__originalMappings = [];
+
+ for (var i = 0, length = generatedMappings.length; i < length; i++) {
+ var srcMapping = generatedMappings[i];
+ var destMapping = new Mapping;
+ destMapping.generatedLine = srcMapping.generatedLine;
+ destMapping.generatedColumn = srcMapping.generatedColumn;
+
+ if (srcMapping.source) {
+ destMapping.source = sources.indexOf(srcMapping.source);
+ destMapping.originalLine = srcMapping.originalLine;
+ destMapping.originalColumn = srcMapping.originalColumn;
+
+ if (srcMapping.name) {
+ destMapping.name = names.indexOf(srcMapping.name);
+ }
+
+ destOriginalMappings.push(destMapping);
+ }
+
+ destGeneratedMappings.push(destMapping);
+ }
+
+ quickSort(smc.__originalMappings, util.compareByOriginalPositions);
+
+ return smc;
+ };
+
+/**
+ * The version of the source mapping spec that we are consuming.
+ */
+BasicSourceMapConsumer.prototype._version = 3;
+
+/**
+ * The list of original sources.
+ */
+Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
+ get: function () {
+ return this._absoluteSources.slice();
+ }
+});
+
+/**
+ * Provide the JIT with a nice shape / hidden class.
+ */
+function Mapping() {
+ this.generatedLine = 0;
+ this.generatedColumn = 0;
+ this.source = null;
+ this.originalLine = null;
+ this.originalColumn = null;
+ this.name = null;
+}
+
+/**
+ * Parse the mappings in a string in to a data structure which we can easily
+ * query (the ordered arrays in the `this.__generatedMappings` and
+ * `this.__originalMappings` properties).
+ */
+
+const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine;
+function sortGenerated(array, start) {
+ let l = array.length;
+ let n = array.length - start;
+ if (n <= 1) {
+ return;
+ } else if (n == 2) {
+ let a = array[start];
+ let b = array[start + 1];
+ if (compareGenerated(a, b) > 0) {
+ array[start] = b;
+ array[start + 1] = a;
+ }
+ } else if (n < 20) {
+ for (let i = start; i < l; i++) {
+ for (let j = i; j > start; j--) {
+ let a = array[j - 1];
+ let b = array[j];
+ if (compareGenerated(a, b) <= 0) {
+ break;
+ }
+ array[j - 1] = b;
+ array[j] = a;
+ }
+ }
+ } else {
+ quickSort(array, compareGenerated, start);
+ }
+}
+BasicSourceMapConsumer.prototype._parseMappings =
+ function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
+ var generatedLine = 1;
+ var previousGeneratedColumn = 0;
+ var previousOriginalLine = 0;
+ var previousOriginalColumn = 0;
+ var previousSource = 0;
+ var previousName = 0;
+ var length = aStr.length;
+ var index = 0;
+ var cachedSegments = {};
+ var temp = {};
+ var originalMappings = [];
+ var generatedMappings = [];
+ var mapping, str, segment, end, value;
+
+ let subarrayStart = 0;
+ while (index < length) {
+ if (aStr.charAt(index) === ';') {
+ generatedLine++;
+ index++;
+ previousGeneratedColumn = 0;
+
+ sortGenerated(generatedMappings, subarrayStart);
+ subarrayStart = generatedMappings.length;
+ }
+ else if (aStr.charAt(index) === ',') {
+ index++;
+ }
+ else {
+ mapping = new Mapping();
+ mapping.generatedLine = generatedLine;
+
+ for (end = index; end < length; end++) {
+ if (this._charIsMappingSeparator(aStr, end)) {
+ break;
+ }
+ }
+ str = aStr.slice(index, end);
+
+ segment = [];
+ while (index < end) {
+ base64VLQ.decode(aStr, index, temp);
+ value = temp.value;
+ index = temp.rest;
+ segment.push(value);
+ }
+
+ if (segment.length === 2) {
+ throw new Error('Found a source, but no line and column');
+ }
+
+ if (segment.length === 3) {
+ throw new Error('Found a source and line, but no column');
+ }
+
+ // Generated column.
+ mapping.generatedColumn = previousGeneratedColumn + segment[0];
+ previousGeneratedColumn = mapping.generatedColumn;
+
+ if (segment.length > 1) {
+ // Original source.
+ mapping.source = previousSource + segment[1];
+ previousSource += segment[1];
+
+ // Original line.
+ mapping.originalLine = previousOriginalLine + segment[2];
+ previousOriginalLine = mapping.originalLine;
+ // Lines are stored 0-based
+ mapping.originalLine += 1;
+
+ // Original column.
+ mapping.originalColumn = previousOriginalColumn + segment[3];
+ previousOriginalColumn = mapping.originalColumn;
+
+ if (segment.length > 4) {
+ // Original name.
+ mapping.name = previousName + segment[4];
+ previousName += segment[4];
+ }
+ }
+
+ generatedMappings.push(mapping);
+ if (typeof mapping.originalLine === 'number') {
+ let currentSource = mapping.source;
+ while (originalMappings.length <= currentSource) {
+ originalMappings.push(null);
+ }
+ if (originalMappings[currentSource] === null) {
+ originalMappings[currentSource] = [];
+ }
+ originalMappings[currentSource].push(mapping);
+ }
+ }
+ }
+
+ sortGenerated(generatedMappings, subarrayStart);
+ this.__generatedMappings = generatedMappings;
+
+ for (var i = 0; i < originalMappings.length; i++) {
+ if (originalMappings[i] != null) {
+ quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource);
+ }
+ }
+ this.__originalMappings = [].concat(...originalMappings);
+ };
+
+/**
+ * Find the mapping that best matches the hypothetical "needle" mapping that
+ * we are searching for in the given "haystack" of mappings.
+ */
+BasicSourceMapConsumer.prototype._findMapping =
+ function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
+ aColumnName, aComparator, aBias) {
+ // To return the position we are searching for, we must first find the
+ // mapping for the given position and then return the opposite position it
+ // points to. Because the mappings are sorted, we can use binary search to
+ // find the best mapping.
+
+ if (aNeedle[aLineName] <= 0) {
+ throw new TypeError('Line must be greater than or equal to 1, got '
+ + aNeedle[aLineName]);
+ }
+ if (aNeedle[aColumnName] < 0) {
+ throw new TypeError('Column must be greater than or equal to 0, got '
+ + aNeedle[aColumnName]);
+ }
+
+ return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
+ };
+
+/**
+ * Compute the last column for each generated mapping. The last column is
+ * inclusive.
+ */
+BasicSourceMapConsumer.prototype.computeColumnSpans =
+ function SourceMapConsumer_computeColumnSpans() {
+ for (var index = 0; index < this._generatedMappings.length; ++index) {
+ var mapping = this._generatedMappings[index];
+
+ // Mappings do not contain a field for the last generated columnt. We
+ // can come up with an optimistic estimate, however, by assuming that
+ // mappings are contiguous (i.e. given two consecutive mappings, the
+ // first mapping ends where the second one starts).
+ if (index + 1 < this._generatedMappings.length) {
+ var nextMapping = this._generatedMappings[index + 1];
+
+ if (mapping.generatedLine === nextMapping.generatedLine) {
+ mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
+ continue;
+ }
+ }
+
+ // The last mapping for each line spans the entire line.
+ mapping.lastGeneratedColumn = Infinity;
+ }
+ };
+
+/**
+ * Returns the original source, line, and column information for the generated
+ * source's line and column positions provided. The only argument is an object
+ * with the following properties:
+ *
+ * - line: The line number in the generated source. The line number
+ * is 1-based.
+ * - column: The column number in the generated source. The column
+ * number is 0-based.
+ * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
+ * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
+ * closest element that is smaller than or greater than the one we are
+ * searching for, respectively, if the exact element cannot be found.
+ * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
+ *
+ * and an object is returned with the following properties:
+ *
+ * - source: The original source file, or null.
+ * - line: The line number in the original source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the original source, or null. The
+ * column number is 0-based.
+ * - name: The original identifier, or null.
+ */
+BasicSourceMapConsumer.prototype.originalPositionFor =
+ function SourceMapConsumer_originalPositionFor(aArgs) {
+ var needle = {
+ generatedLine: util.getArg(aArgs, 'line'),
+ generatedColumn: util.getArg(aArgs, 'column')
+ };
+
+ var index = this._findMapping(
+ needle,
+ this._generatedMappings,
+ "generatedLine",
+ "generatedColumn",
+ util.compareByGeneratedPositionsDeflated,
+ util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
+ );
+
+ if (index >= 0) {
+ var mapping = this._generatedMappings[index];
+
+ if (mapping.generatedLine === needle.generatedLine) {
+ var source = util.getArg(mapping, 'source', null);
+ if (source !== null) {
+ source = this._sources.at(source);
+ source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
+ }
+ var name = util.getArg(mapping, 'name', null);
+ if (name !== null) {
+ name = this._names.at(name);
+ }
+ return {
+ source: source,
+ line: util.getArg(mapping, 'originalLine', null),
+ column: util.getArg(mapping, 'originalColumn', null),
+ name: name
+ };
+ }
+ }
+
+ return {
+ source: null,
+ line: null,
+ column: null,
+ name: null
+ };
+ };
+
+/**
+ * Return true if we have the source content for every source in the source
+ * map, false otherwise.
+ */
+BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
+ function BasicSourceMapConsumer_hasContentsOfAllSources() {
+ if (!this.sourcesContent) {
+ return false;
+ }
+ return this.sourcesContent.length >= this._sources.size() &&
+ !this.sourcesContent.some(function (sc) { return sc == null; });
+ };
+
+/**
+ * Returns the original source content. The only argument is the url of the
+ * original source file. Returns null if no original source content is
+ * available.
+ */
+BasicSourceMapConsumer.prototype.sourceContentFor =
+ function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
+ if (!this.sourcesContent) {
+ return null;
+ }
+
+ var index = this._findSourceIndex(aSource);
+ if (index >= 0) {
+ return this.sourcesContent[index];
+ }
+
+ var relativeSource = aSource;
+ if (this.sourceRoot != null) {
+ relativeSource = util.relative(this.sourceRoot, relativeSource);
+ }
+
+ var url;
+ if (this.sourceRoot != null
+ && (url = util.urlParse(this.sourceRoot))) {
+ // XXX: file:// URIs and absolute paths lead to unexpected behavior for
+ // many users. We can help them out when they expect file:// URIs to
+ // behave like it would if they were running a local HTTP server. See
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
+ var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
+ if (url.scheme == "file"
+ && this._sources.has(fileUriAbsPath)) {
+ return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
+ }
+
+ if ((!url.path || url.path == "/")
+ && this._sources.has("/" + relativeSource)) {
+ return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
+ }
+ }
+
+ // This function is used recursively from
+ // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
+ // don't want to throw if we can't find the source - we just want to
+ // return null, so we provide a flag to exit gracefully.
+ if (nullOnMissing) {
+ return null;
+ }
+ else {
+ throw new Error('"' + relativeSource + '" is not in the SourceMap.');
+ }
+ };
+
+/**
+ * Returns the generated line and column information for the original source,
+ * line, and column positions provided. The only argument is an object with
+ * the following properties:
+ *
+ * - source: The filename of the original source.
+ * - line: The line number in the original source. The line number
+ * is 1-based.
+ * - column: The column number in the original source. The column
+ * number is 0-based.
+ * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
+ * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
+ * closest element that is smaller than or greater than the one we are
+ * searching for, respectively, if the exact element cannot be found.
+ * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
+ *
+ * and an object is returned with the following properties:
+ *
+ * - line: The line number in the generated source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the generated source, or null.
+ * The column number is 0-based.
+ */
+BasicSourceMapConsumer.prototype.generatedPositionFor =
+ function SourceMapConsumer_generatedPositionFor(aArgs) {
+ var source = util.getArg(aArgs, 'source');
+ source = this._findSourceIndex(source);
+ if (source < 0) {
+ return {
+ line: null,
+ column: null,
+ lastColumn: null
+ };
+ }
+
+ var needle = {
+ source: source,
+ originalLine: util.getArg(aArgs, 'line'),
+ originalColumn: util.getArg(aArgs, 'column')
+ };
+
+ var index = this._findMapping(
+ needle,
+ this._originalMappings,
+ "originalLine",
+ "originalColumn",
+ util.compareByOriginalPositions,
+ util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
+ );
+
+ if (index >= 0) {
+ var mapping = this._originalMappings[index];
+
+ if (mapping.source === needle.source) {
+ return {
+ line: util.getArg(mapping, 'generatedLine', null),
+ column: util.getArg(mapping, 'generatedColumn', null),
+ lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
+ };
+ }
+ }
+
+ return {
+ line: null,
+ column: null,
+ lastColumn: null
+ };
+ };
+
+exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
+
+/**
+ * An IndexedSourceMapConsumer instance represents a parsed source map which
+ * we can query for information. It differs from BasicSourceMapConsumer in
+ * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
+ * input.
+ *
+ * The first parameter is a raw source map (either as a JSON string, or already
+ * parsed to an object). According to the spec for indexed source maps, they
+ * have the following attributes:
+ *
+ * - version: Which version of the source map spec this map is following.
+ * - file: Optional. The generated file this source map is associated with.
+ * - sections: A list of section definitions.
+ *
+ * Each value under the "sections" field has two fields:
+ * - offset: The offset into the original specified at which this section
+ * begins to apply, defined as an object with a "line" and "column"
+ * field.
+ * - map: A source map definition. This source map could also be indexed,
+ * but doesn't have to be.
+ *
+ * Instead of the "map" field, it's also possible to have a "url" field
+ * specifying a URL to retrieve a source map from, but that's currently
+ * unsupported.
+ *
+ * Here's an example source map, taken from the source map spec[0], but
+ * modified to omit a section which uses the "url" field.
+ *
+ * {
+ * version : 3,
+ * file: "app.js",
+ * sections: [{
+ * offset: {line:100, column:10},
+ * map: {
+ * version : 3,
+ * file: "section.js",
+ * sources: ["foo.js", "bar.js"],
+ * names: ["src", "maps", "are", "fun"],
+ * mappings: "AAAA,E;;ABCDE;"
+ * }
+ * }],
+ * }
+ *
+ * The second parameter, if given, is a string whose value is the URL
+ * at which the source map was found. This URL is used to compute the
+ * sources array.
+ *
+ * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
+ */
+function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
+ var sourceMap = aSourceMap;
+ if (typeof aSourceMap === 'string') {
+ sourceMap = util.parseSourceMapInput(aSourceMap);
+ }
+
+ var version = util.getArg(sourceMap, 'version');
+ var sections = util.getArg(sourceMap, 'sections');
+
+ if (version != this._version) {
+ throw new Error('Unsupported version: ' + version);
+ }
+
+ this._sources = new ArraySet();
+ this._names = new ArraySet();
+
+ var lastOffset = {
+ line: -1,
+ column: 0
+ };
+ this._sections = sections.map(function (s) {
+ if (s.url) {
+ // The url field will require support for asynchronicity.
+ // See https://github.com/mozilla/source-map/issues/16
+ throw new Error('Support for url field in sections not implemented.');
+ }
+ var offset = util.getArg(s, 'offset');
+ var offsetLine = util.getArg(offset, 'line');
+ var offsetColumn = util.getArg(offset, 'column');
+
+ if (offsetLine < lastOffset.line ||
+ (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
+ throw new Error('Section offsets must be ordered and non-overlapping.');
+ }
+ lastOffset = offset;
+
+ return {
+ generatedOffset: {
+ // The offset fields are 0-based, but we use 1-based indices when
+ // encoding/decoding from VLQ.
+ generatedLine: offsetLine + 1,
+ generatedColumn: offsetColumn + 1
+ },
+ consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
+ }
+ });
+}
+
+IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
+IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
+
+/**
+ * The version of the source mapping spec that we are consuming.
+ */
+IndexedSourceMapConsumer.prototype._version = 3;
+
+/**
+ * The list of original sources.
+ */
+Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
+ get: function () {
+ var sources = [];
+ for (var i = 0; i < this._sections.length; i++) {
+ for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
+ sources.push(this._sections[i].consumer.sources[j]);
+ }
+ }
+ return sources;
+ }
+});
+
+/**
+ * Returns the original source, line, and column information for the generated
+ * source's line and column positions provided. The only argument is an object
+ * with the following properties:
+ *
+ * - line: The line number in the generated source. The line number
+ * is 1-based.
+ * - column: The column number in the generated source. The column
+ * number is 0-based.
+ *
+ * and an object is returned with the following properties:
+ *
+ * - source: The original source file, or null.
+ * - line: The line number in the original source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the original source, or null. The
+ * column number is 0-based.
+ * - name: The original identifier, or null.
+ */
+IndexedSourceMapConsumer.prototype.originalPositionFor =
+ function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
+ var needle = {
+ generatedLine: util.getArg(aArgs, 'line'),
+ generatedColumn: util.getArg(aArgs, 'column')
+ };
+
+ // Find the section containing the generated position we're trying to map
+ // to an original position.
+ var sectionIndex = binarySearch.search(needle, this._sections,
+ function(needle, section) {
+ var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
+ if (cmp) {
+ return cmp;
+ }
+
+ return (needle.generatedColumn -
+ section.generatedOffset.generatedColumn);
+ });
+ var section = this._sections[sectionIndex];
+
+ if (!section) {
+ return {
+ source: null,
+ line: null,
+ column: null,
+ name: null
+ };
+ }
+
+ return section.consumer.originalPositionFor({
+ line: needle.generatedLine -
+ (section.generatedOffset.generatedLine - 1),
+ column: needle.generatedColumn -
+ (section.generatedOffset.generatedLine === needle.generatedLine
+ ? section.generatedOffset.generatedColumn - 1
+ : 0),
+ bias: aArgs.bias
+ });
+ };
+
+/**
+ * Return true if we have the source content for every source in the source
+ * map, false otherwise.
+ */
+IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
+ function IndexedSourceMapConsumer_hasContentsOfAllSources() {
+ return this._sections.every(function (s) {
+ return s.consumer.hasContentsOfAllSources();
+ });
+ };
+
+/**
+ * Returns the original source content. The only argument is the url of the
+ * original source file. Returns null if no original source content is
+ * available.
+ */
+IndexedSourceMapConsumer.prototype.sourceContentFor =
+ function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
+ for (var i = 0; i < this._sections.length; i++) {
+ var section = this._sections[i];
+
+ var content = section.consumer.sourceContentFor(aSource, true);
+ if (content || content === '') {
+ return content;
+ }
+ }
+ if (nullOnMissing) {
+ return null;
+ }
+ else {
+ throw new Error('"' + aSource + '" is not in the SourceMap.');
+ }
+ };
+
+/**
+ * Returns the generated line and column information for the original source,
+ * line, and column positions provided. The only argument is an object with
+ * the following properties:
+ *
+ * - source: The filename of the original source.
+ * - line: The line number in the original source. The line number
+ * is 1-based.
+ * - column: The column number in the original source. The column
+ * number is 0-based.
+ *
+ * and an object is returned with the following properties:
+ *
+ * - line: The line number in the generated source, or null. The
+ * line number is 1-based.
+ * - column: The column number in the generated source, or null.
+ * The column number is 0-based.
+ */
+IndexedSourceMapConsumer.prototype.generatedPositionFor =
+ function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
+ for (var i = 0; i < this._sections.length; i++) {
+ var section = this._sections[i];
+
+ // Only consider this section if the requested source is in the list of
+ // sources of the consumer.
+ if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
+ continue;
+ }
+ var generatedPosition = section.consumer.generatedPositionFor(aArgs);
+ if (generatedPosition) {
+ var ret = {
+ line: generatedPosition.line +
+ (section.generatedOffset.generatedLine - 1),
+ column: generatedPosition.column +
+ (section.generatedOffset.generatedLine === generatedPosition.line
+ ? section.generatedOffset.generatedColumn - 1
+ : 0)
+ };
+ return ret;
+ }
+ }
+
+ return {
+ line: null,
+ column: null
+ };
+ };
+
+/**
+ * Parse the mappings in a string in to a data structure which we can easily
+ * query (the ordered arrays in the `this.__generatedMappings` and
+ * `this.__originalMappings` properties).
+ */
+IndexedSourceMapConsumer.prototype._parseMappings =
+ function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
+ this.__generatedMappings = [];
+ this.__originalMappings = [];
+ for (var i = 0; i < this._sections.length; i++) {
+ var section = this._sections[i];
+ var sectionMappings = section.consumer._generatedMappings;
+ for (var j = 0; j < sectionMappings.length; j++) {
+ var mapping = sectionMappings[j];
+
+ var source = section.consumer._sources.at(mapping.source);
+ if(source !== null) {
+ source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
+ }
+ this._sources.add(source);
+ source = this._sources.indexOf(source);
+
+ var name = null;
+ if (mapping.name) {
+ name = section.consumer._names.at(mapping.name);
+ this._names.add(name);
+ name = this._names.indexOf(name);
+ }
+
+ // The mappings coming from the consumer for the section have
+ // generated positions relative to the start of the section, so we
+ // need to offset them to be relative to the start of the concatenated
+ // generated file.
+ var adjustedMapping = {
+ source: source,
+ generatedLine: mapping.generatedLine +
+ (section.generatedOffset.generatedLine - 1),
+ generatedColumn: mapping.generatedColumn +
+ (section.generatedOffset.generatedLine === mapping.generatedLine
+ ? section.generatedOffset.generatedColumn - 1
+ : 0),
+ originalLine: mapping.originalLine,
+ originalColumn: mapping.originalColumn,
+ name: name
+ };
+
+ this.__generatedMappings.push(adjustedMapping);
+ if (typeof adjustedMapping.originalLine === 'number') {
+ this.__originalMappings.push(adjustedMapping);
+ }
+ }
+ }
+
+ quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
+ quickSort(this.__originalMappings, util.compareByOriginalPositions);
+ };
+
+exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
diff --git a/node_modules/source-map-js/lib/source-map-generator.d.ts b/node_modules/source-map-js/lib/source-map-generator.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..f59d70aa9ca827224617e01d390c9c10b4e81cbc
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-map-generator.d.ts
@@ -0,0 +1 @@
+export { SourceMapGenerator } from '..';
diff --git a/node_modules/source-map-js/lib/source-map-generator.js b/node_modules/source-map-js/lib/source-map-generator.js
new file mode 100644
index 0000000000000000000000000000000000000000..bab04ff85b38eb50f942fb7ba84dd46dfe1f00c6
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-map-generator.js
@@ -0,0 +1,444 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var base64VLQ = require('./base64-vlq');
+var util = require('./util');
+var ArraySet = require('./array-set').ArraySet;
+var MappingList = require('./mapping-list').MappingList;
+
+/**
+ * An instance of the SourceMapGenerator represents a source map which is
+ * being built incrementally. You may pass an object with the following
+ * properties:
+ *
+ * - file: The filename of the generated source.
+ * - sourceRoot: A root for all relative URLs in this source map.
+ */
+function SourceMapGenerator(aArgs) {
+ if (!aArgs) {
+ aArgs = {};
+ }
+ this._file = util.getArg(aArgs, 'file', null);
+ this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
+ this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
+ this._ignoreInvalidMapping = util.getArg(aArgs, 'ignoreInvalidMapping', false);
+ this._sources = new ArraySet();
+ this._names = new ArraySet();
+ this._mappings = new MappingList();
+ this._sourcesContents = null;
+}
+
+SourceMapGenerator.prototype._version = 3;
+
+/**
+ * Creates a new SourceMapGenerator based on a SourceMapConsumer
+ *
+ * @param aSourceMapConsumer The SourceMap.
+ */
+SourceMapGenerator.fromSourceMap =
+ function SourceMapGenerator_fromSourceMap(aSourceMapConsumer, generatorOps) {
+ var sourceRoot = aSourceMapConsumer.sourceRoot;
+ var generator = new SourceMapGenerator(Object.assign(generatorOps || {}, {
+ file: aSourceMapConsumer.file,
+ sourceRoot: sourceRoot
+ }));
+ aSourceMapConsumer.eachMapping(function (mapping) {
+ var newMapping = {
+ generated: {
+ line: mapping.generatedLine,
+ column: mapping.generatedColumn
+ }
+ };
+
+ if (mapping.source != null) {
+ newMapping.source = mapping.source;
+ if (sourceRoot != null) {
+ newMapping.source = util.relative(sourceRoot, newMapping.source);
+ }
+
+ newMapping.original = {
+ line: mapping.originalLine,
+ column: mapping.originalColumn
+ };
+
+ if (mapping.name != null) {
+ newMapping.name = mapping.name;
+ }
+ }
+
+ generator.addMapping(newMapping);
+ });
+ aSourceMapConsumer.sources.forEach(function (sourceFile) {
+ var sourceRelative = sourceFile;
+ if (sourceRoot !== null) {
+ sourceRelative = util.relative(sourceRoot, sourceFile);
+ }
+
+ if (!generator._sources.has(sourceRelative)) {
+ generator._sources.add(sourceRelative);
+ }
+
+ var content = aSourceMapConsumer.sourceContentFor(sourceFile);
+ if (content != null) {
+ generator.setSourceContent(sourceFile, content);
+ }
+ });
+ return generator;
+ };
+
+/**
+ * Add a single mapping from original source line and column to the generated
+ * source's line and column for this source map being created. The mapping
+ * object should have the following properties:
+ *
+ * - generated: An object with the generated line and column positions.
+ * - original: An object with the original line and column positions.
+ * - source: The original source file (relative to the sourceRoot).
+ * - name: An optional original token name for this mapping.
+ */
+SourceMapGenerator.prototype.addMapping =
+ function SourceMapGenerator_addMapping(aArgs) {
+ var generated = util.getArg(aArgs, 'generated');
+ var original = util.getArg(aArgs, 'original', null);
+ var source = util.getArg(aArgs, 'source', null);
+ var name = util.getArg(aArgs, 'name', null);
+
+ if (!this._skipValidation) {
+ if (this._validateMapping(generated, original, source, name) === false) {
+ return;
+ }
+ }
+
+ if (source != null) {
+ source = String(source);
+ if (!this._sources.has(source)) {
+ this._sources.add(source);
+ }
+ }
+
+ if (name != null) {
+ name = String(name);
+ if (!this._names.has(name)) {
+ this._names.add(name);
+ }
+ }
+
+ this._mappings.add({
+ generatedLine: generated.line,
+ generatedColumn: generated.column,
+ originalLine: original != null && original.line,
+ originalColumn: original != null && original.column,
+ source: source,
+ name: name
+ });
+ };
+
+/**
+ * Set the source content for a source file.
+ */
+SourceMapGenerator.prototype.setSourceContent =
+ function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
+ var source = aSourceFile;
+ if (this._sourceRoot != null) {
+ source = util.relative(this._sourceRoot, source);
+ }
+
+ if (aSourceContent != null) {
+ // Add the source content to the _sourcesContents map.
+ // Create a new _sourcesContents map if the property is null.
+ if (!this._sourcesContents) {
+ this._sourcesContents = Object.create(null);
+ }
+ this._sourcesContents[util.toSetString(source)] = aSourceContent;
+ } else if (this._sourcesContents) {
+ // Remove the source file from the _sourcesContents map.
+ // If the _sourcesContents map is empty, set the property to null.
+ delete this._sourcesContents[util.toSetString(source)];
+ if (Object.keys(this._sourcesContents).length === 0) {
+ this._sourcesContents = null;
+ }
+ }
+ };
+
+/**
+ * Applies the mappings of a sub-source-map for a specific source file to the
+ * source map being generated. Each mapping to the supplied source file is
+ * rewritten using the supplied source map. Note: The resolution for the
+ * resulting mappings is the minimium of this map and the supplied map.
+ *
+ * @param aSourceMapConsumer The source map to be applied.
+ * @param aSourceFile Optional. The filename of the source file.
+ * If omitted, SourceMapConsumer's file property will be used.
+ * @param aSourceMapPath Optional. The dirname of the path to the source map
+ * to be applied. If relative, it is relative to the SourceMapConsumer.
+ * This parameter is needed when the two source maps aren't in the same
+ * directory, and the source map to be applied contains relative source
+ * paths. If so, those relative source paths need to be rewritten
+ * relative to the SourceMapGenerator.
+ */
+SourceMapGenerator.prototype.applySourceMap =
+ function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
+ var sourceFile = aSourceFile;
+ // If aSourceFile is omitted, we will use the file property of the SourceMap
+ if (aSourceFile == null) {
+ if (aSourceMapConsumer.file == null) {
+ throw new Error(
+ 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
+ 'or the source map\'s "file" property. Both were omitted.'
+ );
+ }
+ sourceFile = aSourceMapConsumer.file;
+ }
+ var sourceRoot = this._sourceRoot;
+ // Make "sourceFile" relative if an absolute Url is passed.
+ if (sourceRoot != null) {
+ sourceFile = util.relative(sourceRoot, sourceFile);
+ }
+ // Applying the SourceMap can add and remove items from the sources and
+ // the names array.
+ var newSources = new ArraySet();
+ var newNames = new ArraySet();
+
+ // Find mappings for the "sourceFile"
+ this._mappings.unsortedForEach(function (mapping) {
+ if (mapping.source === sourceFile && mapping.originalLine != null) {
+ // Check if it can be mapped by the source map, then update the mapping.
+ var original = aSourceMapConsumer.originalPositionFor({
+ line: mapping.originalLine,
+ column: mapping.originalColumn
+ });
+ if (original.source != null) {
+ // Copy mapping
+ mapping.source = original.source;
+ if (aSourceMapPath != null) {
+ mapping.source = util.join(aSourceMapPath, mapping.source)
+ }
+ if (sourceRoot != null) {
+ mapping.source = util.relative(sourceRoot, mapping.source);
+ }
+ mapping.originalLine = original.line;
+ mapping.originalColumn = original.column;
+ if (original.name != null) {
+ mapping.name = original.name;
+ }
+ }
+ }
+
+ var source = mapping.source;
+ if (source != null && !newSources.has(source)) {
+ newSources.add(source);
+ }
+
+ var name = mapping.name;
+ if (name != null && !newNames.has(name)) {
+ newNames.add(name);
+ }
+
+ }, this);
+ this._sources = newSources;
+ this._names = newNames;
+
+ // Copy sourcesContents of applied map.
+ aSourceMapConsumer.sources.forEach(function (sourceFile) {
+ var content = aSourceMapConsumer.sourceContentFor(sourceFile);
+ if (content != null) {
+ if (aSourceMapPath != null) {
+ sourceFile = util.join(aSourceMapPath, sourceFile);
+ }
+ if (sourceRoot != null) {
+ sourceFile = util.relative(sourceRoot, sourceFile);
+ }
+ this.setSourceContent(sourceFile, content);
+ }
+ }, this);
+ };
+
+/**
+ * A mapping can have one of the three levels of data:
+ *
+ * 1. Just the generated position.
+ * 2. The Generated position, original position, and original source.
+ * 3. Generated and original position, original source, as well as a name
+ * token.
+ *
+ * To maintain consistency, we validate that any new mapping being added falls
+ * in to one of these categories.
+ */
+SourceMapGenerator.prototype._validateMapping =
+ function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
+ aName) {
+ // When aOriginal is truthy but has empty values for .line and .column,
+ // it is most likely a programmer error. In this case we throw a very
+ // specific error message to try to guide them the right way.
+ // For example: https://github.com/Polymer/polymer-bundler/pull/519
+ if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
+ var message = 'original.line and original.column are not numbers -- you probably meant to omit ' +
+ 'the original mapping entirely and only map the generated position. If so, pass ' +
+ 'null for the original mapping instead of an object with empty or null values.'
+
+ if (this._ignoreInvalidMapping) {
+ if (typeof console !== 'undefined' && console.warn) {
+ console.warn(message);
+ }
+ return false;
+ } else {
+ throw new Error(message);
+ }
+ }
+
+ if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
+ && aGenerated.line > 0 && aGenerated.column >= 0
+ && !aOriginal && !aSource && !aName) {
+ // Case 1.
+ return;
+ }
+ else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
+ && aOriginal && 'line' in aOriginal && 'column' in aOriginal
+ && aGenerated.line > 0 && aGenerated.column >= 0
+ && aOriginal.line > 0 && aOriginal.column >= 0
+ && aSource) {
+ // Cases 2 and 3.
+ return;
+ }
+ else {
+ var message = 'Invalid mapping: ' + JSON.stringify({
+ generated: aGenerated,
+ source: aSource,
+ original: aOriginal,
+ name: aName
+ });
+
+ if (this._ignoreInvalidMapping) {
+ if (typeof console !== 'undefined' && console.warn) {
+ console.warn(message);
+ }
+ return false;
+ } else {
+ throw new Error(message)
+ }
+ }
+ };
+
+/**
+ * Serialize the accumulated mappings in to the stream of base 64 VLQs
+ * specified by the source map format.
+ */
+SourceMapGenerator.prototype._serializeMappings =
+ function SourceMapGenerator_serializeMappings() {
+ var previousGeneratedColumn = 0;
+ var previousGeneratedLine = 1;
+ var previousOriginalColumn = 0;
+ var previousOriginalLine = 0;
+ var previousName = 0;
+ var previousSource = 0;
+ var result = '';
+ var next;
+ var mapping;
+ var nameIdx;
+ var sourceIdx;
+
+ var mappings = this._mappings.toArray();
+ for (var i = 0, len = mappings.length; i < len; i++) {
+ mapping = mappings[i];
+ next = ''
+
+ if (mapping.generatedLine !== previousGeneratedLine) {
+ previousGeneratedColumn = 0;
+ while (mapping.generatedLine !== previousGeneratedLine) {
+ next += ';';
+ previousGeneratedLine++;
+ }
+ }
+ else {
+ if (i > 0) {
+ if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
+ continue;
+ }
+ next += ',';
+ }
+ }
+
+ next += base64VLQ.encode(mapping.generatedColumn
+ - previousGeneratedColumn);
+ previousGeneratedColumn = mapping.generatedColumn;
+
+ if (mapping.source != null) {
+ sourceIdx = this._sources.indexOf(mapping.source);
+ next += base64VLQ.encode(sourceIdx - previousSource);
+ previousSource = sourceIdx;
+
+ // lines are stored 0-based in SourceMap spec version 3
+ next += base64VLQ.encode(mapping.originalLine - 1
+ - previousOriginalLine);
+ previousOriginalLine = mapping.originalLine - 1;
+
+ next += base64VLQ.encode(mapping.originalColumn
+ - previousOriginalColumn);
+ previousOriginalColumn = mapping.originalColumn;
+
+ if (mapping.name != null) {
+ nameIdx = this._names.indexOf(mapping.name);
+ next += base64VLQ.encode(nameIdx - previousName);
+ previousName = nameIdx;
+ }
+ }
+
+ result += next;
+ }
+
+ return result;
+ };
+
+SourceMapGenerator.prototype._generateSourcesContent =
+ function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
+ return aSources.map(function (source) {
+ if (!this._sourcesContents) {
+ return null;
+ }
+ if (aSourceRoot != null) {
+ source = util.relative(aSourceRoot, source);
+ }
+ var key = util.toSetString(source);
+ return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
+ ? this._sourcesContents[key]
+ : null;
+ }, this);
+ };
+
+/**
+ * Externalize the source map.
+ */
+SourceMapGenerator.prototype.toJSON =
+ function SourceMapGenerator_toJSON() {
+ var map = {
+ version: this._version,
+ sources: this._sources.toArray(),
+ names: this._names.toArray(),
+ mappings: this._serializeMappings()
+ };
+ if (this._file != null) {
+ map.file = this._file;
+ }
+ if (this._sourceRoot != null) {
+ map.sourceRoot = this._sourceRoot;
+ }
+ if (this._sourcesContents) {
+ map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
+ }
+
+ return map;
+ };
+
+/**
+ * Render the source map being generated to a string.
+ */
+SourceMapGenerator.prototype.toString =
+ function SourceMapGenerator_toString() {
+ return JSON.stringify(this.toJSON());
+ };
+
+exports.SourceMapGenerator = SourceMapGenerator;
diff --git a/node_modules/source-map-js/lib/source-node.d.ts b/node_modules/source-map-js/lib/source-node.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4df6a1aca10c42f674f4403b803ced48e030253f
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-node.d.ts
@@ -0,0 +1 @@
+export { SourceNode } from '..';
diff --git a/node_modules/source-map-js/lib/source-node.js b/node_modules/source-map-js/lib/source-node.js
new file mode 100644
index 0000000000000000000000000000000000000000..8bcdbe385d2c0d333bcd62648ca700f13f9d3181
--- /dev/null
+++ b/node_modules/source-map-js/lib/source-node.js
@@ -0,0 +1,413 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
+var util = require('./util');
+
+// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
+// operating systems these days (capturing the result).
+var REGEX_NEWLINE = /(\r?\n)/;
+
+// Newline character code for charCodeAt() comparisons
+var NEWLINE_CODE = 10;
+
+// Private symbol for identifying `SourceNode`s when multiple versions of
+// the source-map library are loaded. This MUST NOT CHANGE across
+// versions!
+var isSourceNode = "$$$isSourceNode$$$";
+
+/**
+ * SourceNodes provide a way to abstract over interpolating/concatenating
+ * snippets of generated JavaScript source code while maintaining the line and
+ * column information associated with the original source code.
+ *
+ * @param aLine The original line number.
+ * @param aColumn The original column number.
+ * @param aSource The original source's filename.
+ * @param aChunks Optional. An array of strings which are snippets of
+ * generated JS, or other SourceNodes.
+ * @param aName The original identifier.
+ */
+function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
+ this.children = [];
+ this.sourceContents = {};
+ this.line = aLine == null ? null : aLine;
+ this.column = aColumn == null ? null : aColumn;
+ this.source = aSource == null ? null : aSource;
+ this.name = aName == null ? null : aName;
+ this[isSourceNode] = true;
+ if (aChunks != null) this.add(aChunks);
+}
+
+/**
+ * Creates a SourceNode from generated code and a SourceMapConsumer.
+ *
+ * @param aGeneratedCode The generated code
+ * @param aSourceMapConsumer The SourceMap for the generated code
+ * @param aRelativePath Optional. The path that relative sources in the
+ * SourceMapConsumer should be relative to.
+ */
+SourceNode.fromStringWithSourceMap =
+ function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
+ // The SourceNode we want to fill with the generated code
+ // and the SourceMap
+ var node = new SourceNode();
+
+ // All even indices of this array are one line of the generated code,
+ // while all odd indices are the newlines between two adjacent lines
+ // (since `REGEX_NEWLINE` captures its match).
+ // Processed fragments are accessed by calling `shiftNextLine`.
+ var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
+ var remainingLinesIndex = 0;
+ var shiftNextLine = function() {
+ var lineContents = getNextLine();
+ // The last line of a file might not have a newline.
+ var newLine = getNextLine() || "";
+ return lineContents + newLine;
+
+ function getNextLine() {
+ return remainingLinesIndex < remainingLines.length ?
+ remainingLines[remainingLinesIndex++] : undefined;
+ }
+ };
+
+ // We need to remember the position of "remainingLines"
+ var lastGeneratedLine = 1, lastGeneratedColumn = 0;
+
+ // The generate SourceNodes we need a code range.
+ // To extract it current and last mapping is used.
+ // Here we store the last mapping.
+ var lastMapping = null;
+
+ aSourceMapConsumer.eachMapping(function (mapping) {
+ if (lastMapping !== null) {
+ // We add the code from "lastMapping" to "mapping":
+ // First check if there is a new line in between.
+ if (lastGeneratedLine < mapping.generatedLine) {
+ // Associate first line with "lastMapping"
+ addMappingWithCode(lastMapping, shiftNextLine());
+ lastGeneratedLine++;
+ lastGeneratedColumn = 0;
+ // The remaining code is added without mapping
+ } else {
+ // There is no new line in between.
+ // Associate the code between "lastGeneratedColumn" and
+ // "mapping.generatedColumn" with "lastMapping"
+ var nextLine = remainingLines[remainingLinesIndex] || '';
+ var code = nextLine.substr(0, mapping.generatedColumn -
+ lastGeneratedColumn);
+ remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
+ lastGeneratedColumn);
+ lastGeneratedColumn = mapping.generatedColumn;
+ addMappingWithCode(lastMapping, code);
+ // No more remaining code, continue
+ lastMapping = mapping;
+ return;
+ }
+ }
+ // We add the generated code until the first mapping
+ // to the SourceNode without any mapping.
+ // Each line is added as separate string.
+ while (lastGeneratedLine < mapping.generatedLine) {
+ node.add(shiftNextLine());
+ lastGeneratedLine++;
+ }
+ if (lastGeneratedColumn < mapping.generatedColumn) {
+ var nextLine = remainingLines[remainingLinesIndex] || '';
+ node.add(nextLine.substr(0, mapping.generatedColumn));
+ remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
+ lastGeneratedColumn = mapping.generatedColumn;
+ }
+ lastMapping = mapping;
+ }, this);
+ // We have processed all mappings.
+ if (remainingLinesIndex < remainingLines.length) {
+ if (lastMapping) {
+ // Associate the remaining code in the current line with "lastMapping"
+ addMappingWithCode(lastMapping, shiftNextLine());
+ }
+ // and add the remaining lines without any mapping
+ node.add(remainingLines.splice(remainingLinesIndex).join(""));
+ }
+
+ // Copy sourcesContent into SourceNode
+ aSourceMapConsumer.sources.forEach(function (sourceFile) {
+ var content = aSourceMapConsumer.sourceContentFor(sourceFile);
+ if (content != null) {
+ if (aRelativePath != null) {
+ sourceFile = util.join(aRelativePath, sourceFile);
+ }
+ node.setSourceContent(sourceFile, content);
+ }
+ });
+
+ return node;
+
+ function addMappingWithCode(mapping, code) {
+ if (mapping === null || mapping.source === undefined) {
+ node.add(code);
+ } else {
+ var source = aRelativePath
+ ? util.join(aRelativePath, mapping.source)
+ : mapping.source;
+ node.add(new SourceNode(mapping.originalLine,
+ mapping.originalColumn,
+ source,
+ code,
+ mapping.name));
+ }
+ }
+ };
+
+/**
+ * Add a chunk of generated JS to this source node.
+ *
+ * @param aChunk A string snippet of generated JS code, another instance of
+ * SourceNode, or an array where each member is one of those things.
+ */
+SourceNode.prototype.add = function SourceNode_add(aChunk) {
+ if (Array.isArray(aChunk)) {
+ aChunk.forEach(function (chunk) {
+ this.add(chunk);
+ }, this);
+ }
+ else if (aChunk[isSourceNode] || typeof aChunk === "string") {
+ if (aChunk) {
+ this.children.push(aChunk);
+ }
+ }
+ else {
+ throw new TypeError(
+ "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
+ );
+ }
+ return this;
+};
+
+/**
+ * Add a chunk of generated JS to the beginning of this source node.
+ *
+ * @param aChunk A string snippet of generated JS code, another instance of
+ * SourceNode, or an array where each member is one of those things.
+ */
+SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
+ if (Array.isArray(aChunk)) {
+ for (var i = aChunk.length-1; i >= 0; i--) {
+ this.prepend(aChunk[i]);
+ }
+ }
+ else if (aChunk[isSourceNode] || typeof aChunk === "string") {
+ this.children.unshift(aChunk);
+ }
+ else {
+ throw new TypeError(
+ "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
+ );
+ }
+ return this;
+};
+
+/**
+ * Walk over the tree of JS snippets in this node and its children. The
+ * walking function is called once for each snippet of JS and is passed that
+ * snippet and the its original associated source's line/column location.
+ *
+ * @param aFn The traversal function.
+ */
+SourceNode.prototype.walk = function SourceNode_walk(aFn) {
+ var chunk;
+ for (var i = 0, len = this.children.length; i < len; i++) {
+ chunk = this.children[i];
+ if (chunk[isSourceNode]) {
+ chunk.walk(aFn);
+ }
+ else {
+ if (chunk !== '') {
+ aFn(chunk, { source: this.source,
+ line: this.line,
+ column: this.column,
+ name: this.name });
+ }
+ }
+ }
+};
+
+/**
+ * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
+ * each of `this.children`.
+ *
+ * @param aSep The separator.
+ */
+SourceNode.prototype.join = function SourceNode_join(aSep) {
+ var newChildren;
+ var i;
+ var len = this.children.length;
+ if (len > 0) {
+ newChildren = [];
+ for (i = 0; i < len-1; i++) {
+ newChildren.push(this.children[i]);
+ newChildren.push(aSep);
+ }
+ newChildren.push(this.children[i]);
+ this.children = newChildren;
+ }
+ return this;
+};
+
+/**
+ * Call String.prototype.replace on the very right-most source snippet. Useful
+ * for trimming whitespace from the end of a source node, etc.
+ *
+ * @param aPattern The pattern to replace.
+ * @param aReplacement The thing to replace the pattern with.
+ */
+SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
+ var lastChild = this.children[this.children.length - 1];
+ if (lastChild[isSourceNode]) {
+ lastChild.replaceRight(aPattern, aReplacement);
+ }
+ else if (typeof lastChild === 'string') {
+ this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
+ }
+ else {
+ this.children.push(''.replace(aPattern, aReplacement));
+ }
+ return this;
+};
+
+/**
+ * Set the source content for a source file. This will be added to the SourceMapGenerator
+ * in the sourcesContent field.
+ *
+ * @param aSourceFile The filename of the source file
+ * @param aSourceContent The content of the source file
+ */
+SourceNode.prototype.setSourceContent =
+ function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
+ this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
+ };
+
+/**
+ * Walk over the tree of SourceNodes. The walking function is called for each
+ * source file content and is passed the filename and source content.
+ *
+ * @param aFn The traversal function.
+ */
+SourceNode.prototype.walkSourceContents =
+ function SourceNode_walkSourceContents(aFn) {
+ for (var i = 0, len = this.children.length; i < len; i++) {
+ if (this.children[i][isSourceNode]) {
+ this.children[i].walkSourceContents(aFn);
+ }
+ }
+
+ var sources = Object.keys(this.sourceContents);
+ for (var i = 0, len = sources.length; i < len; i++) {
+ aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
+ }
+ };
+
+/**
+ * Return the string representation of this source node. Walks over the tree
+ * and concatenates all the various snippets together to one string.
+ */
+SourceNode.prototype.toString = function SourceNode_toString() {
+ var str = "";
+ this.walk(function (chunk) {
+ str += chunk;
+ });
+ return str;
+};
+
+/**
+ * Returns the string representation of this source node along with a source
+ * map.
+ */
+SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
+ var generated = {
+ code: "",
+ line: 1,
+ column: 0
+ };
+ var map = new SourceMapGenerator(aArgs);
+ var sourceMappingActive = false;
+ var lastOriginalSource = null;
+ var lastOriginalLine = null;
+ var lastOriginalColumn = null;
+ var lastOriginalName = null;
+ this.walk(function (chunk, original) {
+ generated.code += chunk;
+ if (original.source !== null
+ && original.line !== null
+ && original.column !== null) {
+ if(lastOriginalSource !== original.source
+ || lastOriginalLine !== original.line
+ || lastOriginalColumn !== original.column
+ || lastOriginalName !== original.name) {
+ map.addMapping({
+ source: original.source,
+ original: {
+ line: original.line,
+ column: original.column
+ },
+ generated: {
+ line: generated.line,
+ column: generated.column
+ },
+ name: original.name
+ });
+ }
+ lastOriginalSource = original.source;
+ lastOriginalLine = original.line;
+ lastOriginalColumn = original.column;
+ lastOriginalName = original.name;
+ sourceMappingActive = true;
+ } else if (sourceMappingActive) {
+ map.addMapping({
+ generated: {
+ line: generated.line,
+ column: generated.column
+ }
+ });
+ lastOriginalSource = null;
+ sourceMappingActive = false;
+ }
+ for (var idx = 0, length = chunk.length; idx < length; idx++) {
+ if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
+ generated.line++;
+ generated.column = 0;
+ // Mappings end at eol
+ if (idx + 1 === length) {
+ lastOriginalSource = null;
+ sourceMappingActive = false;
+ } else if (sourceMappingActive) {
+ map.addMapping({
+ source: original.source,
+ original: {
+ line: original.line,
+ column: original.column
+ },
+ generated: {
+ line: generated.line,
+ column: generated.column
+ },
+ name: original.name
+ });
+ }
+ } else {
+ generated.column++;
+ }
+ }
+ });
+ this.walkSourceContents(function (sourceFile, sourceContent) {
+ map.setSourceContent(sourceFile, sourceContent);
+ });
+
+ return { code: generated.code, map: map };
+};
+
+exports.SourceNode = SourceNode;
diff --git a/node_modules/source-map-js/lib/util.js b/node_modules/source-map-js/lib/util.js
new file mode 100644
index 0000000000000000000000000000000000000000..430e2d0ff0b2f2a084d00fbfbcf9a229d0a7bfff
--- /dev/null
+++ b/node_modules/source-map-js/lib/util.js
@@ -0,0 +1,594 @@
+/* -*- Mode: js; js-indent-level: 2; -*- */
+/*
+ * Copyright 2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+/**
+ * This is a helper function for getting values from parameter/options
+ * objects.
+ *
+ * @param args The object we are extracting values from
+ * @param name The name of the property we are getting.
+ * @param defaultValue An optional value to return if the property is missing
+ * from the object. If this is not specified and the property is missing, an
+ * error will be thrown.
+ */
+function getArg(aArgs, aName, aDefaultValue) {
+ if (aName in aArgs) {
+ return aArgs[aName];
+ } else if (arguments.length === 3) {
+ return aDefaultValue;
+ } else {
+ throw new Error('"' + aName + '" is a required argument.');
+ }
+}
+exports.getArg = getArg;
+
+var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
+var dataUrlRegexp = /^data:.+\,.+$/;
+
+function urlParse(aUrl) {
+ var match = aUrl.match(urlRegexp);
+ if (!match) {
+ return null;
+ }
+ return {
+ scheme: match[1],
+ auth: match[2],
+ host: match[3],
+ port: match[4],
+ path: match[5]
+ };
+}
+exports.urlParse = urlParse;
+
+function urlGenerate(aParsedUrl) {
+ var url = '';
+ if (aParsedUrl.scheme) {
+ url += aParsedUrl.scheme + ':';
+ }
+ url += '//';
+ if (aParsedUrl.auth) {
+ url += aParsedUrl.auth + '@';
+ }
+ if (aParsedUrl.host) {
+ url += aParsedUrl.host;
+ }
+ if (aParsedUrl.port) {
+ url += ":" + aParsedUrl.port
+ }
+ if (aParsedUrl.path) {
+ url += aParsedUrl.path;
+ }
+ return url;
+}
+exports.urlGenerate = urlGenerate;
+
+var MAX_CACHED_INPUTS = 32;
+
+/**
+ * Takes some function `f(input) -> result` and returns a memoized version of
+ * `f`.
+ *
+ * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The
+ * memoization is a dumb-simple, linear least-recently-used cache.
+ */
+function lruMemoize(f) {
+ var cache = [];
+
+ return function(input) {
+ for (var i = 0; i < cache.length; i++) {
+ if (cache[i].input === input) {
+ var temp = cache[0];
+ cache[0] = cache[i];
+ cache[i] = temp;
+ return cache[0].result;
+ }
+ }
+
+ var result = f(input);
+
+ cache.unshift({
+ input,
+ result,
+ });
+
+ if (cache.length > MAX_CACHED_INPUTS) {
+ cache.pop();
+ }
+
+ return result;
+ };
+}
+
+/**
+ * Normalizes a path, or the path portion of a URL:
+ *
+ * - Replaces consecutive slashes with one slash.
+ * - Removes unnecessary '.' parts.
+ * - Removes unnecessary '/..' parts.
+ *
+ * Based on code in the Node.js 'path' core module.
+ *
+ * @param aPath The path or url to normalize.
+ */
+var normalize = lruMemoize(function normalize(aPath) {
+ var path = aPath;
+ var url = urlParse(aPath);
+ if (url) {
+ if (!url.path) {
+ return aPath;
+ }
+ path = url.path;
+ }
+ var isAbsolute = exports.isAbsolute(path);
+ // Split the path into parts between `/` characters. This is much faster than
+ // using `.split(/\/+/g)`.
+ var parts = [];
+ var start = 0;
+ var i = 0;
+ while (true) {
+ start = i;
+ i = path.indexOf("/", start);
+ if (i === -1) {
+ parts.push(path.slice(start));
+ break;
+ } else {
+ parts.push(path.slice(start, i));
+ while (i < path.length && path[i] === "/") {
+ i++;
+ }
+ }
+ }
+
+ for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
+ part = parts[i];
+ if (part === '.') {
+ parts.splice(i, 1);
+ } else if (part === '..') {
+ up++;
+ } else if (up > 0) {
+ if (part === '') {
+ // The first part is blank if the path is absolute. Trying to go
+ // above the root is a no-op. Therefore we can remove all '..' parts
+ // directly after the root.
+ parts.splice(i + 1, up);
+ up = 0;
+ } else {
+ parts.splice(i, 2);
+ up--;
+ }
+ }
+ }
+ path = parts.join('/');
+
+ if (path === '') {
+ path = isAbsolute ? '/' : '.';
+ }
+
+ if (url) {
+ url.path = path;
+ return urlGenerate(url);
+ }
+ return path;
+});
+exports.normalize = normalize;
+
+/**
+ * Joins two paths/URLs.
+ *
+ * @param aRoot The root path or URL.
+ * @param aPath The path or URL to be joined with the root.
+ *
+ * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
+ * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
+ * first.
+ * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
+ * is updated with the result and aRoot is returned. Otherwise the result
+ * is returned.
+ * - If aPath is absolute, the result is aPath.
+ * - Otherwise the two paths are joined with a slash.
+ * - Joining for example 'http://' and 'www.example.com' is also supported.
+ */
+function join(aRoot, aPath) {
+ if (aRoot === "") {
+ aRoot = ".";
+ }
+ if (aPath === "") {
+ aPath = ".";
+ }
+ var aPathUrl = urlParse(aPath);
+ var aRootUrl = urlParse(aRoot);
+ if (aRootUrl) {
+ aRoot = aRootUrl.path || '/';
+ }
+
+ // `join(foo, '//www.example.org')`
+ if (aPathUrl && !aPathUrl.scheme) {
+ if (aRootUrl) {
+ aPathUrl.scheme = aRootUrl.scheme;
+ }
+ return urlGenerate(aPathUrl);
+ }
+
+ if (aPathUrl || aPath.match(dataUrlRegexp)) {
+ return aPath;
+ }
+
+ // `join('http://', 'www.example.com')`
+ if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
+ aRootUrl.host = aPath;
+ return urlGenerate(aRootUrl);
+ }
+
+ var joined = aPath.charAt(0) === '/'
+ ? aPath
+ : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
+
+ if (aRootUrl) {
+ aRootUrl.path = joined;
+ return urlGenerate(aRootUrl);
+ }
+ return joined;
+}
+exports.join = join;
+
+exports.isAbsolute = function (aPath) {
+ return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
+};
+
+/**
+ * Make a path relative to a URL or another path.
+ *
+ * @param aRoot The root path or URL.
+ * @param aPath The path or URL to be made relative to aRoot.
+ */
+function relative(aRoot, aPath) {
+ if (aRoot === "") {
+ aRoot = ".";
+ }
+
+ aRoot = aRoot.replace(/\/$/, '');
+
+ // It is possible for the path to be above the root. In this case, simply
+ // checking whether the root is a prefix of the path won't work. Instead, we
+ // need to remove components from the root one by one, until either we find
+ // a prefix that fits, or we run out of components to remove.
+ var level = 0;
+ while (aPath.indexOf(aRoot + '/') !== 0) {
+ var index = aRoot.lastIndexOf("/");
+ if (index < 0) {
+ return aPath;
+ }
+
+ // If the only part of the root that is left is the scheme (i.e. http://,
+ // file:///, etc.), one or more slashes (/), or simply nothing at all, we
+ // have exhausted all components, so the path is not relative to the root.
+ aRoot = aRoot.slice(0, index);
+ if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
+ return aPath;
+ }
+
+ ++level;
+ }
+
+ // Make sure we add a "../" for each component we removed from the root.
+ return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
+}
+exports.relative = relative;
+
+var supportsNullProto = (function () {
+ var obj = Object.create(null);
+ return !('__proto__' in obj);
+}());
+
+function identity (s) {
+ return s;
+}
+
+/**
+ * Because behavior goes wacky when you set `__proto__` on objects, we
+ * have to prefix all the strings in our set with an arbitrary character.
+ *
+ * See https://github.com/mozilla/source-map/pull/31 and
+ * https://github.com/mozilla/source-map/issues/30
+ *
+ * @param String aStr
+ */
+function toSetString(aStr) {
+ if (isProtoString(aStr)) {
+ return '$' + aStr;
+ }
+
+ return aStr;
+}
+exports.toSetString = supportsNullProto ? identity : toSetString;
+
+function fromSetString(aStr) {
+ if (isProtoString(aStr)) {
+ return aStr.slice(1);
+ }
+
+ return aStr;
+}
+exports.fromSetString = supportsNullProto ? identity : fromSetString;
+
+function isProtoString(s) {
+ if (!s) {
+ return false;
+ }
+
+ var length = s.length;
+
+ if (length < 9 /* "__proto__".length */) {
+ return false;
+ }
+
+ if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
+ s.charCodeAt(length - 2) !== 95 /* '_' */ ||
+ s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
+ s.charCodeAt(length - 4) !== 116 /* 't' */ ||
+ s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
+ s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
+ s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
+ s.charCodeAt(length - 8) !== 95 /* '_' */ ||
+ s.charCodeAt(length - 9) !== 95 /* '_' */) {
+ return false;
+ }
+
+ for (var i = length - 10; i >= 0; i--) {
+ if (s.charCodeAt(i) !== 36 /* '$' */) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/**
+ * Comparator between two mappings where the original positions are compared.
+ *
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
+ * mappings with the same original source/line/column, but different generated
+ * line and column the same. Useful when searching for a mapping with a
+ * stubbed out mapping.
+ */
+function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
+ var cmp = strcmp(mappingA.source, mappingB.source);
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0 || onlyCompareOriginal) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByOriginalPositions = compareByOriginalPositions;
+
+function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {
+ var cmp
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0 || onlyCompareOriginal) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedLine - mappingB.generatedLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;
+
+/**
+ * Comparator between two mappings with deflated source and name indices where
+ * the generated positions are compared.
+ *
+ * Optionally pass in `true` as `onlyCompareGenerated` to consider two
+ * mappings with the same generated line and column, but different
+ * source/name/original line and column the same. Useful when searching for a
+ * mapping with a stubbed out mapping.
+ */
+function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0 || onlyCompareGenerated) {
+ return cmp;
+ }
+
+ cmp = strcmp(mappingA.source, mappingB.source);
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
+
+function compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {
+ var cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0 || onlyCompareGenerated) {
+ return cmp;
+ }
+
+ cmp = strcmp(mappingA.source, mappingB.source);
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;
+
+function strcmp(aStr1, aStr2) {
+ if (aStr1 === aStr2) {
+ return 0;
+ }
+
+ if (aStr1 === null) {
+ return 1; // aStr2 !== null
+ }
+
+ if (aStr2 === null) {
+ return -1; // aStr1 !== null
+ }
+
+ if (aStr1 > aStr2) {
+ return 1;
+ }
+
+ return -1;
+}
+
+/**
+ * Comparator between two mappings with inflated source and name strings where
+ * the generated positions are compared.
+ */
+function compareByGeneratedPositionsInflated(mappingA, mappingB) {
+ var cmp = mappingA.generatedLine - mappingB.generatedLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.generatedColumn - mappingB.generatedColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = strcmp(mappingA.source, mappingB.source);
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalLine - mappingB.originalLine;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ cmp = mappingA.originalColumn - mappingB.originalColumn;
+ if (cmp !== 0) {
+ return cmp;
+ }
+
+ return strcmp(mappingA.name, mappingB.name);
+}
+exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
+
+/**
+ * Strip any JSON XSSI avoidance prefix from the string (as documented
+ * in the source maps specification), and then parse the string as
+ * JSON.
+ */
+function parseSourceMapInput(str) {
+ return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
+}
+exports.parseSourceMapInput = parseSourceMapInput;
+
+/**
+ * Compute the URL of a source given the the source root, the source's
+ * URL, and the source map's URL.
+ */
+function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
+ sourceURL = sourceURL || '';
+
+ if (sourceRoot) {
+ // This follows what Chrome does.
+ if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
+ sourceRoot += '/';
+ }
+ // The spec says:
+ // Line 4: An optional source root, useful for relocating source
+ // files on a server or removing repeated values in the
+ // “sources” entry. This value is prepended to the individual
+ // entries in the “source” field.
+ sourceURL = sourceRoot + sourceURL;
+ }
+
+ // Historically, SourceMapConsumer did not take the sourceMapURL as
+ // a parameter. This mode is still somewhat supported, which is why
+ // this code block is conditional. However, it's preferable to pass
+ // the source map URL to SourceMapConsumer, so that this function
+ // can implement the source URL resolution algorithm as outlined in
+ // the spec. This block is basically the equivalent of:
+ // new URL(sourceURL, sourceMapURL).toString()
+ // ... except it avoids using URL, which wasn't available in the
+ // older releases of node still supported by this library.
+ //
+ // The spec says:
+ // If the sources are not absolute URLs after prepending of the
+ // “sourceRoot”, the sources are resolved relative to the
+ // SourceMap (like resolving script src in a html document).
+ if (sourceMapURL) {
+ var parsed = urlParse(sourceMapURL);
+ if (!parsed) {
+ throw new Error("sourceMapURL could not be parsed");
+ }
+ if (parsed.path) {
+ // Strip the last path component, but keep the "/".
+ var index = parsed.path.lastIndexOf('/');
+ if (index >= 0) {
+ parsed.path = parsed.path.substring(0, index + 1);
+ }
+ }
+ sourceURL = join(urlGenerate(parsed), sourceURL);
+ }
+
+ return normalize(sourceURL);
+}
+exports.computeSourceURL = computeSourceURL;
diff --git a/node_modules/source-map-js/package.json b/node_modules/source-map-js/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..f58dbeb4eca3ad3118fbd5e2a7f6241d5b5aceaa
--- /dev/null
+++ b/node_modules/source-map-js/package.json
@@ -0,0 +1,71 @@
+{
+ "name": "source-map-js",
+ "description": "Generates and consumes source maps",
+ "version": "1.2.1",
+ "homepage": "https://github.com/7rulnik/source-map-js",
+ "author": "Valentin 7rulnik Semirulnik ",
+ "contributors": [
+ "Nick Fitzgerald ",
+ "Tobias Koppers ",
+ "Duncan Beevers ",
+ "Stephen Crane ",
+ "Ryan Seddon ",
+ "Miles Elam ",
+ "Mihai Bazon ",
+ "Michael Ficarra ",
+ "Todd Wolfson ",
+ "Alexander Solovyov ",
+ "Felix Gnass ",
+ "Conrad Irwin ",
+ "usrbincc ",
+ "David Glasser ",
+ "Chase Douglas ",
+ "Evan Wallace ",
+ "Heather Arthur ",
+ "Hugh Kennedy ",
+ "David Glasser ",
+ "Simon Lydell ",
+ "Jmeas Smith ",
+ "Michael Z Goddard ",
+ "azu ",
+ "John Gozde ",
+ "Adam Kirkton ",
+ "Chris Montgomery ",
+ "J. Ryan Stinnett ",
+ "Jack Herrington ",
+ "Chris Truter ",
+ "Daniel Espeset ",
+ "Jamie Wong ",
+ "Eddy Bruël ",
+ "Hawken Rives ",
+ "Gilad Peleg ",
+ "djchie ",
+ "Gary Ye ",
+ "Nicolas Lalevée "
+ ],
+ "repository": "7rulnik/source-map-js",
+ "main": "./source-map.js",
+ "files": [
+ "source-map.js",
+ "source-map.d.ts",
+ "lib/"
+ ],
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "license": "BSD-3-Clause",
+ "scripts": {
+ "test": "npm run build && node test/run-tests.js",
+ "build": "webpack --color",
+ "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
+ },
+ "devDependencies": {
+ "clean-publish": "^3.1.0",
+ "doctoc": "^0.15.0",
+ "webpack": "^1.12.0"
+ },
+ "clean-publish": {
+ "cleanDocs": true
+ },
+ "typings": "source-map.d.ts"
+}
diff --git a/node_modules/source-map-js/source-map.d.ts b/node_modules/source-map-js/source-map.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ec8892fa11313d34c668e6f0ca9f80fdd5b53aec
--- /dev/null
+++ b/node_modules/source-map-js/source-map.d.ts
@@ -0,0 +1,104 @@
+export interface StartOfSourceMap {
+ file?: string;
+ sourceRoot?: string;
+}
+
+export interface RawSourceMap extends StartOfSourceMap {
+ version: string;
+ sources: string[];
+ names: string[];
+ sourcesContent?: string[];
+ mappings: string;
+}
+
+export interface Position {
+ line: number;
+ column: number;
+}
+
+export interface LineRange extends Position {
+ lastColumn: number;
+}
+
+export interface FindPosition extends Position {
+ // SourceMapConsumer.GREATEST_LOWER_BOUND or SourceMapConsumer.LEAST_UPPER_BOUND
+ bias?: number;
+}
+
+export interface SourceFindPosition extends FindPosition {
+ source: string;
+}
+
+export interface MappedPosition extends Position {
+ source: string;
+ name?: string;
+}
+
+export interface MappingItem {
+ source: string | null;
+ generatedLine: number;
+ generatedColumn: number;
+ originalLine: number | null;
+ originalColumn: number | null;
+ name: string | null;
+}
+
+export class SourceMapConsumer {
+ static GENERATED_ORDER: number;
+ static ORIGINAL_ORDER: number;
+
+ static GREATEST_LOWER_BOUND: number;
+ static LEAST_UPPER_BOUND: number;
+
+ constructor(rawSourceMap: RawSourceMap);
+ readonly file: string | undefined | null;
+ readonly sourceRoot: string | undefined | null;
+ readonly sourcesContent: readonly string[] | null | undefined;
+ readonly sources: readonly string[]
+
+ computeColumnSpans(): void;
+ originalPositionFor(generatedPosition: FindPosition): MappedPosition;
+ generatedPositionFor(originalPosition: SourceFindPosition): LineRange;
+ allGeneratedPositionsFor(originalPosition: MappedPosition): Position[];
+ hasContentsOfAllSources(): boolean;
+ sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null;
+ eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
+}
+
+export interface Mapping {
+ generated: Position;
+ original?: Position | null;
+ source?: string | null;
+ name?: string | null;
+}
+
+export class SourceMapGenerator {
+ constructor(startOfSourceMap?: StartOfSourceMap);
+ static fromSourceMap(sourceMapConsumer: SourceMapConsumer, startOfSourceMap?: StartOfSourceMap): SourceMapGenerator;
+ addMapping(mapping: Mapping): void;
+ setSourceContent(sourceFile: string, sourceContent: string | null | undefined): void;
+ applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
+ toString(): string;
+ toJSON(): RawSourceMap;
+}
+
+export interface CodeWithSourceMap {
+ code: string;
+ map: SourceMapGenerator;
+}
+
+export class SourceNode {
+ constructor();
+ constructor(line: number, column: number, source: string);
+ constructor(line: number, column: number, source: string, chunk?: string, name?: string);
+ static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
+ add(chunk: string): void;
+ prepend(chunk: string): void;
+ setSourceContent(sourceFile: string, sourceContent: string): void;
+ walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
+ walkSourceContents(fn: (file: string, content: string) => void): void;
+ join(sep: string): SourceNode;
+ replaceRight(pattern: string, replacement: string): SourceNode;
+ toString(): string;
+ toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
+}
diff --git a/node_modules/source-map-js/source-map.js b/node_modules/source-map-js/source-map.js
new file mode 100644
index 0000000000000000000000000000000000000000..bc88fe820c87a217d27eb010281fe39b71163835
--- /dev/null
+++ b/node_modules/source-map-js/source-map.js
@@ -0,0 +1,8 @@
+/*
+ * Copyright 2009-2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE.txt or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
+exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
+exports.SourceNode = require('./lib/source-node').SourceNode;
diff --git a/node_modules/source-map-support/LICENSE.md b/node_modules/source-map-support/LICENSE.md
new file mode 100644
index 0000000000000000000000000000000000000000..6247ca912cb4bcc379aed9b711290dc3d174f915
--- /dev/null
+++ b/node_modules/source-map-support/LICENSE.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Evan Wallace
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/source-map-support/README.md b/node_modules/source-map-support/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..40228b7910cd798dd5ff06d68d82255c5b9096bb
--- /dev/null
+++ b/node_modules/source-map-support/README.md
@@ -0,0 +1,284 @@
+# Source Map Support
+[](https://travis-ci.org/evanw/node-source-map-support)
+
+This module provides source map support for stack traces in node via the [V8 stack trace API](https://github.com/v8/v8/wiki/Stack-Trace-API). It uses the [source-map](https://github.com/mozilla/source-map) module to replace the paths and line numbers of source-mapped files with their original paths and line numbers. The output mimics node's stack trace format with the goal of making every compile-to-JS language more of a first-class citizen. Source maps are completely general (not specific to any one language) so you can use source maps with multiple compile-to-JS languages in the same node process.
+
+## Installation and Usage
+
+#### Node support
+
+```
+$ npm install source-map-support
+```
+
+Source maps can be generated using libraries such as [source-map-index-generator](https://github.com/twolfson/source-map-index-generator). Once you have a valid source map, place a source mapping comment somewhere in the file (usually done automatically or with an option by your transpiler):
+
+```
+//# sourceMappingURL=path/to/source.map
+```
+
+If multiple sourceMappingURL comments exist in one file, the last sourceMappingURL comment will be
+respected (e.g. if a file mentions the comment in code, or went through multiple transpilers).
+The path should either be absolute or relative to the compiled file.
+
+From here you have two options.
+
+##### CLI Usage
+
+```bash
+node -r source-map-support/register compiled.js
+```
+
+##### Programmatic Usage
+
+Put the following line at the top of the compiled file.
+
+```js
+require('source-map-support').install();
+```
+
+It is also possible to install the source map support directly by
+requiring the `register` module which can be handy with ES6:
+
+```js
+import 'source-map-support/register'
+
+// Instead of:
+import sourceMapSupport from 'source-map-support'
+sourceMapSupport.install()
+```
+Note: if you're using babel-register, it includes source-map-support already.
+
+It is also very useful with Mocha:
+
+```
+$ mocha --require source-map-support/register tests/
+```
+
+#### Browser support
+
+This library also works in Chrome. While the DevTools console already supports source maps, the V8 engine doesn't and `Error.prototype.stack` will be incorrect without this library. Everything will just work if you deploy your source files using [browserify](http://browserify.org/). Just make sure to pass the `--debug` flag to the browserify command so your source maps are included in the bundled code.
+
+This library also works if you use another build process or just include the source files directly. In this case, include the file `browser-source-map-support.js` in your page and call `sourceMapSupport.install()`. It contains the whole library already bundled for the browser using browserify.
+
+```html
+
+
+```
+
+This library also works if you use AMD (Asynchronous Module Definition), which is used in tools like [RequireJS](http://requirejs.org/). Just list `browser-source-map-support` as a dependency:
+
+```html
+
+```
+
+## Options
+
+This module installs two things: a change to the `stack` property on `Error` objects and a handler for uncaught exceptions that mimics node's default exception handler (the handler can be seen in the demos below). You may want to disable the handler if you have your own uncaught exception handler. This can be done by passing an argument to the installer:
+
+```js
+require('source-map-support').install({
+ handleUncaughtExceptions: false
+});
+```
+
+This module loads source maps from the filesystem by default. You can provide alternate loading behavior through a callback as shown below. For example, [Meteor](https://github.com/meteor) keeps all source maps cached in memory to avoid disk access.
+
+```js
+require('source-map-support').install({
+ retrieveSourceMap: function(source) {
+ if (source === 'compiled.js') {
+ return {
+ url: 'original.js',
+ map: fs.readFileSync('compiled.js.map', 'utf8')
+ };
+ }
+ return null;
+ }
+});
+```
+
+The module will by default assume a browser environment if XMLHttpRequest and window are defined. If either of these do not exist it will instead assume a node environment.
+In some rare cases, e.g. when running a browser emulation and where both variables are also set, you can explictly specify the environment to be either 'browser' or 'node'.
+
+```js
+require('source-map-support').install({
+ environment: 'node'
+});
+```
+
+To support files with inline source maps, the `hookRequire` options can be specified, which will monitor all source files for inline source maps.
+
+
+```js
+require('source-map-support').install({
+ hookRequire: true
+});
+```
+
+This monkey patches the `require` module loading chain, so is not enabled by default and is not recommended for any sort of production usage.
+
+## Demos
+
+#### Basic Demo
+
+original.js:
+
+```js
+throw new Error('test'); // This is the original code
+```
+
+compiled.js:
+
+```js
+require('source-map-support').install();
+
+throw new Error('test'); // This is the compiled code
+// The next line defines the sourceMapping.
+//# sourceMappingURL=compiled.js.map
+```
+
+compiled.js.map:
+
+```json
+{
+ "version": 3,
+ "file": "compiled.js",
+ "sources": ["original.js"],
+ "names": [],
+ "mappings": ";;AAAA,MAAM,IAAI"
+}
+```
+
+Run compiled.js using node (notice how the stack trace uses original.js instead of compiled.js):
+
+```
+$ node compiled.js
+
+original.js:1
+throw new Error('test'); // This is the original code
+ ^
+Error: test
+ at Object. (original.js:1:7)
+ at Module._compile (module.js:456:26)
+ at Object.Module._extensions..js (module.js:474:10)
+ at Module.load (module.js:356:32)
+ at Function.Module._load (module.js:312:12)
+ at Function.Module.runMain (module.js:497:10)
+ at startup (node.js:119:16)
+ at node.js:901:3
+```
+
+#### TypeScript Demo
+
+demo.ts:
+
+```typescript
+declare function require(name: string);
+require('source-map-support').install();
+class Foo {
+ constructor() { this.bar(); }
+ bar() { throw new Error('this is a demo'); }
+}
+new Foo();
+```
+
+Compile and run the file using the TypeScript compiler from the terminal:
+
+```
+$ npm install source-map-support typescript
+$ node_modules/typescript/bin/tsc -sourcemap demo.ts
+$ node demo.js
+
+demo.ts:5
+ bar() { throw new Error('this is a demo'); }
+ ^
+Error: this is a demo
+ at Foo.bar (demo.ts:5:17)
+ at new Foo (demo.ts:4:24)
+ at Object. (demo.ts:7:1)
+ at Module._compile (module.js:456:26)
+ at Object.Module._extensions..js (module.js:474:10)
+ at Module.load (module.js:356:32)
+ at Function.Module._load (module.js:312:12)
+ at Function.Module.runMain (module.js:497:10)
+ at startup (node.js:119:16)
+ at node.js:901:3
+```
+
+There is also the option to use `-r source-map-support/register` with typescript, without the need add the `require('source-map-support').install()` in the code base:
+
+```
+$ npm install source-map-support typescript
+$ node_modules/typescript/bin/tsc -sourcemap demo.ts
+$ node -r source-map-support/register demo.js
+
+demo.ts:5
+ bar() { throw new Error('this is a demo'); }
+ ^
+Error: this is a demo
+ at Foo.bar (demo.ts:5:17)
+ at new Foo (demo.ts:4:24)
+ at Object. (demo.ts:7:1)
+ at Module._compile (module.js:456:26)
+ at Object.Module._extensions..js (module.js:474:10)
+ at Module.load (module.js:356:32)
+ at Function.Module._load (module.js:312:12)
+ at Function.Module.runMain (module.js:497:10)
+ at startup (node.js:119:16)
+ at node.js:901:3
+```
+
+#### CoffeeScript Demo
+
+demo.coffee:
+
+```coffee
+require('source-map-support').install()
+foo = ->
+ bar = -> throw new Error 'this is a demo'
+ bar()
+foo()
+```
+
+Compile and run the file using the CoffeeScript compiler from the terminal:
+
+```sh
+$ npm install source-map-support coffeescript
+$ node_modules/.bin/coffee --map --compile demo.coffee
+$ node demo.js
+
+demo.coffee:3
+ bar = -> throw new Error 'this is a demo'
+ ^
+Error: this is a demo
+ at bar (demo.coffee:3:22)
+ at foo (demo.coffee:4:3)
+ at Object. (demo.coffee:5:1)
+ at Object. (demo.coffee:1:1)
+ at Module._compile (module.js:456:26)
+ at Object.Module._extensions..js (module.js:474:10)
+ at Module.load (module.js:356:32)
+ at Function.Module._load (module.js:312:12)
+ at Function.Module.runMain (module.js:497:10)
+ at startup (node.js:119:16)
+```
+
+## Tests
+
+This repo contains both automated tests for node and manual tests for the browser. The automated tests can be run using mocha (type `mocha` in the root directory). To run the manual tests:
+
+* Build the tests using `build.js`
+* Launch the HTTP server (`npm run serve-tests`) and visit
+ * http://127.0.0.1:1336/amd-test
+ * http://127.0.0.1:1336/browser-test
+ * http://127.0.0.1:1336/browserify-test - **Currently not working** due to a bug with browserify (see [pull request #66](https://github.com/evanw/node-source-map-support/pull/66) for details).
+* For `header-test`, run `server.js` inside that directory and visit http://127.0.0.1:1337/
+
+## License
+
+This code is available under the [MIT license](http://opensource.org/licenses/MIT).
diff --git a/node_modules/source-map-support/browser-source-map-support.js b/node_modules/source-map-support/browser-source-map-support.js
new file mode 100644
index 0000000000000000000000000000000000000000..782da501459760dd729b76cb0a80358063f70e30
--- /dev/null
+++ b/node_modules/source-map-support/browser-source-map-support.js
@@ -0,0 +1,114 @@
+/*
+ * Support for source maps in V8 stack traces
+ * https://github.com/evanw/node-source-map-support
+ */
+/*
+ The buffer module from node.js, for the browser.
+
+ @author Feross Aboukhadijeh
+ license MIT
+*/
+(this.define||function(R,U){this.sourceMapSupport=U()})("browser-source-map-support",function(R){(function e(C,J,A){function p(f,c){if(!J[f]){if(!C[f]){var l="function"==typeof require&&require;if(!c&&l)return l(f,!0);if(t)return t(f,!0);throw Error("Cannot find module '"+f+"'");}l=J[f]={exports:{}};C[f][0].call(l.exports,function(q){var r=C[f][1][q];return p(r?r:q)},l,l.exports,e,C,J,A)}return J[f].exports}for(var t="function"==typeof require&&require,m=0;mm)return-1;if(58>m)return m-48+52;if(91>m)return m-65;if(123>m)return m-97+26}var t="undefined"!==typeof Uint8Array?Uint8Array:Array;e.toByteArray=function(m){function f(d){q[k++]=d}if(0>16);f((u&65280)>>8);f(u&255)}2===l?(u=p(m.charAt(c))<<2|p(m.charAt(c+1))>>4,f(u&255)):1===l&&(u=p(m.charAt(c))<<10|p(m.charAt(c+1))<<4|p(m.charAt(c+2))>>2,f(u>>8&255),f(u&255));return q};e.fromByteArray=function(m){var f=m.length%3,c="",l;var q=0;for(l=m.length-f;q>
+18&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>12&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>6&63)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r&63);c+=r}switch(f){case 1:r=m[m.length-1];c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<4&63);c+="==";break;case 2:r=(m[m.length-2]<<8)+
+m[m.length-1],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>10),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r>>4&63),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(r<<2&63),c+="="}return c}})("undefined"===typeof A?this.base64js={}:A)},{}],3:[function(C,J,A){},{}],4:[function(C,J,A){(function(e){var p=Object.prototype.toString,t="function"===typeof e.alloc&&"function"===typeof e.allocUnsafe&&"function"===
+typeof e.from;J.exports=function(m,f,c){if("number"===typeof m)throw new TypeError('"value" argument must not be a number');if("ArrayBuffer"===p.call(m).slice(8,-1)){f>>>=0;var l=m.byteLength-f;if(0>l)throw new RangeError("'offset' is out of bounds");if(void 0===c)c=l;else if(c>>>=0,c>l)throw new RangeError("'length' is out of bounds");return t?e.from(m.slice(f,f+c)):new e(new Uint8Array(m.slice(f,f+c)))}if("string"===typeof m){c=f;if("string"!==typeof c||""===c)c="utf8";if(!e.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');
+return t?e.from(m,c):new e(m,c)}return t?e.from(m):new e(m)}}).call(this,C("buffer").Buffer)},{buffer:5}],5:[function(C,J,A){function e(a,b,h){if(!(this instanceof e))return new e(a,b,h);var w=typeof a;if("number"===w)var y=0>>0:0;else if("string"===w){if("base64"===b)for(a=(a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")).replace(L,"");0!==a.length%4;)a+="=";y=e.byteLength(a,b)}else if("object"===w&&null!==a)"Buffer"===a.type&&z(a.data)&&(a=a.data),y=0<+a.length?Math.floor(+a.length):0;else throw new TypeError("must start with number, buffer, array or string");
+if(this.length>G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");if(e.TYPED_ARRAY_SUPPORT)var I=e._augment(new Uint8Array(y));else I=this,I.length=y,I._isBuffer=!0;if(e.TYPED_ARRAY_SUPPORT&&"number"===typeof a.byteLength)I._set(a);else{var K=a;if(z(K)||e.isBuffer(K)||K&&"object"===typeof K&&"number"===typeof K.length)if(e.isBuffer(a))for(b=0;ba)throw new RangeError("offset is not uint");if(a+b>h)throw new RangeError("Trying to access beyond buffer length");}function m(a,b,h,w,y,I){if(!e.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>y||ba.length)throw new TypeError("index out of range");
+}function f(a,b,h,w){0>b&&(b=65535+b+1);for(var y=0,I=Math.min(a.length-h,2);y>>8*(w?y:1-y)}function c(a,b,h,w){0>b&&(b=4294967295+b+1);for(var y=0,I=Math.min(a.length-h,4);y>>8*(w?y:3-y)&255}function l(a,b,h,w,y,I){if(b>y||ba.length)throw new TypeError("index out of range");}function q(a,b,h,w,y){y||l(a,b,h,4,3.4028234663852886E38,-3.4028234663852886E38);v.write(a,b,h,w,23,4);return h+4}function r(a,
+b,h,w,y){y||l(a,b,h,8,1.7976931348623157E308,-1.7976931348623157E308);v.write(a,b,h,w,52,8);return h+8}function k(a){for(var b=[],h=0;h=w)b.push(w);else{var y=h;55296<=w&&57343>=w&&h++;w=encodeURIComponent(a.slice(y,h+1)).substr(1).split("%");for(y=0;y=b.length||y>=a.length);y++)b[y+
+h]=a[y];return y}function g(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}var n=C("base64-js"),v=C("ieee754"),z=C("is-array");A.Buffer=e;A.SlowBuffer=e;A.INSPECT_MAX_BYTES=50;e.poolSize=8192;var G=1073741823;e.TYPED_ARRAY_SUPPORT=function(){try{var a=new ArrayBuffer(0),b=new Uint8Array(a);b.foo=function(){return 42};return 42===b.foo()&&"function"===typeof b.subarray&&0===(new Uint8Array(1)).subarray(1,1).byteLength}catch(h){return!1}}();e.isBuffer=function(a){return!(null==
+a||!a._isBuffer)};e.compare=function(a,b){if(!e.isBuffer(a)||!e.isBuffer(b))throw new TypeError("Arguments must be Buffers");for(var h=a.length,w=b.length,y=0,I=Math.min(h,w);y>>1;break;case "utf8":case "utf-8":h=k(a).length;break;case "base64":h=n.toByteArray(a).length;
+break;default:h=a.length}return h};e.prototype.length=void 0;e.prototype.parent=void 0;e.prototype.toString=function(a,b,h){var w=!1;b>>>=0;h=void 0===h||Infinity===h?this.length:h>>>0;a||(a="utf8");0>b&&(b=0);h>this.length&&(h=this.length);if(h<=b)return"";for(;;)switch(a){case "hex":a=b;b=h;h=this.length;if(!a||0>a)a=0;if(!b||0>b||b>h)b=h;w="";for(h=a;hw?"0"+w.toString(16):w.toString(16),w=a+w;return w;case "utf8":case "utf-8":w=a="";for(h=Math.min(this.length,h);b=
+this[b]?(a+=g(w)+String.fromCharCode(this[b]),w=""):w+="%"+this[b].toString(16);return a+g(w);case "ascii":return p(this,b,h);case "binary":return p(this,b,h);case "base64":return b=0===b&&h===this.length?n.fromByteArray(this):n.fromByteArray(this.slice(b,h)),b;case "ucs2":case "ucs-2":case "utf16le":case "utf-16le":b=this.slice(b,h);h="";for(a=0;ab&&(a+=" ... "));return""};e.prototype.compare=function(a){if(!e.isBuffer(a))throw new TypeError("Argument must be a Buffer");return e.compare(this,a)};e.prototype.get=function(a){console.log(".get() is deprecated. Access using array indexes instead.");
+return this.readUInt8(a)};e.prototype.set=function(a,b){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(a,b)};e.prototype.write=function(a,b,h,w){if(isFinite(b))isFinite(h)||(w=h,h=void 0);else{var y=w;w=b;b=h;h=y}b=Number(b)||0;y=this.length-b;h?(h=Number(h),h>y&&(h=y)):h=y;w=String(w||"utf8").toLowerCase();switch(w){case "hex":b=Number(b)||0;w=this.length-b;h?(h=Number(h),h>w&&(h=w)):h=w;w=a.length;if(0!==w%2)throw Error("Invalid hex string");h>w/
+2&&(h=w/2);for(w=0;w>8;K%=256;y.push(K);y.push(w)}a=d(y,this,b,h,2);break;default:throw new TypeError("Unknown encoding: "+
+w);}return a};e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};e.prototype.slice=function(a,b){var h=this.length;a=~~a;b=void 0===b?h:~~b;0>a?(a+=h,0>a&&(a=0)):a>h&&(a=h);0>b?(b+=h,0>b&&(b=0)):b>h&&(b=h);b>>=0;h||m(this,a,b,1,255,0);e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));this[b]=a;return b+1};e.prototype.writeUInt16LE=function(a,
+b,h){a=+a;b>>>=0;h||m(this,a,b,2,65535,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):f(this,a,b,!0);return b+2};e.prototype.writeUInt16BE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,2,65535,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):f(this,a,b,!1);return b+2};e.prototype.writeUInt32LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,4294967295,0);e.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=a):c(this,a,b,!0);return b+4};e.prototype.writeUInt32BE=function(a,
+b,h){a=+a;b>>>=0;h||m(this,a,b,4,4294967295,0);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=a):c(this,a,b,!1);return b+4};e.prototype.writeInt8=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,1,127,-128);e.TYPED_ARRAY_SUPPORT||(a=Math.floor(a));0>a&&(a=255+a+1);this[b]=a;return b+1};e.prototype.writeInt16LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,2,32767,-32768);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8):f(this,a,b,!0);return b+2};e.prototype.writeInt16BE=function(a,
+b,h){a=+a;b>>>=0;h||m(this,a,b,2,32767,-32768);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=a):f(this,a,b,!1);return b+2};e.prototype.writeInt32LE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,2147483647,-2147483648);e.TYPED_ARRAY_SUPPORT?(this[b]=a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):c(this,a,b,!0);return b+4};e.prototype.writeInt32BE=function(a,b,h){a=+a;b>>>=0;h||m(this,a,b,4,2147483647,-2147483648);0>a&&(a=4294967295+a+1);e.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+
+2]=a>>>8,this[b+3]=a):c(this,a,b,!1);return b+4};e.prototype.writeFloatLE=function(a,b,h){return q(this,a,b,!0,h)};e.prototype.writeFloatBE=function(a,b,h){return q(this,a,b,!1,h)};e.prototype.writeDoubleLE=function(a,b,h){return r(this,a,b,!0,h)};e.prototype.writeDoubleBE=function(a,b,h){return r(this,a,b,!1,h)};e.prototype.copy=function(a,b,h,w){h||(h=0);w||0===w||(w=this.length);b||(b=0);if(w!==h&&0!==a.length&&0!==this.length){if(wb||b>=a.length)throw new TypeError("targetStart out of bounds");
+if(0>h||h>=this.length)throw new TypeError("sourceStart out of bounds");if(0>w||w>this.length)throw new TypeError("sourceEnd out of bounds");w>this.length&&(w=this.length);a.length-bw||!e.TYPED_ARRAY_SUPPORT)for(var y=0;yb||b>=this.length)throw new TypeError("start out of bounds");
+if(0>h||h>this.length)throw new TypeError("end out of bounds");if("number"===typeof a)for(;b>1,r=-7;f=t?f-1:0;var k=t?-1:1,u=e[p+f];f+=k;t=u&(1<<-r)-1;u>>=-r;for(r+=c;0>=-r;for(r+=m;0>1,u=23===f?Math.pow(2,-24)-Math.pow(2,-77):0;c=m?0:c-1;var d=m?1:-1,g=0>p||0===p&&0>1/p?1:0;p=Math.abs(p);isNaN(p)||Infinity===p?(p=isNaN(p)?1:0,m=r):(m=Math.floor(Math.log(p)/Math.LN2),1>p*(l=Math.pow(2,-m))&&(m--,l*=2),p=1<=m+k?p+u/l:p+u*Math.pow(2,1-k),2<=p*l&&(m++,l/=2),m+k>=r?(p=0,m=r):1<=m+k?(p=(p*l-1)*Math.pow(2,f),m+=k):(p=p*Math.pow(2,k-1)*Math.pow(2,f),m=0));for(;8<=f;e[t+c]=p&255,c+=
+d,p/=256,f-=8);m=m<z?[]:n.slice(v,z-v+1)}c=A.resolve(c).substr(1);l=A.resolve(l).substr(1);
+for(var r=q(c.split("/")),k=q(l.split("/")),u=Math.min(r.length,k.length),d=u,g=0;gl&&(l=c.length+l);return c.substr(l,q)}}).call(this,C("g5I+bs"))},{"g5I+bs":9}],9:[function(C,J,A){function e(){}C=J.exports={};C.nextTick=function(){if("undefined"!==typeof window&&window.setImmediate)return function(t){return window.setImmediate(t)};if("undefined"!==typeof window&&window.postMessage&&window.addEventListener){var p=[];window.addEventListener("message",function(t){var m=t.source;m!==window&&null!==
+m||"process-tick"!==t.data||(t.stopPropagation(),0p?(-p<<1)+1:p<<1;do p=m&31,m>>>=5,0=f)throw Error("Expected more digits in base 64 VLQ value.");var q=e.decode(p.charCodeAt(t++));if(-1===q)throw Error("Invalid base64 digit: "+p.charAt(t-1));var r=!!(q&32);q&=31;c+=q<>1;m.value=1===(c&1)?-p:p;m.rest=t}},{"./base64":12}],12:[function(C,
+J,A){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");A.encode=function(p){if(0<=p&&p=p?p-65:97<=p&&122>=p?p-97+26:48<=p&&57>=p?p-48+52:43==p?62:47==p?63:-1}},{}],13:[function(C,J,A){function e(p,t,m,f,c,l){var q=Math.floor((t-p)/2)+p,r=c(m,f[q],!0);return 0===r?q:0p?-1:p}A.GREATEST_LOWER_BOUND=1;A.LEAST_UPPER_BOUND=2;A.search=function(p,t,m,f){if(0===t.length)return-1;p=e(-1,t.length,p,t,m,f||A.GREATEST_LOWER_BOUND);if(0>p)return-1;for(;0<=p-1&&0===m(t[p],t[p-1],!0);)--p;return p}},{}],14:[function(C,J,A){function e(){this._array=[];this._sorted=!0;this._last={generatedLine:-1,generatedColumn:0}}var p=C("./util");e.prototype.unsortedForEach=function(t,m){this._array.forEach(t,m)};e.prototype.add=function(t){var m=this._last,f=m.generatedLine,
+c=t.generatedLine,l=m.generatedColumn,q=t.generatedColumn;c>f||c==f&&q>=l||0>=p.compareByGeneratedPositionsInflated(m,t)?this._last=t:this._sorted=!1;this._array.push(t)};e.prototype.toArray=function(){this._sorted||(this._array.sort(p.compareByGeneratedPositionsInflated),this._sorted=!0);return this._array};A.MappingList=e},{"./util":19}],15:[function(C,J,A){function e(t,m,f){var c=t[m];t[m]=t[f];t[f]=c}function p(t,m,f,c){if(f=m(t[r],q)&&(l+=1,e(t,l,r));e(t,l+1,r);l+=1;p(t,m,f,l-1);p(t,m,l+1,c)}}A.quickSort=function(t,m){p(t,m,0,t.length-1)}},{}],16:[function(C,J,A){function e(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));return null!=d.sections?new m(d,u):new p(d,u)}function p(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));var g=f.getArg(d,"version"),n=f.getArg(d,"sources"),v=f.getArg(d,"names",[]),z=f.getArg(d,"sourceRoot",null),G=f.getArg(d,"sourcesContent",null),D=f.getArg(d,
+"mappings");d=f.getArg(d,"file",null);if(g!=this._version)throw Error("Unsupported version: "+g);z&&(z=f.normalize(z));n=n.map(String).map(f.normalize).map(function(L){return z&&f.isAbsolute(z)&&f.isAbsolute(L)?f.relative(z,L):L});this._names=l.fromArray(v.map(String),!0);this._sources=l.fromArray(n,!0);this.sourceRoot=z;this.sourcesContent=G;this._mappings=D;this._sourceMapURL=u;this.file=d}function t(){this.generatedColumn=this.generatedLine=0;this.name=this.originalColumn=this.originalLine=this.source=
+null}function m(k,u){var d=k;"string"===typeof k&&(d=f.parseSourceMapInput(k));var g=f.getArg(d,"version");d=f.getArg(d,"sections");if(g!=this._version)throw Error("Unsupported version: "+g);this._sources=new l;this._names=new l;var n={line:-1,column:0};this._sections=d.map(function(v){if(v.url)throw Error("Support for url field in sections not implemented.");var z=f.getArg(v,"offset"),G=f.getArg(z,"line"),D=f.getArg(z,"column");if(G=k[d])throw new TypeError("Line must be greater than or equal to 1, got "+
+k[d]);if(0>k[g])throw new TypeError("Column must be greater than or equal to 0, got "+k[g]);return c.search(k,u,n,v)};p.prototype.computeColumnSpans=function(){for(var k=0;k=this._sources.size()&&!this.sourcesContent.some(function(k){return null==k}):!1};p.prototype.sourceContentFor=function(k,u){if(!this.sourcesContent)return null;var d=k;null!=this.sourceRoot&&(d=f.relative(this.sourceRoot,d));if(this._sources.has(d))return this.sourcesContent[this._sources.indexOf(d)];
+var g=this.sources,n;for(n=0;n
+g||95!==d.charCodeAt(g-1)||95!==d.charCodeAt(g-2)||111!==d.charCodeAt(g-3)||116!==d.charCodeAt(g-4)||111!==d.charCodeAt(g-5)||114!==d.charCodeAt(g-6)||112!==d.charCodeAt(g-7)||95!==d.charCodeAt(g-8)||95!==d.charCodeAt(g-9))return!1;for(g-=10;0<=g;g--)if(36!==d.charCodeAt(g))return!1;return!0}function r(d,g){return d===g?0:null===d?1:null===g?-1:d>g?1:-1}A.getArg=function(d,g,n){if(g in d)return d[g];if(3===arguments.length)return n;throw Error('"'+g+'" is a required argument.');};var k=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,
+u=/^data:.+,.+$/;A.urlParse=e;A.urlGenerate=p;A.normalize=t;A.join=m;A.isAbsolute=function(d){return"/"===d.charAt(0)||k.test(d)};A.relative=function(d,g){""===d&&(d=".");d=d.replace(/\/$/,"");for(var n=0;0!==g.indexOf(d+"/");){var v=d.lastIndexOf("/");if(0>v)return g;d=d.slice(0,v);if(d.match(/^([^\/]+:\/)?\/*$/))return g;++n}return Array(n+1).join("../")+g.substr(d.length+1)};C=!("__proto__"in Object.create(null));A.toSetString=C?f:c;A.fromSetString=C?f:l;A.compareByOriginalPositions=function(d,
+g,n){var v=r(d.source,g.source);if(0!==v)return v;v=d.originalLine-g.originalLine;if(0!==v)return v;v=d.originalColumn-g.originalColumn;if(0!==v||n)return v;v=d.generatedColumn-g.generatedColumn;if(0!==v)return v;v=d.generatedLine-g.generatedLine;return 0!==v?v:r(d.name,g.name)};A.compareByGeneratedPositionsDeflated=function(d,g,n){var v=d.generatedLine-g.generatedLine;if(0!==v)return v;v=d.generatedColumn-g.generatedColumn;if(0!==v||n)return v;v=r(d.source,g.source);if(0!==v)return v;v=d.originalLine-
+g.originalLine;if(0!==v)return v;v=d.originalColumn-g.originalColumn;return 0!==v?v:r(d.name,g.name)};A.compareByGeneratedPositionsInflated=function(d,g){var n=d.generatedLine-g.generatedLine;if(0!==n)return n;n=d.generatedColumn-g.generatedColumn;if(0!==n)return n;n=r(d.source,g.source);if(0!==n)return n;n=d.originalLine-g.originalLine;if(0!==n)return n;n=d.originalColumn-g.originalColumn;return 0!==n?n:r(d.name,g.name)};A.parseSourceMapInput=function(d){return JSON.parse(d.replace(/^\)]}'[^\n]*\n/,
+""))};A.computeSourceURL=function(d,g,n){g=g||"";d&&("/"!==d[d.length-1]&&"/"!==g[0]&&(d+="/"),g=d+g);if(n){d=e(n);if(!d)throw Error("sourceMapURL could not be parsed");d.path&&(n=d.path.lastIndexOf("/"),0<=n&&(d.path=d.path.substring(0,n+1)));g=m(p(d),g)}return t(g)}},{}],20:[function(C,J,A){A.SourceMapGenerator=C("./lib/source-map-generator").SourceMapGenerator;A.SourceMapConsumer=C("./lib/source-map-consumer").SourceMapConsumer;A.SourceNode=C("./lib/source-node").SourceNode},{"./lib/source-map-consumer":16,
+"./lib/source-map-generator":17,"./lib/source-node":18}],21:[function(C,J,A){(function(e){function p(){return"browser"===a?!0:"node"===a?!1:"undefined"!==typeof window&&"function"===typeof XMLHttpRequest&&!(window.require&&window.module&&window.process&&"renderer"===window.process.type)}function t(x){return function(B){for(var F=0;F";B=this.getLineNumber();null!=B&&(x+=":"+B,(B=
+this.getColumnNumber())&&(x+=":"+B))}B="";var F=this.getFunctionName(),E=!0,H=this.isConstructor();if(this.isToplevel()||H)H?B+="new "+(F||""):F?B+=F:(B+=x,E=!1);else{H=this.getTypeName();"[object Object]"===H&&(H="null");var M=this.getMethodName();F?(H&&0!=F.indexOf(H)&&(B+=H+"."),B+=F,M&&F.indexOf("."+M)!=F.length-M.length-1&&(B+=" [as "+M+"]")):B+=H+"."+(M||"")}E&&(B+=" ("+x+")");return B}function q(x){var B={};Object.getOwnPropertyNames(Object.getPrototypeOf(x)).forEach(function(F){B[F]=
+/^(?:is|get)/.test(F)?function(){return x[F].call(x)}:x[F]});B.toString=l;return B}function r(x,B){void 0===B&&(B={nextPosition:null,curPosition:null});if(x.isNative())return B.curPosition=null,x;var F=x.getFileName()||x.getScriptNameOrSourceURL();if(F){var E=x.getLineNumber(),H=x.getColumnNumber()-1,M=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,S=M.test;var V="object"===typeof e&&null!==e?e.version:"";M=S.call(M,V)?0:62;1===E&&H>M&&!p()&&!x.isEval()&&(H-=M);var O=
+f({source:F,line:E,column:H});B.curPosition=O;x=q(x);var T=x.getFunctionName;x.getFunctionName=function(){return null==B.nextPosition?T():B.nextPosition.name||T()};x.getFileName=function(){return O.source};x.getLineNumber=function(){return O.line};x.getColumnNumber=function(){return O.column+1};x.getScriptNameOrSourceURL=function(){return O.source};return x}var Q=x.isEval()&&x.getEvalOrigin();Q&&(Q=c(Q),x=q(x),x.getEvalOrigin=function(){return Q});return x}function k(x,B){L&&(b={},h={});for(var F=
+(x.name||"Error")+": "+(x.message||""),E={nextPosition:null,curPosition:null},H=[],M=B.length-1;0<=M;M--)H.push("\n at "+r(B[M],E)),E.nextPosition=E.curPosition;E.curPosition=E.nextPosition=null;return F+H.reverse().join("")}function u(x){var B=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(x.stack);if(B){x=B[1];var F=+B[2];B=+B[3];var E=b[x];if(!E&&v&&v.existsSync(x))try{E=v.readFileSync(x,"utf8")}catch(H){E=""}if(E&&(E=E.split(/(?:\r\n|\r|\n)/)[F-1]))return x+":"+F+"\n"+E+"\n"+Array(B).join(" ")+
+"^"}return null}function d(){var x=e.emit;e.emit=function(B){if("uncaughtException"===B){var F=arguments[1]&&arguments[1].stack,E=0 C:/dir/file
+ '/'; // file:///root-dir/file -> /root-dir/file
+ });
+ }
+ if (path in fileContentsCache) {
+ return fileContentsCache[path];
+ }
+
+ var contents = '';
+ try {
+ if (!fs) {
+ // Use SJAX if we are in the browser
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', path, /** async */ false);
+ xhr.send(null);
+ if (xhr.readyState === 4 && xhr.status === 200) {
+ contents = xhr.responseText;
+ }
+ } else if (fs.existsSync(path)) {
+ // Otherwise, use the filesystem
+ contents = fs.readFileSync(path, 'utf8');
+ }
+ } catch (er) {
+ /* ignore any errors */
+ }
+
+ return fileContentsCache[path] = contents;
+});
+
+// Support URLs relative to a directory, but be careful about a protocol prefix
+// in case we are in the browser (i.e. directories may start with "http://" or "file:///")
+function supportRelativeURL(file, url) {
+ if (!file) return url;
+ var dir = path.dirname(file);
+ var match = /^\w+:\/\/[^\/]*/.exec(dir);
+ var protocol = match ? match[0] : '';
+ var startPath = dir.slice(protocol.length);
+ if (protocol && /^\/\w\:/.test(startPath)) {
+ // handle file:///C:/ paths
+ protocol += '/';
+ return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, '/');
+ }
+ return protocol + path.resolve(dir.slice(protocol.length), url);
+}
+
+function retrieveSourceMapURL(source) {
+ var fileData;
+
+ if (isInBrowser()) {
+ try {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', source, false);
+ xhr.send(null);
+ fileData = xhr.readyState === 4 ? xhr.responseText : null;
+
+ // Support providing a sourceMappingURL via the SourceMap header
+ var sourceMapHeader = xhr.getResponseHeader("SourceMap") ||
+ xhr.getResponseHeader("X-SourceMap");
+ if (sourceMapHeader) {
+ return sourceMapHeader;
+ }
+ } catch (e) {
+ }
+ }
+
+ // Get the URL of the source map
+ fileData = retrieveFile(source);
+ var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
+ // Keep executing the search to find the *last* sourceMappingURL to avoid
+ // picking up sourceMappingURLs from comments, strings, etc.
+ var lastMatch, match;
+ while (match = re.exec(fileData)) lastMatch = match;
+ if (!lastMatch) return null;
+ return lastMatch[1];
+};
+
+// Can be overridden by the retrieveSourceMap option to install. Takes a
+// generated source filename; returns a {map, optional url} object, or null if
+// there is no source map. The map field may be either a string or the parsed
+// JSON object (ie, it must be a valid argument to the SourceMapConsumer
+// constructor).
+var retrieveSourceMap = handlerExec(retrieveMapHandlers);
+retrieveMapHandlers.push(function(source) {
+ var sourceMappingURL = retrieveSourceMapURL(source);
+ if (!sourceMappingURL) return null;
+
+ // Read the contents of the source map
+ var sourceMapData;
+ if (reSourceMap.test(sourceMappingURL)) {
+ // Support source map URL as a data url
+ var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1);
+ sourceMapData = bufferFrom(rawData, "base64").toString();
+ sourceMappingURL = source;
+ } else {
+ // Support source map URLs relative to the source URL
+ sourceMappingURL = supportRelativeURL(source, sourceMappingURL);
+ sourceMapData = retrieveFile(sourceMappingURL);
+ }
+
+ if (!sourceMapData) {
+ return null;
+ }
+
+ return {
+ url: sourceMappingURL,
+ map: sourceMapData
+ };
+});
+
+function mapSourcePosition(position) {
+ var sourceMap = sourceMapCache[position.source];
+ if (!sourceMap) {
+ // Call the (overrideable) retrieveSourceMap function to get the source map.
+ var urlAndMap = retrieveSourceMap(position.source);
+ if (urlAndMap) {
+ sourceMap = sourceMapCache[position.source] = {
+ url: urlAndMap.url,
+ map: new SourceMapConsumer(urlAndMap.map)
+ };
+
+ // Load all sources stored inline with the source map into the file cache
+ // to pretend like they are already loaded. They may not exist on disk.
+ if (sourceMap.map.sourcesContent) {
+ sourceMap.map.sources.forEach(function(source, i) {
+ var contents = sourceMap.map.sourcesContent[i];
+ if (contents) {
+ var url = supportRelativeURL(sourceMap.url, source);
+ fileContentsCache[url] = contents;
+ }
+ });
+ }
+ } else {
+ sourceMap = sourceMapCache[position.source] = {
+ url: null,
+ map: null
+ };
+ }
+ }
+
+ // Resolve the source URL relative to the URL of the source map
+ if (sourceMap && sourceMap.map && typeof sourceMap.map.originalPositionFor === 'function') {
+ var originalPosition = sourceMap.map.originalPositionFor(position);
+
+ // Only return the original position if a matching line was found. If no
+ // matching line is found then we return position instead, which will cause
+ // the stack trace to print the path and line for the compiled file. It is
+ // better to give a precise location in the compiled file than a vague
+ // location in the original file.
+ if (originalPosition.source !== null) {
+ originalPosition.source = supportRelativeURL(
+ sourceMap.url, originalPosition.source);
+ return originalPosition;
+ }
+ }
+
+ return position;
+}
+
+// Parses code generated by FormatEvalOrigin(), a function inside V8:
+// https://code.google.com/p/v8/source/browse/trunk/src/messages.js
+function mapEvalOrigin(origin) {
+ // Most eval() calls are in this format
+ var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin);
+ if (match) {
+ var position = mapSourcePosition({
+ source: match[2],
+ line: +match[3],
+ column: match[4] - 1
+ });
+ return 'eval at ' + match[1] + ' (' + position.source + ':' +
+ position.line + ':' + (position.column + 1) + ')';
+ }
+
+ // Parse nested eval() calls using recursion
+ match = /^eval at ([^(]+) \((.+)\)$/.exec(origin);
+ if (match) {
+ return 'eval at ' + match[1] + ' (' + mapEvalOrigin(match[2]) + ')';
+ }
+
+ // Make sure we still return useful information if we didn't find anything
+ return origin;
+}
+
+// This is copied almost verbatim from the V8 source code at
+// https://code.google.com/p/v8/source/browse/trunk/src/messages.js. The
+// implementation of wrapCallSite() used to just forward to the actual source
+// code of CallSite.prototype.toString but unfortunately a new release of V8
+// did something to the prototype chain and broke the shim. The only fix I
+// could find was copy/paste.
+function CallSiteToString() {
+ var fileName;
+ var fileLocation = "";
+ if (this.isNative()) {
+ fileLocation = "native";
+ } else {
+ fileName = this.getScriptNameOrSourceURL();
+ if (!fileName && this.isEval()) {
+ fileLocation = this.getEvalOrigin();
+ fileLocation += ", "; // Expecting source position to follow.
+ }
+
+ if (fileName) {
+ fileLocation += fileName;
+ } else {
+ // Source code does not originate from a file and is not native, but we
+ // can still get the source position inside the source string, e.g. in
+ // an eval string.
+ fileLocation += "";
+ }
+ var lineNumber = this.getLineNumber();
+ if (lineNumber != null) {
+ fileLocation += ":" + lineNumber;
+ var columnNumber = this.getColumnNumber();
+ if (columnNumber) {
+ fileLocation += ":" + columnNumber;
+ }
+ }
+ }
+
+ var line = "";
+ var functionName = this.getFunctionName();
+ var addSuffix = true;
+ var isConstructor = this.isConstructor();
+ var isMethodCall = !(this.isToplevel() || isConstructor);
+ if (isMethodCall) {
+ var typeName = this.getTypeName();
+ // Fixes shim to be backward compatable with Node v0 to v4
+ if (typeName === "[object Object]") {
+ typeName = "null";
+ }
+ var methodName = this.getMethodName();
+ if (functionName) {
+ if (typeName && functionName.indexOf(typeName) != 0) {
+ line += typeName + ".";
+ }
+ line += functionName;
+ if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) {
+ line += " [as " + methodName + "]";
+ }
+ } else {
+ line += typeName + "." + (methodName || "");
+ }
+ } else if (isConstructor) {
+ line += "new " + (functionName || "");
+ } else if (functionName) {
+ line += functionName;
+ } else {
+ line += fileLocation;
+ addSuffix = false;
+ }
+ if (addSuffix) {
+ line += " (" + fileLocation + ")";
+ }
+ return line;
+}
+
+function cloneCallSite(frame) {
+ var object = {};
+ Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {
+ object[name] = /^(?:is|get)/.test(name) ? function() { return frame[name].call(frame); } : frame[name];
+ });
+ object.toString = CallSiteToString;
+ return object;
+}
+
+function wrapCallSite(frame, state) {
+ // provides interface backward compatibility
+ if (state === undefined) {
+ state = { nextPosition: null, curPosition: null }
+ }
+ if(frame.isNative()) {
+ state.curPosition = null;
+ return frame;
+ }
+
+ // Most call sites will return the source file from getFileName(), but code
+ // passed to eval() ending in "//# sourceURL=..." will return the source file
+ // from getScriptNameOrSourceURL() instead
+ var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
+ if (source) {
+ var line = frame.getLineNumber();
+ var column = frame.getColumnNumber() - 1;
+
+ // Fix position in Node where some (internal) code is prepended.
+ // See https://github.com/evanw/node-source-map-support/issues/36
+ // Header removed in node at ^10.16 || >=11.11.0
+ // v11 is not an LTS candidate, we can just test the one version with it.
+ // Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11
+ var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
+ var headerLength = noHeader.test(globalProcessVersion()) ? 0 : 62;
+ if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
+ column -= headerLength;
+ }
+
+ var position = mapSourcePosition({
+ source: source,
+ line: line,
+ column: column
+ });
+ state.curPosition = position;
+ frame = cloneCallSite(frame);
+ var originalFunctionName = frame.getFunctionName;
+ frame.getFunctionName = function() {
+ if (state.nextPosition == null) {
+ return originalFunctionName();
+ }
+ return state.nextPosition.name || originalFunctionName();
+ };
+ frame.getFileName = function() { return position.source; };
+ frame.getLineNumber = function() { return position.line; };
+ frame.getColumnNumber = function() { return position.column + 1; };
+ frame.getScriptNameOrSourceURL = function() { return position.source; };
+ return frame;
+ }
+
+ // Code called using eval() needs special handling
+ var origin = frame.isEval() && frame.getEvalOrigin();
+ if (origin) {
+ origin = mapEvalOrigin(origin);
+ frame = cloneCallSite(frame);
+ frame.getEvalOrigin = function() { return origin; };
+ return frame;
+ }
+
+ // If we get here then we were unable to change the source position
+ return frame;
+}
+
+// This function is part of the V8 stack trace API, for more info see:
+// https://v8.dev/docs/stack-trace-api
+function prepareStackTrace(error, stack) {
+ if (emptyCacheBetweenOperations) {
+ fileContentsCache = {};
+ sourceMapCache = {};
+ }
+
+ var name = error.name || 'Error';
+ var message = error.message || '';
+ var errorString = name + ": " + message;
+
+ var state = { nextPosition: null, curPosition: null };
+ var processedStack = [];
+ for (var i = stack.length - 1; i >= 0; i--) {
+ processedStack.push('\n at ' + wrapCallSite(stack[i], state));
+ state.nextPosition = state.curPosition;
+ }
+ state.curPosition = state.nextPosition = null;
+ return errorString + processedStack.reverse().join('');
+}
+
+// Generate position and snippet of original source with pointer
+function getErrorSource(error) {
+ var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
+ if (match) {
+ var source = match[1];
+ var line = +match[2];
+ var column = +match[3];
+
+ // Support the inline sourceContents inside the source map
+ var contents = fileContentsCache[source];
+
+ // Support files on disk
+ if (!contents && fs && fs.existsSync(source)) {
+ try {
+ contents = fs.readFileSync(source, 'utf8');
+ } catch (er) {
+ contents = '';
+ }
+ }
+
+ // Format the line from the original source code like node does
+ if (contents) {
+ var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1];
+ if (code) {
+ return source + ':' + line + '\n' + code + '\n' +
+ new Array(column).join(' ') + '^';
+ }
+ }
+ }
+ return null;
+}
+
+function printErrorAndExit (error) {
+ var source = getErrorSource(error);
+
+ // Ensure error is printed synchronously and not truncated
+ var stderr = globalProcessStderr();
+ if (stderr && stderr._handle && stderr._handle.setBlocking) {
+ stderr._handle.setBlocking(true);
+ }
+
+ if (source) {
+ console.error();
+ console.error(source);
+ }
+
+ console.error(error.stack);
+ globalProcessExit(1);
+}
+
+function shimEmitUncaughtException () {
+ var origEmit = process.emit;
+
+ process.emit = function (type) {
+ if (type === 'uncaughtException') {
+ var hasStack = (arguments[1] && arguments[1].stack);
+ var hasListeners = (this.listeners(type).length > 0);
+
+ if (hasStack && !hasListeners) {
+ return printErrorAndExit(arguments[1]);
+ }
+ }
+
+ return origEmit.apply(this, arguments);
+ };
+}
+
+var originalRetrieveFileHandlers = retrieveFileHandlers.slice(0);
+var originalRetrieveMapHandlers = retrieveMapHandlers.slice(0);
+
+exports.wrapCallSite = wrapCallSite;
+exports.getErrorSource = getErrorSource;
+exports.mapSourcePosition = mapSourcePosition;
+exports.retrieveSourceMap = retrieveSourceMap;
+
+exports.install = function(options) {
+ options = options || {};
+
+ if (options.environment) {
+ environment = options.environment;
+ if (["node", "browser", "auto"].indexOf(environment) === -1) {
+ throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}")
+ }
+ }
+
+ // Allow sources to be found by methods other than reading the files
+ // directly from disk.
+ if (options.retrieveFile) {
+ if (options.overrideRetrieveFile) {
+ retrieveFileHandlers.length = 0;
+ }
+
+ retrieveFileHandlers.unshift(options.retrieveFile);
+ }
+
+ // Allow source maps to be found by methods other than reading the files
+ // directly from disk.
+ if (options.retrieveSourceMap) {
+ if (options.overrideRetrieveSourceMap) {
+ retrieveMapHandlers.length = 0;
+ }
+
+ retrieveMapHandlers.unshift(options.retrieveSourceMap);
+ }
+
+ // Support runtime transpilers that include inline source maps
+ if (options.hookRequire && !isInBrowser()) {
+ // Use dynamicRequire to avoid including in browser bundles
+ var Module = dynamicRequire(module, 'module');
+ var $compile = Module.prototype._compile;
+
+ if (!$compile.__sourceMapSupport) {
+ Module.prototype._compile = function(content, filename) {
+ fileContentsCache[filename] = content;
+ sourceMapCache[filename] = undefined;
+ return $compile.call(this, content, filename);
+ };
+
+ Module.prototype._compile.__sourceMapSupport = true;
+ }
+ }
+
+ // Configure options
+ if (!emptyCacheBetweenOperations) {
+ emptyCacheBetweenOperations = 'emptyCacheBetweenOperations' in options ?
+ options.emptyCacheBetweenOperations : false;
+ }
+
+ // Install the error reformatter
+ if (!errorFormatterInstalled) {
+ errorFormatterInstalled = true;
+ Error.prepareStackTrace = prepareStackTrace;
+ }
+
+ if (!uncaughtShimInstalled) {
+ var installHandler = 'handleUncaughtExceptions' in options ?
+ options.handleUncaughtExceptions : true;
+
+ // Do not override 'uncaughtException' with our own handler in Node.js
+ // Worker threads. Workers pass the error to the main thread as an event,
+ // rather than printing something to stderr and exiting.
+ try {
+ // We need to use `dynamicRequire` because `require` on it's own will be optimized by WebPack/Browserify.
+ var worker_threads = dynamicRequire(module, 'worker_threads');
+ if (worker_threads.isMainThread === false) {
+ installHandler = false;
+ }
+ } catch(e) {}
+
+ // Provide the option to not install the uncaught exception handler. This is
+ // to support other uncaught exception handlers (in test frameworks, for
+ // example). If this handler is not installed and there are no other uncaught
+ // exception handlers, uncaught exceptions will be caught by node's built-in
+ // exception handler and the process will still be terminated. However, the
+ // generated JavaScript code will be shown above the stack trace instead of
+ // the original source code.
+ if (installHandler && hasGlobalProcessEventEmitter()) {
+ uncaughtShimInstalled = true;
+ shimEmitUncaughtException();
+ }
+ }
+};
+
+exports.resetRetrieveHandlers = function() {
+ retrieveFileHandlers.length = 0;
+ retrieveMapHandlers.length = 0;
+
+ retrieveFileHandlers = originalRetrieveFileHandlers.slice(0);
+ retrieveMapHandlers = originalRetrieveMapHandlers.slice(0);
+
+ retrieveSourceMap = handlerExec(retrieveMapHandlers);
+ retrieveFile = handlerExec(retrieveFileHandlers);
+}
diff --git a/node_modules/stackback/.npmignore b/node_modules/stackback/.npmignore
new file mode 100644
index 0000000000000000000000000000000000000000..3c3629e647f5ddf82548912e337bea9826b434af
--- /dev/null
+++ b/node_modules/stackback/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/stackback/.travis.yml b/node_modules/stackback/.travis.yml
new file mode 100644
index 0000000000000000000000000000000000000000..320698af0f565b2ac32987b5d23ed6aca5c7ef5a
--- /dev/null
+++ b/node_modules/stackback/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - 0.6
+ - 0.8
diff --git a/node_modules/stackback/README.md b/node_modules/stackback/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..fb6bde7486827b31d96cd2bfc1f96fd945bbf011
--- /dev/null
+++ b/node_modules/stackback/README.md
@@ -0,0 +1,41 @@
+# stackback
+
+Returns an array of CallSite objects for a captured stacktrace. Useful if you want to access the frame for an error object.
+
+## use
+
+```javascript
+var stackback = require('stackback');
+
+// error generated from somewhere
+var err = new Error('some sample error');
+
+// stack is an array of CallSite objects
+var stack = stackback(err);
+```
+
+## CallSite object
+
+From the [V8 StackTrace API](https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi)
+
+The structured stack trace is an Array of CallSite objects, each of which represents a stack frame. A CallSite object defines the following methods
+
+getThis: returns the value of this
+getTypeName: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property.
+getFunction: returns the current function
+getFunctionName: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context.
+getMethodName: returns the name of the property of this or one of its prototypes that holds the current function
+getFileName: if this function was defined in a script returns the name of the script
+getLineNumber: if this function was defined in a script returns the current line number
+getColumnNumber: if this function was defined in a script returns the current column number
+getEvalOrigin: if this function was created using a call to eval returns a CallSite object representing the location where eval was called
+isToplevel: is this a toplevel invocation, that is, is this the global object?
+isEval: does this call take place in code defined by a call to eval?
+isNative: is this call in native V8 code?
+isConstructor: is this a constructor call?
+
+## install
+
+```shell
+npm install stackback
+```
diff --git a/node_modules/stackback/formatstack.js b/node_modules/stackback/formatstack.js
new file mode 100644
index 0000000000000000000000000000000000000000..d64307d210dd134dff936607480695b86f3b6776
--- /dev/null
+++ b/node_modules/stackback/formatstack.js
@@ -0,0 +1,57 @@
+// Copyright 2012 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * 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 of Google Inc. 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
+// OWNER 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.
+
+function FormatStackTrace(error, frames) {
+ var lines = [];
+ try {
+ lines.push(error.toString());
+ } catch (e) {
+ try {
+ lines.push("");
+ } catch (ee) {
+ lines.push("");
+ }
+ }
+ for (var i = 0; i < frames.length; i++) {
+ var frame = frames[i];
+ var line;
+ try {
+ line = frame.toString();
+ } catch (e) {
+ try {
+ line = "";
+ } catch (ee) {
+ // Any code that reaches this point is seriously nasty!
+ line = "";
+ }
+ }
+ lines.push(" at " + line);
+ }
+ return lines.join("\n");
+}
+
+module.exports = FormatStackTrace;
diff --git a/node_modules/stackback/index.js b/node_modules/stackback/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..8b87042343d7e6fc238075138f72f4ff3fa58d5e
--- /dev/null
+++ b/node_modules/stackback/index.js
@@ -0,0 +1,46 @@
+
+// v8 builtin format stack trace
+// for when there was no previous prepareStackTrace function to call
+var FormatStackTrace = require('./formatstack');
+
+// some notes on the behavior below:
+// because the 'stack' member is a one shot access variable (the raw stack is
+// formatted on accessing it)
+// we try to avoid modifying what the user would have wanted
+// thus we use the previous value for prepareStackTrace
+//
+// The reason we store the callsite variable is because prepareStackTrace
+// will not be called again once it has been called for a given error object
+// but we want to support getting the stack out of the error multiple times (cause why not)
+module.exports = function(err) {
+
+ // save original stacktrace
+ var save = Error.prepareStackTrace;
+
+ // replace capture with our function
+ Error.prepareStackTrace = function(err, trace) {
+
+ // cache stack frames so we don't have to get them again
+ // use a non-enumerable property
+ Object.defineProperty(err, '_sb_callsites', {
+ value: trace
+ });
+
+ return (save || FormatStackTrace)(err, trace);
+ };
+
+ // force capture of the stack frames
+ err.stack;
+
+ // someone already asked for the stack so we can't do this trick
+ // TODO fallback to string parsing?
+ if (!err._sb_callsites) {
+ return [];
+ }
+
+ // return original capture function
+ Error.prepareStackTrace = save;
+
+ return err._sb_callsites;
+};
+
diff --git a/node_modules/stackback/package.json b/node_modules/stackback/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..3e8b7b2c023d3535e0869b0959616cda4d654fc8
--- /dev/null
+++ b/node_modules/stackback/package.json
@@ -0,0 +1,23 @@
+{
+ "name": "stackback",
+ "version": "0.0.2",
+ "description": "return list of CallSite objects from a captured stacktrace",
+ "main": "index.js",
+ "scripts": {
+ "test": "mocha --ui qunit"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/shtylman/node-stackback.git"
+ },
+ "keywords": [
+ "stacktrace",
+ "trace",
+ "stack"
+ ],
+ "devDependencies": {
+ "mocha": "~1.6.0"
+ },
+ "author": "Roman Shtylman ",
+ "license": "MIT"
+}
diff --git a/node_modules/stackback/test.js b/node_modules/stackback/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..212b414ab496cf76d2a6977bd935ce714508482f
--- /dev/null
+++ b/node_modules/stackback/test.js
@@ -0,0 +1,24 @@
+var assert = require('assert');
+var stackback = require('./');
+
+test('capture', function() {
+ var err = new Error();
+ var stack = stackback(err);
+ assert.equal(stack[0].getFileName(), __filename);
+});
+
+// calling stackback on the same error twice should work
+test('multiple calls', function() {
+ var err = new Error();
+ var stack1 = stackback(err);
+ var stack2 = stackback(err);
+ assert.equal(stack1[0].getFileName(), __filename);
+ assert.deepEqual(stack1, stack2);
+});
+
+test('string', function() {
+ var err = new Error();
+ stackback(err);
+ assert.equal(typeof err.stack, 'string');
+});
+
diff --git a/node_modules/statuses/HISTORY.md b/node_modules/statuses/HISTORY.md
new file mode 100644
index 0000000000000000000000000000000000000000..dc549b8216582796d92fb78868317155cc6d1044
--- /dev/null
+++ b/node_modules/statuses/HISTORY.md
@@ -0,0 +1,87 @@
+2.0.2 / 2025-06-06
+==================
+
+ * Migrate to `String.prototype.slice()`
+
+2.0.1 / 2021-01-03
+==================
+
+ * Fix returning values from `Object.prototype`
+
+2.0.0 / 2020-04-19
+==================
+
+ * Drop support for Node.js 0.6
+ * Fix messaging casing of `418 I'm a Teapot`
+ * Remove code 306
+ * Remove `status[code]` exports; use `status.message[code]`
+ * Remove `status[msg]` exports; use `status.code[msg]`
+ * Rename `425 Unordered Collection` to standard `425 Too Early`
+ * Rename `STATUS_CODES` export to `message`
+ * Return status message for `statuses(code)` when given code
+
+1.5.0 / 2018-03-27
+==================
+
+ * Add `103 Early Hints`
+
+1.4.0 / 2017-10-20
+==================
+
+ * Add `STATUS_CODES` export
+
+1.3.1 / 2016-11-11
+==================
+
+ * Fix return type in JSDoc
+
+1.3.0 / 2016-05-17
+==================
+
+ * Add `421 Misdirected Request`
+ * perf: enable strict mode
+
+1.2.1 / 2015-02-01
+==================
+
+ * Fix message for status 451
+ - `451 Unavailable For Legal Reasons`
+
+1.2.0 / 2014-09-28
+==================
+
+ * Add `208 Already Repored`
+ * Add `226 IM Used`
+ * Add `306 (Unused)`
+ * Add `415 Unable For Legal Reasons`
+ * Add `508 Loop Detected`
+
+1.1.1 / 2014-09-24
+==================
+
+ * Add missing 308 to `codes.json`
+
+1.1.0 / 2014-09-21
+==================
+
+ * Add `codes.json` for universal support
+
+1.0.4 / 2014-08-20
+==================
+
+ * Package cleanup
+
+1.0.3 / 2014-06-08
+==================
+
+ * Add 308 to `.redirect` category
+
+1.0.2 / 2014-03-13
+==================
+
+ * Add `.retry` category
+
+1.0.1 / 2014-03-12
+==================
+
+ * Initial release
diff --git a/node_modules/statuses/LICENSE b/node_modules/statuses/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..28a31618205d7dbeed5b966fe9d2c682bd9367f5
--- /dev/null
+++ b/node_modules/statuses/LICENSE
@@ -0,0 +1,23 @@
+
+The MIT License (MIT)
+
+Copyright (c) 2014 Jonathan Ong
+Copyright (c) 2016 Douglas Christopher Wilson
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/statuses/README.md b/node_modules/statuses/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..89d542f6a4022fa409b0c38875c1c15991081a23
--- /dev/null
+++ b/node_modules/statuses/README.md
@@ -0,0 +1,139 @@
+# statuses
+
+[![NPM Version][npm-version-image]][npm-url]
+[![NPM Downloads][npm-downloads-image]][npm-url]
+[![Node.js Version][node-version-image]][node-version-url]
+[![Build Status][ci-image]][ci-url]
+[![Test Coverage][coveralls-image]][coveralls-url]
+[![OpenSSF Scorecard Badge][ossf-scorecard-badge]][ossf-scorecard-visualizer]
+
+HTTP status utility for node.
+
+This module provides a list of status codes and messages sourced from
+a few different projects:
+
+ * The [IANA Status Code Registry](https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml)
+ * The [Node.js project](https://nodejs.org/)
+ * The [NGINX project](https://www.nginx.com/)
+ * The [Apache HTTP Server project](https://httpd.apache.org/)
+
+## Installation
+
+This is a [Node.js](https://nodejs.org/en/) module available through the
+[npm registry](https://www.npmjs.com/). Installation is done using the
+[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
+
+```sh
+$ npm install statuses
+```
+
+## API
+
+
+
+```js
+var status = require('statuses')
+```
+
+### status(code)
+
+Returns the status message string for a known HTTP status code. The code
+may be a number or a string. An error is thrown for an unknown status code.
+
+
+
+```js
+status(403) // => 'Forbidden'
+status('403') // => 'Forbidden'
+status(306) // throws
+```
+
+### status(msg)
+
+Returns the numeric status code for a known HTTP status message. The message
+is case-insensitive. An error is thrown for an unknown status message.
+
+
+
+```js
+status('forbidden') // => 403
+status('Forbidden') // => 403
+status('foo') // throws
+```
+
+### status.codes
+
+Returns an array of all the status codes as `Integer`s.
+
+### status.code[msg]
+
+Returns the numeric status code for a known status message (in lower-case),
+otherwise `undefined`.
+
+
+
+```js
+status['not found'] // => 404
+```
+
+### status.empty[code]
+
+Returns `true` if a status code expects an empty body.
+
+
+
+```js
+status.empty[200] // => undefined
+status.empty[204] // => true
+status.empty[304] // => true
+```
+
+### status.message[code]
+
+Returns the string message for a known numeric status code, otherwise
+`undefined`. This object is the same format as the
+[Node.js http module `http.STATUS_CODES`](https://nodejs.org/dist/latest/docs/api/http.html#http_http_status_codes).
+
+
+
+```js
+status.message[404] // => 'Not Found'
+```
+
+### status.redirect[code]
+
+Returns `true` if a status code is a valid redirect status.
+
+
+
+```js
+status.redirect[200] // => undefined
+status.redirect[301] // => true
+```
+
+### status.retry[code]
+
+Returns `true` if you should retry the rest.
+
+
+
+```js
+status.retry[501] // => undefined
+status.retry[503] // => true
+```
+
+## License
+
+[MIT](LICENSE)
+
+[ci-image]: https://badgen.net/github/checks/jshttp/statuses/master?label=ci
+[ci-url]: https://github.com/jshttp/statuses/actions?query=workflow%3Aci
+[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/statuses/master
+[coveralls-url]: https://coveralls.io/r/jshttp/statuses?branch=master
+[node-version-image]: https://badgen.net/npm/node/statuses
+[node-version-url]: https://nodejs.org/en/download
+[npm-downloads-image]: https://badgen.net/npm/dm/statuses
+[npm-url]: https://npmjs.org/package/statuses
+[npm-version-image]: https://badgen.net/npm/v/statuses
+[ossf-scorecard-badge]: https://api.securityscorecards.dev/projects/github.com/jshttp/statuses/badge
+[ossf-scorecard-visualizer]: https://kooltheba.github.io/openssf-scorecard-api-visualizer/#/projects/github.com/jshttp/statuses
diff --git a/node_modules/statuses/codes.json b/node_modules/statuses/codes.json
new file mode 100644
index 0000000000000000000000000000000000000000..1333ed10bab28344b55c217d80ce4f6cc2555793
--- /dev/null
+++ b/node_modules/statuses/codes.json
@@ -0,0 +1,65 @@
+{
+ "100": "Continue",
+ "101": "Switching Protocols",
+ "102": "Processing",
+ "103": "Early Hints",
+ "200": "OK",
+ "201": "Created",
+ "202": "Accepted",
+ "203": "Non-Authoritative Information",
+ "204": "No Content",
+ "205": "Reset Content",
+ "206": "Partial Content",
+ "207": "Multi-Status",
+ "208": "Already Reported",
+ "226": "IM Used",
+ "300": "Multiple Choices",
+ "301": "Moved Permanently",
+ "302": "Found",
+ "303": "See Other",
+ "304": "Not Modified",
+ "305": "Use Proxy",
+ "307": "Temporary Redirect",
+ "308": "Permanent Redirect",
+ "400": "Bad Request",
+ "401": "Unauthorized",
+ "402": "Payment Required",
+ "403": "Forbidden",
+ "404": "Not Found",
+ "405": "Method Not Allowed",
+ "406": "Not Acceptable",
+ "407": "Proxy Authentication Required",
+ "408": "Request Timeout",
+ "409": "Conflict",
+ "410": "Gone",
+ "411": "Length Required",
+ "412": "Precondition Failed",
+ "413": "Payload Too Large",
+ "414": "URI Too Long",
+ "415": "Unsupported Media Type",
+ "416": "Range Not Satisfiable",
+ "417": "Expectation Failed",
+ "418": "I'm a Teapot",
+ "421": "Misdirected Request",
+ "422": "Unprocessable Entity",
+ "423": "Locked",
+ "424": "Failed Dependency",
+ "425": "Too Early",
+ "426": "Upgrade Required",
+ "428": "Precondition Required",
+ "429": "Too Many Requests",
+ "431": "Request Header Fields Too Large",
+ "451": "Unavailable For Legal Reasons",
+ "500": "Internal Server Error",
+ "501": "Not Implemented",
+ "502": "Bad Gateway",
+ "503": "Service Unavailable",
+ "504": "Gateway Timeout",
+ "505": "HTTP Version Not Supported",
+ "506": "Variant Also Negotiates",
+ "507": "Insufficient Storage",
+ "508": "Loop Detected",
+ "509": "Bandwidth Limit Exceeded",
+ "510": "Not Extended",
+ "511": "Network Authentication Required"
+}
diff --git a/node_modules/statuses/index.js b/node_modules/statuses/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..ea351c553520e1bc62d53b97a316194c48ac49e6
--- /dev/null
+++ b/node_modules/statuses/index.js
@@ -0,0 +1,146 @@
+/*!
+ * statuses
+ * Copyright(c) 2014 Jonathan Ong
+ * Copyright(c) 2016 Douglas Christopher Wilson
+ * MIT Licensed
+ */
+
+'use strict'
+
+/**
+ * Module dependencies.
+ * @private
+ */
+
+var codes = require('./codes.json')
+
+/**
+ * Module exports.
+ * @public
+ */
+
+module.exports = status
+
+// status code to message map
+status.message = codes
+
+// status message (lower-case) to code map
+status.code = createMessageToStatusCodeMap(codes)
+
+// array of status codes
+status.codes = createStatusCodeList(codes)
+
+// status codes for redirects
+status.redirect = {
+ 300: true,
+ 301: true,
+ 302: true,
+ 303: true,
+ 305: true,
+ 307: true,
+ 308: true
+}
+
+// status codes for empty bodies
+status.empty = {
+ 204: true,
+ 205: true,
+ 304: true
+}
+
+// status codes for when you should retry the request
+status.retry = {
+ 502: true,
+ 503: true,
+ 504: true
+}
+
+/**
+ * Create a map of message to status code.
+ * @private
+ */
+
+function createMessageToStatusCodeMap (codes) {
+ var map = {}
+
+ Object.keys(codes).forEach(function forEachCode (code) {
+ var message = codes[code]
+ var status = Number(code)
+
+ // populate map
+ map[message.toLowerCase()] = status
+ })
+
+ return map
+}
+
+/**
+ * Create a list of all status codes.
+ * @private
+ */
+
+function createStatusCodeList (codes) {
+ return Object.keys(codes).map(function mapCode (code) {
+ return Number(code)
+ })
+}
+
+/**
+ * Get the status code for given message.
+ * @private
+ */
+
+function getStatusCode (message) {
+ var msg = message.toLowerCase()
+
+ if (!Object.prototype.hasOwnProperty.call(status.code, msg)) {
+ throw new Error('invalid status message: "' + message + '"')
+ }
+
+ return status.code[msg]
+}
+
+/**
+ * Get the status message for given code.
+ * @private
+ */
+
+function getStatusMessage (code) {
+ if (!Object.prototype.hasOwnProperty.call(status.message, code)) {
+ throw new Error('invalid status code: ' + code)
+ }
+
+ return status.message[code]
+}
+
+/**
+ * Get the status code.
+ *
+ * Given a number, this will throw if it is not a known status
+ * code, otherwise the code will be returned. Given a string,
+ * the string will be parsed for a number and return the code
+ * if valid, otherwise will lookup the code assuming this is
+ * the status message.
+ *
+ * @param {string|number} code
+ * @returns {number}
+ * @public
+ */
+
+function status (code) {
+ if (typeof code === 'number') {
+ return getStatusMessage(code)
+ }
+
+ if (typeof code !== 'string') {
+ throw new TypeError('code must be a number or string')
+ }
+
+ // '403'
+ var n = parseInt(code, 10)
+ if (!isNaN(n)) {
+ return getStatusMessage(n)
+ }
+
+ return getStatusCode(code)
+}
diff --git a/node_modules/statuses/package.json b/node_modules/statuses/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..b5d016edd9c4eef0bb227af4a01c49e73c5f78dc
--- /dev/null
+++ b/node_modules/statuses/package.json
@@ -0,0 +1,49 @@
+{
+ "name": "statuses",
+ "description": "HTTP status utility",
+ "version": "2.0.2",
+ "contributors": [
+ "Douglas Christopher Wilson ",
+ "Jonathan Ong (http://jongleberry.com)"
+ ],
+ "repository": "jshttp/statuses",
+ "license": "MIT",
+ "keywords": [
+ "http",
+ "status",
+ "code"
+ ],
+ "files": [
+ "HISTORY.md",
+ "index.js",
+ "codes.json",
+ "LICENSE"
+ ],
+ "devDependencies": {
+ "csv-parse": "4.16.3",
+ "eslint": "7.19.0",
+ "eslint-config-standard": "14.1.1",
+ "eslint-plugin-import": "2.31.0",
+ "eslint-plugin-markdown": "1.0.2",
+ "eslint-plugin-node": "11.1.0",
+ "eslint-plugin-promise": "4.3.1",
+ "eslint-plugin-standard": "4.1.0",
+ "mocha": "8.4.0",
+ "nyc": "15.1.0",
+ "raw-body": "2.5.2",
+ "stream-to-array": "2.3.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ },
+ "scripts": {
+ "build": "node scripts/build.js",
+ "fetch": "node scripts/fetch-apache.js && node scripts/fetch-iana.js && node scripts/fetch-nginx.js && node scripts/fetch-node.js",
+ "lint": "eslint --plugin markdown --ext js,md .",
+ "test": "mocha --reporter spec --check-leaks --bail test/",
+ "test-ci": "nyc --reporter=lcov --reporter=text npm test",
+ "test-cov": "nyc --reporter=html --reporter=text npm test",
+ "update": "npm run fetch && npm run build",
+ "version": "node scripts/version-history.js && git add HISTORY.md"
+ }
+}
diff --git a/node_modules/std-env/LICENCE b/node_modules/std-env/LICENCE
new file mode 100644
index 0000000000000000000000000000000000000000..db8fffe6a1f33b4b247463e60d9528b504a2eba8
--- /dev/null
+++ b/node_modules/std-env/LICENCE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) Pooya Parsa
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/node_modules/std-env/README.md b/node_modules/std-env/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..6a722f010625fa290d4d6cfc10814e0c77bd758b
--- /dev/null
+++ b/node_modules/std-env/README.md
@@ -0,0 +1,91 @@
+# std-env
+
+[](http://npmjs.com/package/std-env)
+[](http://npmjs.com/package/std-env)
+[](https://bundlephobia.com/result?p=std-env)
+
+Runtime-agnostic JS utils for detecting environments, runtimes, CI providers, and AI coding agents.
+
+## Runtime Detection
+
+Detects the current JavaScript runtime based on global variables, following the [WinterCG Runtime Keys proposal](https://runtime-keys.proposal.wintercg.org/).
+
+```ts
+import { runtime, runtimeInfo } from "std-env";
+
+console.log(runtime); // "" | "node" | "deno" | "bun" | "workerd" ...
+console.log(runtimeInfo); // { name: "node" }
+```
+
+Individual named exports: `isNode`, `isBun`, `isDeno`, `isNetlify`, `isEdgeLight`, `isWorkerd`, `isFastly`
+
+> [!NOTE]
+> `isNode` is also `true` in Bun/Deno with Node.js compatibility mode. Use `runtime === "node"` for strict checks.
+
+See [./src/runtimes.ts](./src/runtimes.ts) for the full list.
+
+## Provider Detection
+
+Detects the current CI/CD provider based on environment variables.
+
+```ts
+import { isCI, provider, providerInfo } from "std-env";
+
+console.log({ isCI, provider, providerInfo });
+// { isCI: true, provider: "github_actions", providerInfo: { name: "github_actions", ci: true } }
+```
+
+Use `detectProvider()` to re-run detection. See [./src/providers.ts](./src/providers.ts) for the full list.
+
+## Agent Detection
+
+Detects if the environment is running inside an AI coding agent.
+
+```ts
+import { isAgent, agent, agentInfo } from "std-env";
+
+console.log({ isAgent, agent, agentInfo });
+// { isAgent: true, agent: "claude", agentInfo: { name: "claude" } }
+```
+
+Set the `AI_AGENT` env var to explicitly specify the agent name. Use `detectAgent()` to re-run detection.
+
+Supported agents: `cursor`, `claude`, `devin`, `replit`, `gemini`, `codex`, `auggie`, `opencode`, `kiro`, `goose`, `pi`
+
+## Flags
+
+```js
+import { env, isDevelopment, isProduction } from "std-env";
+```
+
+| Export | Description |
+| ------------------ | ------------------------------------------------------------ |
+| `hasTTY` | stdout TTY is available |
+| `hasWindow` | Global `window` is available |
+| `isCI` | Running in CI |
+| `isColorSupported` | Terminal color output supported |
+| `isDebug` | `DEBUG` env var is set |
+| `isDevelopment` | `NODE_ENV` is `dev`/`development` or `MODE` is `development` |
+| `isLinux` | Linux platform |
+| `isMacOS` | macOS (darwin) platform |
+| `isMinimal` | `MINIMAL` env is set, CI, test, or no TTY |
+| `isProduction` | `NODE_ENV` or `MODE` is `production` |
+| `isTest` | `NODE_ENV` is `test` or `TEST` env is set |
+| `isWindows` | Windows platform |
+| `platform` | Value of `process.platform` |
+| `nodeVersion` | Node.js version string (e.g. `"22.0.0"`) |
+| `nodeMajorVersion` | Node.js major version number (e.g. `22`) |
+
+See [./src/flags.ts](./src/flags.ts) for details.
+
+## Environment
+
+| Export | Description |
+| --------- | ---------------------------------------------------- |
+| `env` | Universal `process.env` (works across all runtimes) |
+| `process` | Universal `process` shim (works across all runtimes) |
+| `nodeENV` | Current `NODE_ENV` value (undefined if unset) |
+
+## License
+
+MIT
diff --git a/node_modules/std-env/package.json b/node_modules/std-env/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..a2d4f34cfc104a36841ca9b3550373be952399c6
--- /dev/null
+++ b/node_modules/std-env/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "std-env",
+ "version": "4.1.0",
+ "description": "Runtime agnostic JS utils",
+ "license": "MIT",
+ "repository": "unjs/std-env",
+ "files": [
+ "dist"
+ ],
+ "type": "module",
+ "sideEffects": false,
+ "main": "./dist/index.mjs",
+ "types": "./dist/index.d.mts",
+ "exports": {
+ ".": "./dist/index.mjs"
+ },
+ "scripts": {
+ "build": "obuild",
+ "dev": "vitest",
+ "lint": "oxlint . && oxfmt",
+ "lint:fix": "oxlint --fix . && oxfmt",
+ "prepack": "obuild",
+ "release": "pnpm test && pnpm build && changelogen --release --publish && git push --follow-tags",
+ "test": "pnpm lint && pnpm typecheck && vitest run --coverage",
+ "typecheck": "tsgo --noEmit"
+ },
+ "devDependencies": {
+ "@types/node": "^25.2.3",
+ "@typescript/native-preview": "^7.0.0-dev.20260217.1",
+ "@vitest/coverage-v8": "^4.0.18",
+ "changelogen": "^0.6.2",
+ "esbuild": "^0.27.3",
+ "mitata": "^1.0.34",
+ "obuild": "^0.4.28",
+ "oxfmt": "^0.33.0",
+ "oxlint": "^1.48.0",
+ "rollup": "^4.57.1",
+ "typescript": "^5.9.3",
+ "vitest": "^4.0.18"
+ },
+ "packageManager": "pnpm@10.30.0"
+}
diff --git a/node_modules/streamsearch/.eslintrc.js b/node_modules/streamsearch/.eslintrc.js
new file mode 100644
index 0000000000000000000000000000000000000000..be9311d02655a22381f13078bfe868bcbd85b3a6
--- /dev/null
+++ b/node_modules/streamsearch/.eslintrc.js
@@ -0,0 +1,5 @@
+'use strict';
+
+module.exports = {
+ extends: '@mscdex/eslint-config',
+};
diff --git a/node_modules/streamsearch/.github/workflows/ci.yml b/node_modules/streamsearch/.github/workflows/ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..29d51782c77a93f2a32774350fb6e6229ebc3408
--- /dev/null
+++ b/node_modules/streamsearch/.github/workflows/ci.yml
@@ -0,0 +1,24 @@
+name: CI
+
+on:
+ pull_request:
+ push:
+ branches: [ master ]
+
+jobs:
+ tests-linux:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ node-version: [10.x, 12.x, 14.x, 16.x]
+ steps:
+ - uses: actions/checkout@v2
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: Install module
+ run: npm install
+ - name: Run tests
+ run: npm test
diff --git a/node_modules/streamsearch/.github/workflows/lint.yml b/node_modules/streamsearch/.github/workflows/lint.yml
new file mode 100644
index 0000000000000000000000000000000000000000..9f9e1f589a30be583a860f928382b3033c38749d
--- /dev/null
+++ b/node_modules/streamsearch/.github/workflows/lint.yml
@@ -0,0 +1,23 @@
+name: lint
+
+on:
+ pull_request:
+ push:
+ branches: [ master ]
+
+env:
+ NODE_VERSION: 16.x
+
+jobs:
+ lint-js:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Use Node.js ${{ env.NODE_VERSION }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ env.NODE_VERSION }}
+ - name: Install ESLint + ESLint configs/plugins
+ run: npm install --only=dev
+ - name: Lint files
+ run: npm run lint
diff --git a/node_modules/streamsearch/LICENSE b/node_modules/streamsearch/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..9ea90e03922d5e31b32e5ff84f4e51a6ca0760b5
--- /dev/null
+++ b/node_modules/streamsearch/LICENSE
@@ -0,0 +1,19 @@
+Copyright Brian White. 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:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/streamsearch/README.md b/node_modules/streamsearch/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c3934d1c7d57119aa31103bc6389838c646e2fc2
--- /dev/null
+++ b/node_modules/streamsearch/README.md
@@ -0,0 +1,95 @@
+Description
+===========
+
+streamsearch is a module for [node.js](http://nodejs.org/) that allows searching a stream using the Boyer-Moore-Horspool algorithm.
+
+This module is based heavily on the Streaming Boyer-Moore-Horspool C++ implementation by Hongli Lai [here](https://github.com/FooBarWidget/boyer-moore-horspool).
+
+
+Requirements
+============
+
+* [node.js](http://nodejs.org/) -- v10.0.0 or newer
+
+
+Installation
+============
+
+ npm install streamsearch
+
+Example
+=======
+
+```js
+ const { inspect } = require('util');
+
+ const StreamSearch = require('streamsearch');
+
+ const needle = Buffer.from('\r\n');
+ const ss = new StreamSearch(needle, (isMatch, data, start, end) => {
+ if (data)
+ console.log('data: ' + inspect(data.toString('latin1', start, end)));
+ if (isMatch)
+ console.log('match!');
+ });
+
+ const chunks = [
+ 'foo',
+ ' bar',
+ '\r',
+ '\n',
+ 'baz, hello\r',
+ '\n world.',
+ '\r\n Node.JS rules!!\r\n\r\n',
+ ];
+ for (const chunk of chunks)
+ ss.push(Buffer.from(chunk));
+
+ // output:
+ //
+ // data: 'foo'
+ // data: ' bar'
+ // match!
+ // data: 'baz, hello'
+ // match!
+ // data: ' world.'
+ // match!
+ // data: ' Node.JS rules!!'
+ // match!
+ // data: ''
+ // match!
+```
+
+
+API
+===
+
+Properties
+----------
+
+* **maxMatches** - < _integer_ > - The maximum number of matches. Defaults to `Infinity`.
+
+* **matches** - < _integer_ > - The current match count.
+
+
+Functions
+---------
+
+* **(constructor)**(< _mixed_ >needle, < _function_ >callback) - Creates and returns a new instance for searching for a _Buffer_ or _string_ `needle`. `callback` is called any time there is non-matching data and/or there is a needle match. `callback` will be called with the following arguments:
+
+ 1. `isMatch` - _boolean_ - Indicates whether a match has been found
+
+ 2. `data` - _mixed_ - If set, this contains data that did not match the needle.
+
+ 3. `start` - _integer_ - The index in `data` where the non-matching data begins (inclusive).
+
+ 4. `end` - _integer_ - The index in `data` where the non-matching data ends (exclusive).
+
+ 5. `isSafeData` - _boolean_ - Indicates if it is safe to store a reference to `data` (e.g. as-is or via `data.slice()`) or not, as in some cases `data` may point to a Buffer whose contents change over time.
+
+* **destroy**() - _(void)_ - Emits any last remaining unmatched data that may still be buffered and then resets internal state.
+
+* **push**(< _Buffer_ >chunk) - _integer_ - Processes `chunk`, searching for a match. The return value is the last processed index in `chunk` + 1.
+
+* **reset**() - _(void)_ - Resets internal state. Useful for when you wish to start searching a new/different stream for example.
+
diff --git a/node_modules/streamsearch/lib/sbmh.js b/node_modules/streamsearch/lib/sbmh.js
new file mode 100644
index 0000000000000000000000000000000000000000..510cae26e67a58d4c1cdfb4ed5afd80c0f50c782
--- /dev/null
+++ b/node_modules/streamsearch/lib/sbmh.js
@@ -0,0 +1,267 @@
+'use strict';
+/*
+ Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation
+ by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool
+*/
+function memcmp(buf1, pos1, buf2, pos2, num) {
+ for (let i = 0; i < num; ++i) {
+ if (buf1[pos1 + i] !== buf2[pos2 + i])
+ return false;
+ }
+ return true;
+}
+
+class SBMH {
+ constructor(needle, cb) {
+ if (typeof cb !== 'function')
+ throw new Error('Missing match callback');
+
+ if (typeof needle === 'string')
+ needle = Buffer.from(needle);
+ else if (!Buffer.isBuffer(needle))
+ throw new Error(`Expected Buffer for needle, got ${typeof needle}`);
+
+ const needleLen = needle.length;
+
+ this.maxMatches = Infinity;
+ this.matches = 0;
+
+ this._cb = cb;
+ this._lookbehindSize = 0;
+ this._needle = needle;
+ this._bufPos = 0;
+
+ this._lookbehind = Buffer.allocUnsafe(needleLen);
+
+ // Initialize occurrence table.
+ this._occ = [
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen, needleLen, needleLen,
+ needleLen, needleLen, needleLen, needleLen
+ ];
+
+ // Populate occurrence table with analysis of the needle, ignoring the last
+ // letter.
+ if (needleLen > 1) {
+ for (let i = 0; i < needleLen - 1; ++i)
+ this._occ[needle[i]] = needleLen - 1 - i;
+ }
+ }
+
+ reset() {
+ this.matches = 0;
+ this._lookbehindSize = 0;
+ this._bufPos = 0;
+ }
+
+ push(chunk, pos) {
+ let result;
+ if (!Buffer.isBuffer(chunk))
+ chunk = Buffer.from(chunk, 'latin1');
+ const chunkLen = chunk.length;
+ this._bufPos = pos || 0;
+ while (result !== chunkLen && this.matches < this.maxMatches)
+ result = feed(this, chunk);
+ return result;
+ }
+
+ destroy() {
+ const lbSize = this._lookbehindSize;
+ if (lbSize)
+ this._cb(false, this._lookbehind, 0, lbSize, false);
+ this.reset();
+ }
+}
+
+function feed(self, data) {
+ const len = data.length;
+ const needle = self._needle;
+ const needleLen = needle.length;
+
+ // Positive: points to a position in `data`
+ // pos == 3 points to data[3]
+ // Negative: points to a position in the lookbehind buffer
+ // pos == -2 points to lookbehind[lookbehindSize - 2]
+ let pos = -self._lookbehindSize;
+ const lastNeedleCharPos = needleLen - 1;
+ const lastNeedleChar = needle[lastNeedleCharPos];
+ const end = len - needleLen;
+ const occ = self._occ;
+ const lookbehind = self._lookbehind;
+
+ if (pos < 0) {
+ // Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool
+ // search with character lookup code that considers both the
+ // lookbehind buffer and the current round's haystack data.
+ //
+ // Loop until
+ // there is a match.
+ // or until
+ // we've moved past the position that requires the
+ // lookbehind buffer. In this case we switch to the
+ // optimized loop.
+ // or until
+ // the character to look at lies outside the haystack.
+ while (pos < 0 && pos <= end) {
+ const nextPos = pos + lastNeedleCharPos;
+ const ch = (nextPos < 0
+ ? lookbehind[self._lookbehindSize + nextPos]
+ : data[nextPos]);
+
+ if (ch === lastNeedleChar
+ && matchNeedle(self, data, pos, lastNeedleCharPos)) {
+ self._lookbehindSize = 0;
+ ++self.matches;
+ if (pos > -self._lookbehindSize)
+ self._cb(true, lookbehind, 0, self._lookbehindSize + pos, false);
+ else
+ self._cb(true, undefined, 0, 0, true);
+
+ return (self._bufPos = pos + needleLen);
+ }
+
+ pos += occ[ch];
+ }
+
+ // No match.
+
+ // There's too few data for Boyer-Moore-Horspool to run,
+ // so let's use a different algorithm to skip as much as
+ // we can.
+ // Forward pos until
+ // the trailing part of lookbehind + data
+ // looks like the beginning of the needle
+ // or until
+ // pos == 0
+ while (pos < 0 && !matchNeedle(self, data, pos, len - pos))
+ ++pos;
+
+ if (pos < 0) {
+ // Cut off part of the lookbehind buffer that has
+ // been processed and append the entire haystack
+ // into it.
+ const bytesToCutOff = self._lookbehindSize + pos;
+
+ if (bytesToCutOff > 0) {
+ // The cut off data is guaranteed not to contain the needle.
+ self._cb(false, lookbehind, 0, bytesToCutOff, false);
+ }
+
+ self._lookbehindSize -= bytesToCutOff;
+ lookbehind.copy(lookbehind, 0, bytesToCutOff, self._lookbehindSize);
+ lookbehind.set(data, self._lookbehindSize);
+ self._lookbehindSize += len;
+
+ self._bufPos = len;
+ return len;
+ }
+
+ // Discard lookbehind buffer.
+ self._cb(false, lookbehind, 0, self._lookbehindSize, false);
+ self._lookbehindSize = 0;
+ }
+
+ pos += self._bufPos;
+
+ const firstNeedleChar = needle[0];
+
+ // Lookbehind buffer is now empty. Perform Boyer-Moore-Horspool
+ // search with optimized character lookup code that only considers
+ // the current round's haystack data.
+ while (pos <= end) {
+ const ch = data[pos + lastNeedleCharPos];
+
+ if (ch === lastNeedleChar
+ && data[pos] === firstNeedleChar
+ && memcmp(needle, 0, data, pos, lastNeedleCharPos)) {
+ ++self.matches;
+ if (pos > 0)
+ self._cb(true, data, self._bufPos, pos, true);
+ else
+ self._cb(true, undefined, 0, 0, true);
+
+ return (self._bufPos = pos + needleLen);
+ }
+
+ pos += occ[ch];
+ }
+
+ // There was no match. If there's trailing haystack data that we cannot
+ // match yet using the Boyer-Moore-Horspool algorithm (because the trailing
+ // data is less than the needle size) then match using a modified
+ // algorithm that starts matching from the beginning instead of the end.
+ // Whatever trailing data is left after running this algorithm is added to
+ // the lookbehind buffer.
+ while (pos < len) {
+ if (data[pos] !== firstNeedleChar
+ || !memcmp(data, pos, needle, 0, len - pos)) {
+ ++pos;
+ continue;
+ }
+ data.copy(lookbehind, 0, pos, len);
+ self._lookbehindSize = len - pos;
+ break;
+ }
+
+ // Everything until `pos` is guaranteed not to contain needle data.
+ if (pos > 0)
+ self._cb(false, data, self._bufPos, pos < len ? pos : len, true);
+
+ self._bufPos = len;
+ return len;
+}
+
+function matchNeedle(self, data, pos, len) {
+ const lb = self._lookbehind;
+ const lbSize = self._lookbehindSize;
+ const needle = self._needle;
+
+ for (let i = 0; i < len; ++i, ++pos) {
+ const ch = (pos < 0 ? lb[lbSize + pos] : data[pos]);
+ if (ch !== needle[i])
+ return false;
+ }
+ return true;
+}
+
+module.exports = SBMH;
diff --git a/node_modules/streamsearch/package.json b/node_modules/streamsearch/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..51df8f9707cebd8469d793a8d90050baac1c4d1d
--- /dev/null
+++ b/node_modules/streamsearch/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "streamsearch",
+ "version": "1.1.0",
+ "author": "Brian White ",
+ "description": "Streaming Boyer-Moore-Horspool searching for node.js",
+ "main": "./lib/sbmh.js",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "devDependencies": {
+ "@mscdex/eslint-config": "^1.1.0",
+ "eslint": "^7.32.0"
+ },
+ "scripts": {
+ "test": "node test/test.js",
+ "lint": "eslint --cache --report-unused-disable-directives --ext=.js .eslintrc.js lib test",
+ "lint:fix": "npm run lint -- --fix"
+ },
+ "keywords": [
+ "stream",
+ "horspool",
+ "boyer-moore-horspool",
+ "boyer-moore",
+ "search"
+ ],
+ "licenses": [{
+ "type": "MIT",
+ "url": "http://github.com/mscdex/streamsearch/raw/master/LICENSE"
+ }],
+ "repository": {
+ "type": "git",
+ "url": "http://github.com/mscdex/streamsearch.git"
+ }
+}
diff --git a/node_modules/streamsearch/test/test.js b/node_modules/streamsearch/test/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..39a04d7f834bea5e8da37c4cf56973a7b3217dd5
--- /dev/null
+++ b/node_modules/streamsearch/test/test.js
@@ -0,0 +1,70 @@
+'use strict';
+
+const assert = require('assert');
+
+const StreamSearch = require('../lib/sbmh.js');
+
+[
+ {
+ needle: '\r\n',
+ chunks: [
+ 'foo',
+ ' bar',
+ '\r',
+ '\n',
+ 'baz, hello\r',
+ '\n world.',
+ '\r\n Node.JS rules!!\r\n\r\n',
+ ],
+ expect: [
+ [false, 'foo'],
+ [false, ' bar'],
+ [ true, null],
+ [false, 'baz, hello'],
+ [ true, null],
+ [false, ' world.'],
+ [ true, null],
+ [ true, ' Node.JS rules!!'],
+ [ true, ''],
+ ],
+ },
+ {
+ needle: '---foobarbaz',
+ chunks: [
+ '---foobarbaz',
+ 'asdf',
+ '\r\n',
+ '---foobarba',
+ '---foobar',
+ 'ba',
+ '\r\n---foobarbaz--\r\n',
+ ],
+ expect: [
+ [ true, null],
+ [false, 'asdf'],
+ [false, '\r\n'],
+ [false, '---foobarba'],
+ [false, '---foobarba'],
+ [ true, '\r\n'],
+ [false, '--\r\n'],
+ ],
+ },
+].forEach((test, i) => {
+ console.log(`Running test #${i + 1}`);
+ const { needle, chunks, expect } = test;
+
+ const results = [];
+ const ss = new StreamSearch(Buffer.from(needle),
+ (isMatch, data, start, end) => {
+ if (data)
+ data = data.toString('latin1', start, end);
+ else
+ data = null;
+ results.push([isMatch, data]);
+ });
+
+ for (const chunk of chunks)
+ ss.push(Buffer.from(chunk));
+
+ assert.deepStrictEqual(results, expect);
+});
diff --git a/node_modules/streamx/LICENSE b/node_modules/streamx/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..c728dc70b96897b4f56c18d41e2965a547f67cfc
--- /dev/null
+++ b/node_modules/streamx/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2019 Mathias Buus
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/streamx/README.md b/node_modules/streamx/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..3ce4305db62bb7f696a580a09a11c55ac230784a
--- /dev/null
+++ b/node_modules/streamx/README.md
@@ -0,0 +1,550 @@
+# streamx
+
+An iteration of the Node.js core streams with a series of improvements.
+
+```
+npm install streamx
+```
+
+[](https://github.com/streamxorg/streamx/actions?query=workflow%3A%22Build+Status%22)
+
+## Main improvements from Node.js core stream
+
+#### Proper lifecycle support.
+
+Streams have an `_open` function that is called before any read/write operation and a `_destroy`
+function that is always run as the last part of the stream.
+
+This makes it easy to maintain state.
+
+#### Easy error handling
+
+Fully integrates a `.destroy()` function. When called the stream will wait for any
+pending operation to finish and call the stream destroy logic.
+
+Close is _always_ the last event emitted and `destroy` is always run.
+
+#### `pipe()` error handles
+
+`pipe` accepts a callback that is called when the pipeline is fully drained.
+It also error handles the streams provided and destroys both streams if either
+of them fail.
+
+#### All streams are both binary and object mode streams
+
+A `map` function can be provided to map your input data into buffers
+or other formats. To indicate how much buffer space each data item takes
+an `byteLength` function can be provided as well.
+
+This removes the need for two modes of streams.
+
+#### Simplicity
+
+This is a full rewrite, all contained in one file.
+
+Lots of stream methods are simplified based on how I and devs I work with actually use streams in the wild.
+
+#### Backwards compat
+
+streamx aims to be compatible with Node.js streams whenever it is reasonable to do so.
+
+This means that streamx streams behave a lot like Node.js streams from the outside but still provides the
+improvements above.
+
+#### Smaller browser footprint
+
+streamx has a much smaller footprint when compiled for the browser:
+
+```
+$ for x in stream{,x}; do echo $x: $(browserify -r $x | wc -c) bytes; done
+stream: 173844 bytes
+streamx: 46943 bytes
+```
+
+With optimizations turned on, the difference is even more stark:
+
+```
+$ for x in stream{,x}; do echo $x: $(browserify -r $x -p tinyify | wc -c) bytes; done
+stream: 62649 bytes
+streamx: 8460 bytes
+$ for x in stream{,x}; do echo $x: $(browserify -r $x -p tinyify | gzip | wc -c) "bytes (gzipped)"; done
+stream: 18053 bytes (gzipped)
+streamx: 2806 bytes (gzipped)
+```
+
+#### AbortSignal support
+
+To make it easier to integrate streams in a `async/await` flow, all streams support a `signal` option
+that accepts a [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) to as an
+alternative means to `.destroy` streams.
+
+## Usage
+
+```js
+const { Readable } = require('streamx')
+
+const rs = new Readable({
+ read(cb) {
+ this.push('Cool data')
+ cb(null)
+ }
+})
+
+rs.on('data', (data) => console.log('data:', data))
+```
+
+## API
+
+This streamx package contains 4 streams similar to Node.js core.
+
+## Readable Stream
+
+#### `rs = new stream.Readable([options])`
+
+Create a new readable stream.
+
+Options include:
+
+```
+{
+ highWaterMark: 16384, // max buffer size in bytes
+ map: (data) => data, // optional function to map input data
+ byteLength: (data) => size, // optional function that calculates the byte size of input data
+ signal: abortController.signal, // optional AbortSignal that triggers `.destroy` when on `abort`
+ eagerOpen: false // eagerly open the stream
+}
+```
+
+In addition you can pass the `open`, `read`, and `destroy` functions as shorthands in
+the constructor instead of overwrite the methods below.
+
+The default byteLength function returns the byte length of buffers and `1024`
+for any other object. This means the buffer will contain around 16 non buffers
+or buffers worth 16kb when full if the defaults are used.
+
+If you set highWaterMark to `0` then all read ahead buffering on the stream
+is disabled and it will only call `_read` when a user reads rather than ahead of time.
+
+#### `rs._read(cb)`
+
+This function is called when the stream wants you to push new data.
+Overwrite this and add your own read logic.
+You should call the callback when you are fully done with the read.
+
+Can also be set using `options.read` in the constructor.
+
+Note that this function differs from Node.js streams in that it takes
+the "read finished" callback.
+
+#### `drained = rs.push(data)`
+
+Push new data to the stream. Returns true if the buffer is not full
+and you should push more data if you can.
+
+If you call `rs.push(null)` you signal to the stream that no more
+data will be pushed and that you want to end the stream.
+
+#### `data = rs.read()`
+
+Read a piece of data from the stream buffer. If the buffer is currently empty
+`null` will be returned and you should wait for `readable` to be emitted before
+trying again. If the stream has been ended it will also return `null`.
+
+Note that this method differs from Node.js streams in that it does not accept
+an optional amounts of bytes to consume.
+
+#### `rs.unshift(data)`
+
+Add a piece of data to the front of the buffer. Use this if you read too much
+data using the `rs.read()` function.
+
+#### `rs._open(cb)`
+
+This function is called once before the first read is issued. Use this function
+to implement your own open logic.
+
+Can also be set using `options.open` in the constructor.
+
+#### `rs._destroy(cb)`
+
+This function is called just before the stream is fully destroyed. You should
+use this to implement whatever teardown logic you need. The final part of the
+stream life cycle is always to call destroy itself so this function will always
+be called whether or not the stream ends gracefully or forcefully.
+
+Can also be set using `options.destroy` in the constructor.
+
+Note that the `_destroy` might be called without the open function being called
+in case no read was ever performed on the stream.
+
+#### `rs._predestroy()`
+
+A simple hook that is called as soon as the first `stream.destroy()` call is invoked.
+
+Use this in case you need to cancel pending reads (if possible) instead of waiting for them to finish.
+
+Can also be set using `options.predestroy` in the constructor.
+
+#### `rs.destroy([error])`
+
+Forcefully destroy the stream. Will call `_destroy` as soon as all pending reads have finished.
+Once the stream is fully destroyed `close` will be emitted.
+
+If you pass an error this error will be emitted just before `close` is, signifying a reason
+as to why this stream was destroyed.
+
+#### `rs.pause()`
+
+Pauses the stream. You will only need to call this if you want to pause a resumed stream.
+
+Returns this stream instance.
+
+#### `rs.resume()`
+
+Will start reading data from the stream as fast as possible.
+
+If you do not call this, you need to use the `read()` method to read data or the `pipe()` method to
+pipe the stream somewhere else or the `data` handler.
+
+If none of these option are used the stream will stay paused.
+
+Returns this stream instance.
+
+#### `rs.setEncoding(encoding)`
+
+Set an encoding to change how data is interpreted. E.g. `utf-8`.
+
+#### `bool = Readable.isPaused(rs)`
+
+Returns `true` if the stream is paused, else `false`.
+
+#### `writableStream = rs.pipe(writableStream, [callback])`
+
+Efficently pipe the readable stream to a writable stream (can be Node.js core stream or a stream from this package).
+If you provide a callback the callback is called when the pipeline has fully finished with an optional error in case
+it failed.
+
+To cancel the pipeline destroy either of the streams.
+
+#### `rs.on('readable')`
+
+Emitted when data is pushed to the stream if the buffer was previously empty.
+
+#### `rs.on('data', data)`
+
+Emitted when data is being read from the stream. If you attach a data handler you are implicitly resuming the stream.
+
+#### `rs.on('end')`
+
+Emitted when the readable stream has ended and no data is left in it's buffer.
+
+#### `rs.on('close')`
+
+Emitted when the readable stream has fully closed (i.e. it's destroy function has completed)
+
+#### `rs.on('error', err)`
+
+Emitted if any of the stream operations fail with an error. `close` is always emitted right after this.
+
+#### `rs.on('piping', dest)`
+
+Emitted when the readable stream is pipeing to a destination.
+
+#### `rs.on('open')`
+
+Emitted after `rs._open(cb)` execution.
+
+#### `rs.destroying`
+
+Boolean property indicating whether or not this stream has started to be destroyed.
+
+#### `rs.destroyed`
+
+Boolean property indicating whether or not this stream has been destroyed.
+
+#### `rs.readable`
+
+Returns `true` if the stream is an active streamx readable stream. Returns `undefined` if not.
+
+#### `bool = Readable.isBackpressured(rs)`
+
+Static method to check if a readable stream is currently under backpressure.
+
+#### `stream = Readable.from(arrayOrBufferOrStringOrAsyncIterator)`
+
+Static method to turn an array or buffer or string or AsyncIterator into a readable stream.
+
+## Writable Stream
+
+#### `ws = new stream.Writable([options])`
+
+Create a new writable stream.
+
+Options include:
+
+```
+{
+ highWaterMark: 16384, // max buffer size in bytes
+ map: (data) => data, // optional function to map input data
+ byteLength: (data) => size, // optional function that calculates the byte size of input data
+ signal: abortController.signal // optional AbortSignal that triggers `.destroy` when on `abort`
+}
+```
+
+In addition you can pass the `open`, `write`, `final`, and `destroy` functions as shorthands in
+the constructor instead of overwrite the methods below.
+
+The default byteLength function returns the byte length of buffers and `1024`
+for any other object. This means the buffer will contain around 16 non buffers
+or buffers worth 16kb when full if the defaults are used.
+
+#### `ws._open(cb)`
+
+This function is called once before the first write is issued. Use this function
+to implement your own open logic.
+
+Can also be set using `options.open` in the constructor.
+
+#### `ws._destroy(cb)`
+
+This function is called just before the stream is fully destroyed. You should
+use this to implement whatever teardown logic you need. The final part of the
+stream life cycle is always to call destroy itself so this function will always
+be called whether or not the stream ends gracefully or forcefully.
+
+Can also be set using `options.destroy` in the constructor.
+
+Note that the `_destroy` might be called without the open function being called
+in case no write was ever performed on the stream.
+
+#### `ws._predestroy()`
+
+A simple hook that is called as soon as the first `stream.destroy()` call is invoked.
+
+Use this in case you need to cancel pending writes (if possible) instead of waiting for them to finish.
+
+Can also be set using `options.predestroy` in the constructor.
+
+#### `ws.destroy([error])`
+
+Forcefully destroy the stream. Will call `_destroy` as soon as all pending reads have finished.
+Once the stream is fully destroyed `close` will be emitted.
+
+If you pass an error this error will be emitted just before `close` is, signifying a reason
+as to why this stream was destroyed.
+
+#### `drained = ws.write(data)`
+
+Write a piece of data to the stream. Returns `true` if the stream buffer is not full and you
+should keep writing to it if you can. If `false` is returned the stream will emit `drain`
+once it's buffer is fully drained.
+
+#### `ws._write(data, callback)`
+
+This function is called when the stream want to write some data. Use this to implement your own
+write logic. When done call the callback and the stream will call it again if more data exists in the buffer.
+
+Can also be set using `options.write` in the constructor.
+
+#### `ws._writev(batch, callback)`
+
+Similar to `_write` but passes an array of all data in the current write buffer instead of the oldest one.
+Useful if the destination you are writing the data to supports batching.
+
+Can also be set using `options.writev` in the constructor.
+
+#### `ws.end()`
+
+Gracefully end the writable stream. Call this when you no longer want to write to the stream.
+
+Once all writes have been fully drained `finish` will be emitted.
+
+Returns this stream instance.
+
+#### `ws.cork()`
+
+Buffer written data in memory. Useful for accumulating small chunks of data into a batch to be consumed by `writev`.
+
+#### `ws.uncork()`
+
+Disable `ws.cork()`.
+
+#### `ws._final(callback)`
+
+This function is called just before `finish` is emitted, i.e. when all writes have flushed but `ws.end()`
+have been called. Use this to implement any logic that should happen after all writes but before finish.
+
+Can also be set using `options.final` in the constructor.
+
+#### `ws.on('finish')`
+
+Emitted when the stream has been ended and all writes have been drained.
+
+#### `ws.on('close')`
+
+Emitted when the readable stream has fully closed (i.e. it's destroy function has completed)
+
+#### `ws.on('error', err)`
+
+Emitted if any of the stream operations fail with an error. `close` is always emitted right after this.
+
+#### `ws.on('pipe', src)`
+
+Emitted when a readable stream is being piped to the writable one.
+
+#### `ws.on('open')`
+
+Emitted after `ws._open(cb)` execution.
+
+#### `ws.on('drain')`
+
+Emitted after all data was drained if `ws.write(data)` returned `false`.
+
+#### `ws.destroying`
+
+Boolean property indicating whether or not this stream has started to be destroyed.
+
+#### `ws.destroyed`
+
+Boolean property indicating whether or not this stream has been destroyed.
+
+#### `ws.writable`
+
+Returns `true` if the stream is an active streamx writable stream. Returns `undefined` if not.
+
+#### `bool = Writable.isBackpressured(ws)`
+
+Static method to check if a writable stream is currently under backpressure.
+
+#### `bool = await Writable.drained(ws)`
+
+Static helper to wait for a stream to drain the currently queued writes.
+Returns true if they were drained and false otherwise if the stream was destroyed.
+
+## Duplex Stream
+
+#### `s = new stream.Duplex([options])`
+
+A duplex stream is a stream that is both readable and writable.
+
+Since JS does not support multiple inheritance it inherits directly from Readable
+but implements the Writable API as well.
+
+If you want to provide only a map function for the readable side use `mapReadable` instead.
+If you want to provide only a byteLength function for the readable side use `byteLengthReadable` instead.
+
+Same goes for the writable side but using `mapWritable` and `byteLengthWritable` instead.
+
+## Transform Stream
+
+A Transform stream is a duplex stream with an `._transform` template method that allows to
+asynchronously map the input to a different output.
+
+The transform stream overrides the `_write` and `_read` operations of `Readable` and `Writable` but
+still allows the setting of these options in the constructor. Usually it is unnecessary to pass
+in `read` or `write`/`writev` or to override the corresponding `._read`, `._write` or `._writev` operation.
+
+#### `ts = new stream.Transform([options])`
+
+A transform stream is a duplex stream that maps the data written to it and emits that as readable data.
+
+Has the same options as a duplex stream except you can provide a `transform` function also.
+
+#### `ts._transform(data, callback)`
+
+Transform the incoming data. Call `callback(null, mappedData)` or use `ts.push(mappedData)` to
+return data to the readable side of the stream.
+
+Per default the transform function just remits the incoming data making it act as a pass-through stream.
+
+## Pipeline
+
+`pipeline` allows to stream form a readable through a set of duplex streams to a writable entry.
+
+```js
+const { pipeline, Readable, Transform, Writable } = require('streamx')
+const lastStream = pipeline(
+ Readable.from([1, 2, 3]),
+ new Transform({
+ transform (from, cb) {
+ this.push(from.toString())
+ cb()
+ }
+ }),
+ new Writable({
+ write (data, cb) {
+ console.log(data)
+ cb()
+ }
+ })
+ error => {
+ // Callback once write has finished
+ }
+)
+```
+
+#### `lastStream = stream.pipeline(...streams, [done])`
+
+Pipe all streams together and return the last stream piped to.
+When the last stream finishes the pipeline ended succesfully.
+
+If any of the streams error, whether they are Node.js core streams
+or streamx streams, all streams in the pipeline are shutdown.
+
+Optionally you can pass a done callback to know when the pipeline is done.
+
+#### `promise = stream.pipelinePromise(...streams)`
+
+Same as normal pipeline except instead of returning the last stream it returns
+a promise representing the done callback. Note you should error handle this
+promise if you use this version.
+
+## Helpers
+
+#### `bool = isStream(stream)`
+
+#### `bool = isStreamx(stream)`
+
+#### `bool = isDisturbed(stream)`
+
+Indicates if the stream has been opened or started to be destroyed.
+
+#### `bool = isEnding(stream)`
+
+Indicates if a readable stream has started it's ending process.
+
+#### `bool = isEnded(stream)`
+
+Indicates if a readable stream ended, so all it's readings.
+
+#### `bool = isFinishing(stream)`
+
+Indicates if a writable stream has started it's ending process.
+
+#### `bool = isFinished(stream)`
+
+Indicates if a writable stream ended, so all it's writings.
+
+#### `err = getStreamError(stream, [options])`
+
+Returns `null` if the stream has no errors.
+
+## Utilities
+
+Streamx aims to be minimal and stable. It therefore only contains a minimal set of utilities.
+To help discover of other modules that help you build streamx apps, we link some useful utilities here
+
+- [stream-composer](https://github.com/mafintosh/stream-composer) - Compose streams like Node's `stream.compose` and the `duplexify` and `pumpify` modules.
+- [teex](https://github.com/mafintosh/teex) - Clone a readable stream into multiple new readable instances.
+- [merge-readable](https://github.com/holepunchto/merge-readable) - Merge multiple readers into a new readable with optional mapping of data
+
+## Contributing
+
+If you want to help contribute to streamx a good way to start is to help writing more test
+cases, compatibility tests, documentation, or performance benchmarks.
+
+If in doubt open an issue :)
+
+## License
+
+MIT
diff --git a/node_modules/streamx/index.d.ts b/node_modules/streamx/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7856f0ca2273a2a71ffd6fba21048468505b7055
--- /dev/null
+++ b/node_modules/streamx/index.d.ts
@@ -0,0 +1,198 @@
+import { BufferEncoding, EventMap, EventEmitter } from './runtime'
+
+interface StreamCallback {
+ (err: Error | null): void
+}
+
+type Pipeline = [src: Readable, ...transforms: Duplex[], dest: S]
+
+declare function pipeline(streams: Pipeline, cb?: StreamCallback): S
+declare function pipeline(...args: Pipeline): S
+declare function pipeline(...args: [...Pipeline, cb: StreamCallback]): S
+
+declare function pipelinePromise(...args: Pipeline): Promise
+
+declare function isStream(stream: Stream): stream is Stream
+declare function isStreamx(stream: Stream): boolean
+declare function isEnding(stream: Stream): boolean
+declare function isEnded(stream: Stream): boolean
+declare function isFinishing(stream: Stream): boolean
+declare function isFinished(stream: Stream): boolean
+declare function isDisturbed(stream: Stream): boolean
+
+interface GetStreamErrorOptions {
+ all?: boolean
+}
+
+declare function getStreamError(stream: Stream, opts?: GetStreamErrorOptions): Error | null
+
+interface StreamEvents extends EventMap {
+ close: []
+ error: [err: Error]
+}
+
+interface StreamOptions {
+ byteLength?(data: unknown): number
+ destroy?(this: S, cb: StreamCallback): void
+ eagerOpen?: boolean
+ highWaterMark?: number
+ map?(data: unknown): unknown
+ open?(this: S, cb: StreamCallback): void
+ predestroy?(this: S): void
+ signal?: AbortSignal
+}
+
+interface Stream extends EventEmitter {
+ _open(cb: StreamCallback): void
+ _predestroy(): void
+ _destroy(cb: StreamCallback): void
+
+ readonly readable: boolean
+ readonly writable: boolean
+ readonly destroyed: boolean
+ readonly destroying: boolean
+
+ destroy(err?: Error | null): void
+}
+
+declare class Stream {
+ constructor(opts?: StreamOptions)
+}
+
+interface WritableEvents extends StreamEvents {
+ drain: []
+ finish: []
+ pipe: [src: Readable]
+}
+
+interface WritableOptions extends StreamOptions {
+ byteLengthWritable?(data: unknown): number
+ final?(this: S, cb: StreamCallback): void
+ mapWritable?(data: unknown): unknown
+ write?(this: S, data: unknown, cb: StreamCallback): void
+ writev?(this: S, batch: unknown[], cb: StreamCallback): void
+}
+
+interface Writable extends Stream {
+ _write(data: unknown, cb: StreamCallback): void
+ _writev(batch: unknown[], cb: StreamCallback): void
+ _final(cb: StreamCallback): void
+
+ write(data: unknown): unknown
+
+ end(data: unknown): this
+
+ cork(): void
+ uncork(): void
+}
+
+declare class Writable extends Stream {
+ constructor(opts?: WritableOptions)
+
+ static isBackpressured(ws: Writable): boolean
+
+ static drained(ws: Writable): Promise
+}
+
+interface ReadableEvents extends StreamEvents {
+ data: [data: unknown]
+ end: []
+ piping: [dest: Writable]
+ readable: []
+}
+
+interface ReadableOptions extends StreamOptions {
+ byteLengthReadable?(data: unknown): number
+ encoding?: BufferEncoding
+ mapReadable?(data: unknown): unknown
+ read?(this: S, cb: StreamCallback): void
+}
+
+interface Readable
+ extends Stream, AsyncIterable {
+ _read(cb: StreamCallback): void
+
+ push(data: unknown | null): boolean
+ unshift(data: unknown | null): void
+ read(): unknown | null
+
+ resume(): this
+ pause(): this
+
+ pipe(dest: S, cb?: StreamCallback): S
+
+ setEncoding(encoding: BufferEncoding): this
+}
+
+declare class Readable extends Stream {
+ constructor(opts?: ReadableOptions)
+
+ static deferred(fn: () => Promise, opts?: TransformOptions): Transform
+
+ static from(data: unknown | unknown[] | AsyncIterable, opts?: ReadableOptions): Readable
+
+ static isBackpressured(rs: Readable): boolean
+
+ static isPaused(rs: Readable): boolean
+}
+
+interface DuplexEvents extends ReadableEvents, WritableEvents {}
+
+interface DuplexOptions extends ReadableOptions, WritableOptions {}
+
+interface Duplex extends Readable, Writable {}
+
+declare class Duplex extends Stream {
+ constructor(opts?: DuplexOptions)
+}
+
+interface TransformCallback {
+ (err: Error | null, mappedData: unknown): void
+}
+
+interface TransformEvents extends DuplexEvents {}
+
+interface TransformOptions extends DuplexOptions {
+ flush?(this: S, cb: StreamCallback): void
+ transform?(this: S, data: unknown, cb: TransformCallback): void
+}
+
+interface Transform extends Duplex {
+ _flush(cb: StreamCallback): void
+ _transform(Data: unknown, cb: TransformCallback): void
+}
+
+declare class Transform extends Duplex {
+ constructor(opts?: TransformOptions)
+}
+
+export {
+ type Pipeline,
+ pipeline,
+ pipelinePromise,
+ isStream,
+ isStreamx,
+ isEnding,
+ isEnded,
+ isFinishing,
+ isFinished,
+ isDisturbed,
+ type GetStreamErrorOptions,
+ getStreamError,
+ type StreamEvents,
+ type StreamOptions,
+ Stream,
+ type WritableEvents,
+ type WritableOptions,
+ Writable,
+ type ReadableEvents,
+ type ReadableOptions,
+ Readable,
+ type DuplexEvents,
+ type DuplexOptions,
+ Duplex,
+ type TransformEvents,
+ type TransformOptions,
+ Transform,
+ Transform as PassThrough
+}
diff --git a/node_modules/streamx/index.js b/node_modules/streamx/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..6b1b03e686064c62bf0e659b889efe2524bff099
--- /dev/null
+++ b/node_modules/streamx/index.js
@@ -0,0 +1,1314 @@
+const { EventEmitter } = require('events-universal')
+const FIFO = require('fast-fifo')
+const TextDecoder = require('text-decoder')
+
+const StreamError = require('./lib/errors.js')
+
+// if we do a future major, expect queue microtask to be there always, for now a bit defensive
+const qmt =
+ typeof queueMicrotask === 'undefined' ? (fn) => global.process.nextTick(fn) : queueMicrotask
+
+// 29 bits used total (4 from shared, 14 from read, and 11 from write)
+const MAX = (1 << 29) - 1
+
+// Shared state
+const OPENING = 0b0001
+const PREDESTROYING = 0b0010
+const DESTROYING = 0b0100
+const DESTROYED = 0b1000
+
+const NOT_OPENING = MAX ^ OPENING
+const NOT_PREDESTROYING = MAX ^ PREDESTROYING
+
+// Read state (4 bit offset from shared state)
+const READ_ACTIVE = 0b00000000000001 << 4
+const READ_UPDATING = 0b00000000000010 << 4
+const READ_PRIMARY = 0b00000000000100 << 4
+const READ_QUEUED = 0b00000000001000 << 4
+const READ_RESUMED = 0b00000000010000 << 4
+const READ_PIPE_DRAINED = 0b00000000100000 << 4
+const READ_ENDING = 0b00000001000000 << 4
+const READ_EMIT_DATA = 0b00000010000000 << 4
+const READ_EMIT_READABLE = 0b00000100000000 << 4
+const READ_EMITTED_READABLE = 0b00001000000000 << 4
+const READ_DONE = 0b00010000000000 << 4
+const READ_NEXT_TICK = 0b00100000000000 << 4
+const READ_NEEDS_PUSH = 0b01000000000000 << 4
+const READ_READ_AHEAD = 0b10000000000000 << 4
+
+// Combined read state
+const READ_FLOWING = READ_RESUMED | READ_PIPE_DRAINED
+const READ_ACTIVE_AND_NEEDS_PUSH = READ_ACTIVE | READ_NEEDS_PUSH
+const READ_PRIMARY_AND_ACTIVE = READ_PRIMARY | READ_ACTIVE
+const READ_EMIT_READABLE_AND_QUEUED = READ_EMIT_READABLE | READ_QUEUED
+const READ_RESUMED_READ_AHEAD = READ_RESUMED | READ_READ_AHEAD
+
+const READ_NOT_ACTIVE = MAX ^ READ_ACTIVE
+const READ_NON_PRIMARY = MAX ^ READ_PRIMARY
+const READ_NON_PRIMARY_AND_PUSHED = MAX ^ (READ_PRIMARY | READ_NEEDS_PUSH)
+const READ_PUSHED = MAX ^ READ_NEEDS_PUSH
+const READ_PAUSED = MAX ^ READ_RESUMED
+const READ_NOT_QUEUED = MAX ^ (READ_QUEUED | READ_EMITTED_READABLE)
+const READ_NOT_ENDING = MAX ^ READ_ENDING
+const READ_PIPE_NOT_DRAINED = MAX ^ READ_FLOWING
+const READ_NOT_NEXT_TICK = MAX ^ READ_NEXT_TICK
+const READ_NOT_UPDATING = MAX ^ READ_UPDATING
+const READ_NO_READ_AHEAD = MAX ^ READ_READ_AHEAD
+const READ_PAUSED_NO_READ_AHEAD = MAX ^ READ_RESUMED_READ_AHEAD
+
+// Write state (18 bit offset, 4 bit offset from shared state and 14 from read state)
+const WRITE_ACTIVE = 0b00000000001 << 18
+const WRITE_UPDATING = 0b00000000010 << 18
+const WRITE_PRIMARY = 0b00000000100 << 18
+const WRITE_QUEUED = 0b00000001000 << 18
+const WRITE_UNDRAINED = 0b00000010000 << 18
+const WRITE_DONE = 0b00000100000 << 18
+const WRITE_EMIT_DRAIN = 0b00001000000 << 18
+const WRITE_NEXT_TICK = 0b00010000000 << 18
+const WRITE_WRITING = 0b00100000000 << 18
+const WRITE_FINISHING = 0b01000000000 << 18
+const WRITE_CORKED = 0b10000000000 << 18
+
+const WRITE_NOT_ACTIVE = MAX ^ (WRITE_ACTIVE | WRITE_WRITING)
+const WRITE_NON_PRIMARY = MAX ^ WRITE_PRIMARY
+const WRITE_NOT_FINISHING = MAX ^ (WRITE_ACTIVE | WRITE_FINISHING)
+const WRITE_DRAINED = MAX ^ WRITE_UNDRAINED
+const WRITE_NOT_QUEUED = MAX ^ WRITE_QUEUED
+const WRITE_NOT_NEXT_TICK = MAX ^ WRITE_NEXT_TICK
+const WRITE_NOT_UPDATING = MAX ^ WRITE_UPDATING
+const WRITE_NOT_CORKED = MAX ^ WRITE_CORKED
+
+// Combined shared state
+const ACTIVE = READ_ACTIVE | WRITE_ACTIVE
+const NOT_ACTIVE = MAX ^ ACTIVE
+const DONE = READ_DONE | WRITE_DONE
+const DESTROY_STATUS = DESTROYING | DESTROYED | PREDESTROYING
+const OPEN_STATUS = DESTROY_STATUS | OPENING
+const AUTO_DESTROY = DESTROY_STATUS | DONE
+const NON_PRIMARY = WRITE_NON_PRIMARY & READ_NON_PRIMARY
+const ACTIVE_OR_TICKING = WRITE_NEXT_TICK | READ_NEXT_TICK
+const TICKING = ACTIVE_OR_TICKING & NOT_ACTIVE
+const IS_OPENING = OPEN_STATUS | TICKING
+
+// Combined shared state and read state
+const READ_PRIMARY_STATUS = OPEN_STATUS | READ_ENDING | READ_DONE
+const READ_STATUS = OPEN_STATUS | READ_DONE | READ_QUEUED
+const READ_ENDING_STATUS = OPEN_STATUS | READ_ENDING | READ_QUEUED
+const READ_READABLE_STATUS = OPEN_STATUS | READ_EMIT_READABLE | READ_QUEUED | READ_EMITTED_READABLE
+const SHOULD_NOT_READ =
+ OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH | READ_READ_AHEAD
+const READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE
+const READ_UPDATE_SYNC_STATUS = READ_UPDATING | OPEN_STATUS | READ_NEXT_TICK | READ_PRIMARY
+const READ_NEXT_TICK_OR_OPENING = READ_NEXT_TICK | OPENING
+
+// Combined write state
+const WRITE_PRIMARY_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_DONE
+const WRITE_QUEUED_AND_UNDRAINED = WRITE_QUEUED | WRITE_UNDRAINED
+const WRITE_QUEUED_AND_ACTIVE = WRITE_QUEUED | WRITE_ACTIVE
+const WRITE_DRAIN_STATUS = WRITE_QUEUED | WRITE_UNDRAINED | OPEN_STATUS | WRITE_ACTIVE
+const WRITE_STATUS = OPEN_STATUS | WRITE_ACTIVE | WRITE_QUEUED | WRITE_CORKED
+const WRITE_PRIMARY_AND_ACTIVE = WRITE_PRIMARY | WRITE_ACTIVE
+const WRITE_ACTIVE_AND_WRITING = WRITE_ACTIVE | WRITE_WRITING
+const WRITE_FINISHING_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_QUEUED_AND_ACTIVE | WRITE_DONE
+const WRITE_BACKPRESSURE_STATUS = WRITE_UNDRAINED | DESTROY_STATUS | WRITE_FINISHING | WRITE_DONE
+const WRITE_UPDATE_SYNC_STATUS = WRITE_UPDATING | OPEN_STATUS | WRITE_NEXT_TICK | WRITE_PRIMARY
+const WRITE_DROP_DATA = WRITE_FINISHING | WRITE_DONE | DESTROY_STATUS
+
+const asyncIterator = Symbol.asyncIterator || Symbol('asyncIterator')
+
+class WritableState {
+ constructor(
+ stream,
+ { highWaterMark = 16384, map = null, mapWritable, byteLength, byteLengthWritable } = {}
+ ) {
+ this.stream = stream
+ this.queue = new FIFO()
+ this.highWaterMark = highWaterMark
+ this.buffered = 0
+ this.error = null
+ this.pipeline = null
+ this.drains = null // if we add more seldomly used helpers we might them into a subobject so its a single ptr
+ this.byteLength = byteLengthWritable || byteLength || defaultByteLength
+ this.map = mapWritable || map
+ this.afterWrite = afterWrite.bind(this)
+ this.afterUpdateNextTick = updateWriteNT.bind(this)
+ }
+
+ get ending() {
+ return (this.stream._duplexState & WRITE_FINISHING) !== 0
+ }
+
+ get ended() {
+ return (this.stream._duplexState & WRITE_DONE) !== 0
+ }
+
+ push(data) {
+ if ((this.stream._duplexState & WRITE_DROP_DATA) !== 0) return false
+ if (this.map !== null) data = this.map(data)
+
+ this.buffered += this.byteLength(data)
+ this.queue.push(data)
+
+ if (this.buffered < this.highWaterMark) {
+ this.stream._duplexState |= WRITE_QUEUED
+ return true
+ }
+
+ this.stream._duplexState |= WRITE_QUEUED_AND_UNDRAINED
+ return false
+ }
+
+ shift() {
+ const data = this.queue.shift()
+
+ this.buffered -= this.byteLength(data)
+ if (this.buffered === 0) this.stream._duplexState &= WRITE_NOT_QUEUED
+
+ return data
+ }
+
+ end(data) {
+ if (typeof data === 'function') {
+ this.stream.once('finish', data)
+ } else if (data !== undefined && data !== null) {
+ this.push(data)
+ }
+
+ this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY
+ }
+
+ autoBatch(data, cb) {
+ const buffer = []
+ const stream = this.stream
+
+ buffer.push(data)
+ while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED_AND_ACTIVE) {
+ buffer.push(stream._writableState.shift())
+ }
+
+ if ((stream._duplexState & OPEN_STATUS) !== 0) return cb(null)
+ stream._writev(buffer, cb)
+ }
+
+ update() {
+ const stream = this.stream
+
+ stream._duplexState |= WRITE_UPDATING
+
+ do {
+ while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED) {
+ const data = this.shift()
+ stream._duplexState |= WRITE_ACTIVE_AND_WRITING
+ stream._write(data, this.afterWrite)
+ }
+
+ if ((stream._duplexState & WRITE_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary()
+ } while (this.continueUpdate() === true)
+
+ stream._duplexState &= WRITE_NOT_UPDATING
+ }
+
+ updateNonPrimary() {
+ const stream = this.stream
+
+ if ((stream._duplexState & WRITE_FINISHING_STATUS) === WRITE_FINISHING) {
+ stream._duplexState = stream._duplexState | WRITE_ACTIVE
+ stream._final(afterFinal.bind(this))
+ return
+ }
+
+ if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
+ if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
+ stream._duplexState |= ACTIVE
+ stream._destroy(afterDestroy.bind(this))
+ }
+ return
+ }
+
+ if ((stream._duplexState & IS_OPENING) === OPENING) {
+ stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING
+ stream._open(afterOpen.bind(this))
+ }
+ }
+
+ continueUpdate() {
+ if ((this.stream._duplexState & WRITE_NEXT_TICK) === 0) return false
+ this.stream._duplexState &= WRITE_NOT_NEXT_TICK
+ return true
+ }
+
+ updateCallback() {
+ if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) {
+ this.update()
+ } else {
+ this.updateNextTick()
+ }
+ }
+
+ updateNextTick() {
+ if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return
+ this.stream._duplexState |= WRITE_NEXT_TICK
+ if ((this.stream._duplexState & WRITE_UPDATING) === 0) qmt(this.afterUpdateNextTick)
+ }
+}
+
+class ReadableState {
+ constructor(
+ stream,
+ { highWaterMark = 16384, map = null, mapReadable, byteLength, byteLengthReadable } = {}
+ ) {
+ this.stream = stream
+ this.queue = new FIFO()
+ this.highWaterMark = highWaterMark === 0 ? 1 : highWaterMark
+ this.buffered = 0
+ this.readAhead = highWaterMark > 0
+ this.error = null
+ this.pipeline = null
+ this.byteLength = byteLengthReadable || byteLength || defaultByteLength
+ this.map = mapReadable || map
+ this.pipeTo = null
+ this.afterRead = afterRead.bind(this)
+ this.afterUpdateNextTick = updateReadNT.bind(this)
+ }
+
+ get ending() {
+ return (this.stream._duplexState & READ_ENDING) !== 0
+ }
+
+ get ended() {
+ return (this.stream._duplexState & READ_DONE) !== 0
+ }
+
+ pipe(pipeTo, cb) {
+ if (this.pipeTo !== null) throw StreamError.BAD_ARGUMENT('Can only pipe to one destination')
+ if (typeof cb !== 'function') cb = null
+
+ this.stream._duplexState |= READ_PIPE_DRAINED
+ this.pipeTo = pipeTo
+ this.pipeline = new Pipeline(this.stream, pipeTo, cb)
+
+ if (cb) this.stream.on('error', noop) // We already error handle this so supress crashes
+
+ if (isStreamx(pipeTo)) {
+ pipeTo._writableState.pipeline = this.pipeline
+ if (cb) pipeTo.on('error', noop) // We already error handle this so supress crashes
+ pipeTo.on('finish', this.pipeline.finished.bind(this.pipeline)) // TODO: just call finished from pipeTo itself
+ } else {
+ const onerror = this.pipeline.done.bind(this.pipeline, pipeTo)
+ const onclose = this.pipeline.done.bind(this.pipeline, pipeTo, null) // onclose has a weird bool arg
+ pipeTo.on('error', onerror)
+ pipeTo.on('close', onclose)
+ pipeTo.on('finish', this.pipeline.finished.bind(this.pipeline))
+ }
+
+ pipeTo.on('drain', afterDrain.bind(this))
+ this.stream.emit('piping', pipeTo)
+ pipeTo.emit('pipe', this.stream)
+ }
+
+ push(data) {
+ const stream = this.stream
+
+ if (data === null) {
+ this.highWaterMark = 0
+ stream._duplexState = (stream._duplexState | READ_ENDING) & READ_NON_PRIMARY_AND_PUSHED
+ return false
+ }
+
+ if (this.map !== null) {
+ data = this.map(data)
+ if (data === null) {
+ stream._duplexState &= READ_PUSHED
+ return this.buffered < this.highWaterMark
+ }
+ }
+
+ this.buffered += this.byteLength(data)
+ this.queue.push(data)
+
+ stream._duplexState = (stream._duplexState | READ_QUEUED) & READ_PUSHED
+
+ return this.buffered < this.highWaterMark
+ }
+
+ shift() {
+ const data = this.queue.shift()
+
+ this.buffered -= this.byteLength(data)
+ if (this.buffered === 0) {
+ this.stream._duplexState &= READ_NOT_QUEUED
+ }
+
+ return data
+ }
+
+ unshift(data) {
+ const pending = [this.map !== null ? this.map(data) : data]
+ while (this.buffered > 0) pending.push(this.shift())
+
+ for (let i = 0; i < pending.length - 1; i++) {
+ const data = pending[i]
+ this.buffered += this.byteLength(data)
+ this.queue.push(data)
+ }
+
+ this.push(pending[pending.length - 1])
+ }
+
+ read() {
+ const stream = this.stream
+
+ if ((stream._duplexState & READ_STATUS) === READ_QUEUED) {
+ const data = this.shift()
+
+ if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
+ stream._duplexState &= READ_PIPE_NOT_DRAINED
+ }
+
+ if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
+ stream.emit('data', data)
+ }
+
+ return data
+ }
+
+ if (this.readAhead === false) {
+ stream._duplexState |= READ_READ_AHEAD
+ this.updateNextTick()
+ }
+
+ return null
+ }
+
+ drain() {
+ const stream = this.stream
+
+ while (
+ (stream._duplexState & READ_STATUS) === READ_QUEUED &&
+ (stream._duplexState & READ_FLOWING) !== 0
+ ) {
+ const data = this.shift()
+
+ if (this.pipeTo !== null && this.pipeTo.write(data) === false) {
+ stream._duplexState &= READ_PIPE_NOT_DRAINED
+ }
+
+ if ((stream._duplexState & READ_EMIT_DATA) !== 0) {
+ stream.emit('data', data)
+ }
+ }
+ }
+
+ update() {
+ const stream = this.stream
+
+ stream._duplexState |= READ_UPDATING
+
+ do {
+ this.drain()
+
+ while (
+ this.buffered < this.highWaterMark &&
+ (stream._duplexState & SHOULD_NOT_READ) === READ_READ_AHEAD
+ ) {
+ stream._duplexState |= READ_ACTIVE_AND_NEEDS_PUSH
+ stream._read(this.afterRead)
+ this.drain()
+ }
+
+ if ((stream._duplexState & READ_READABLE_STATUS) === READ_EMIT_READABLE_AND_QUEUED) {
+ stream._duplexState |= READ_EMITTED_READABLE
+ stream.emit('readable')
+ }
+
+ if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) {
+ this.updateNonPrimary()
+ }
+ } while (this.continueUpdate() === true)
+
+ stream._duplexState &= READ_NOT_UPDATING
+ }
+
+ updateNonPrimary() {
+ const stream = this.stream
+
+ if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) {
+ stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING
+ stream.emit('end')
+
+ if ((stream._duplexState & AUTO_DESTROY) === DONE) {
+ stream._duplexState |= DESTROYING
+ }
+
+ if (this.pipeTo !== null) {
+ this.pipeTo.end()
+ }
+ }
+
+ if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
+ if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
+ stream._duplexState |= ACTIVE
+ stream._destroy(afterDestroy.bind(this))
+ }
+ return
+ }
+
+ if ((stream._duplexState & IS_OPENING) === OPENING) {
+ stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING
+ stream._open(afterOpen.bind(this))
+ }
+ }
+
+ continueUpdate() {
+ if ((this.stream._duplexState & READ_NEXT_TICK) === 0) return false
+ this.stream._duplexState &= READ_NOT_NEXT_TICK
+ return true
+ }
+
+ updateCallback() {
+ if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) {
+ this.update()
+ } else {
+ this.updateNextTick()
+ }
+ }
+
+ updateNextTickIfOpen() {
+ if ((this.stream._duplexState & READ_NEXT_TICK_OR_OPENING) !== 0) return
+ this.stream._duplexState |= READ_NEXT_TICK
+ if ((this.stream._duplexState & READ_UPDATING) === 0) qmt(this.afterUpdateNextTick)
+ }
+
+ updateNextTick() {
+ if ((this.stream._duplexState & READ_NEXT_TICK) !== 0) return
+ this.stream._duplexState |= READ_NEXT_TICK
+ if ((this.stream._duplexState & READ_UPDATING) === 0) qmt(this.afterUpdateNextTick)
+ }
+}
+
+class TransformState {
+ constructor(stream) {
+ this.data = null
+ this.afterTransform = afterTransform.bind(stream)
+ this.afterFinal = null
+ }
+}
+
+class Pipeline {
+ constructor(src, dst, cb) {
+ this.from = src
+ this.to = dst
+ this.afterPipe = cb
+ this.error = null
+ this.pipeToFinished = false
+ }
+
+ finished() {
+ this.pipeToFinished = true
+ }
+
+ done(stream, err) {
+ if (err) this.error = err
+
+ if (stream === this.to) {
+ this.to = null
+
+ if (this.from !== null) {
+ if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) {
+ this.from.destroy(this.error || StreamError.PREMATURE_CLOSE('Writable stream closed'))
+ }
+ return
+ }
+ }
+
+ if (stream === this.from) {
+ this.from = null
+
+ if (this.to !== null) {
+ if ((stream._duplexState & READ_DONE) === 0) {
+ this.to.destroy(this.error || StreamError.PREMATURE_CLOSE('Readable stream closed'))
+ }
+ return
+ }
+ }
+
+ if (this.afterPipe !== null) this.afterPipe(this.error)
+ this.to = this.from = this.afterPipe = null
+ }
+}
+
+function afterDrain() {
+ this.stream._duplexState |= READ_PIPE_DRAINED
+ this.updateCallback()
+}
+
+function afterFinal(err) {
+ const stream = this.stream
+ if (err) stream.destroy(err)
+
+ if ((stream._duplexState & DESTROY_STATUS) === 0) {
+ stream._duplexState |= WRITE_DONE
+ stream.emit('finish')
+ }
+
+ if ((stream._duplexState & AUTO_DESTROY) === DONE) {
+ stream._duplexState |= DESTROYING
+ }
+
+ stream._duplexState &= WRITE_NOT_FINISHING
+
+ // no need to wait the extra tick here, so we short circuit that
+ if ((stream._duplexState & WRITE_UPDATING) === 0) {
+ this.update()
+ } else {
+ this.updateNextTick()
+ }
+}
+
+function afterDestroy(err) {
+ const stream = this.stream
+
+ if (!err && !StreamError.isStreamDestroyed(this.error)) err = this.error
+ if (err) stream.emit('error', err)
+
+ stream._duplexState |= DESTROYED
+ stream.emit('close')
+
+ const rs = stream._readableState
+ const ws = stream._writableState
+
+ if (rs !== null && rs.pipeline !== null) {
+ rs.pipeline.done(stream, err)
+ }
+
+ if (ws !== null) {
+ while (ws.drains !== null && ws.drains.length > 0) {
+ ws.drains.shift().resolve(false)
+ }
+
+ if (ws.pipeline !== null) {
+ ws.pipeline.done(stream, err)
+ }
+ }
+}
+
+function afterWrite(err) {
+ const stream = this.stream
+
+ if (err) stream.destroy(err)
+ stream._duplexState &= WRITE_NOT_ACTIVE
+
+ if (this.drains !== null) tickDrains(this.drains)
+
+ if ((stream._duplexState & WRITE_DRAIN_STATUS) === WRITE_UNDRAINED) {
+ stream._duplexState &= WRITE_DRAINED
+
+ if ((stream._duplexState & WRITE_EMIT_DRAIN) === WRITE_EMIT_DRAIN) {
+ stream.emit('drain')
+ }
+ }
+
+ this.updateCallback()
+}
+
+function afterRead(err) {
+ if (err) this.stream.destroy(err)
+ this.stream._duplexState &= READ_NOT_ACTIVE
+
+ if (this.readAhead === false && (this.stream._duplexState & READ_RESUMED) === 0) {
+ this.stream._duplexState &= READ_NO_READ_AHEAD
+ }
+
+ this.updateCallback()
+}
+
+function updateReadNT() {
+ if ((this.stream._duplexState & READ_UPDATING) === 0) {
+ this.stream._duplexState &= READ_NOT_NEXT_TICK
+ this.update()
+ }
+}
+
+function updateWriteNT() {
+ if ((this.stream._duplexState & WRITE_UPDATING) === 0) {
+ this.stream._duplexState &= WRITE_NOT_NEXT_TICK
+ this.update()
+ }
+}
+
+function tickDrains(drains) {
+ for (let i = 0; i < drains.length; i++) {
+ // drains.writes are monotonic, so if one is 0 its always the first one
+ if (--drains[i].writes === 0) {
+ drains.shift().resolve(true)
+ i--
+ }
+ }
+}
+
+function afterOpen(err) {
+ const stream = this.stream
+
+ if (err) stream.destroy(err)
+
+ if ((stream._duplexState & DESTROYING) === 0) {
+ if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) {
+ stream._duplexState |= READ_PRIMARY
+ }
+
+ if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) {
+ stream._duplexState |= WRITE_PRIMARY
+ }
+
+ stream.emit('open')
+ }
+
+ stream._duplexState &= NOT_ACTIVE
+
+ if (stream._writableState !== null) {
+ stream._writableState.updateCallback()
+ }
+
+ if (stream._readableState !== null) {
+ stream._readableState.updateCallback()
+ }
+}
+
+function afterTransform(err, data) {
+ if (data !== undefined && data !== null) this.push(data)
+ this._writableState.afterWrite(err)
+}
+
+function newListener(name) {
+ if (this._readableState !== null) {
+ if (name === 'data') {
+ this._duplexState |= READ_EMIT_DATA | READ_RESUMED_READ_AHEAD
+ this._readableState.updateNextTick()
+ }
+ if (name === 'readable') {
+ this._duplexState |= READ_EMIT_READABLE
+ this._readableState.updateNextTick()
+ }
+ }
+
+ if (this._writableState !== null) {
+ if (name === 'drain') {
+ this._duplexState |= WRITE_EMIT_DRAIN
+ this._writableState.updateNextTick()
+ }
+ }
+}
+
+class Stream extends EventEmitter {
+ constructor(opts) {
+ super()
+
+ this._duplexState = 0
+ this._readableState = null
+ this._writableState = null
+
+ if (opts) {
+ if (opts.open) this._open = opts.open
+ if (opts.destroy) this._destroy = opts.destroy
+ if (opts.predestroy) this._predestroy = opts.predestroy
+ if (opts.signal) opts.signal.addEventListener('abort', abort.bind(this))
+ }
+
+ this.on('newListener', newListener)
+ }
+
+ _open(cb) {
+ cb(null)
+ }
+
+ _destroy(cb) {
+ cb(null)
+ }
+
+ _predestroy() {
+ // does nothing
+ }
+
+ get readable() {
+ return this._readableState !== null ? true : undefined
+ }
+
+ get writable() {
+ return this._writableState !== null ? true : undefined
+ }
+
+ get destroyed() {
+ return (this._duplexState & DESTROYED) !== 0
+ }
+
+ get destroying() {
+ return (this._duplexState & DESTROY_STATUS) !== 0
+ }
+
+ destroy(err) {
+ if ((this._duplexState & DESTROY_STATUS) === 0) {
+ if (!err) err = StreamError.STREAM_DESTROYED()
+ this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY
+
+ if (this._readableState !== null) {
+ this._readableState.highWaterMark = 0
+ this._readableState.error = err
+ }
+
+ if (this._writableState !== null) {
+ this._writableState.highWaterMark = 0
+ this._writableState.error = err
+ }
+
+ this._duplexState |= PREDESTROYING
+ this._predestroy()
+ this._duplexState &= NOT_PREDESTROYING
+
+ if (this._readableState !== null) {
+ this._readableState.updateNextTick()
+ }
+
+ if (this._writableState !== null) {
+ this._writableState.updateNextTick()
+ }
+ }
+ }
+}
+
+class Readable extends Stream {
+ constructor(opts) {
+ super(opts)
+
+ this._duplexState |= OPENING | WRITE_DONE | READ_READ_AHEAD
+ this._readableState = new ReadableState(this, opts)
+
+ if (opts) {
+ if (this._readableState.readAhead === false) this._duplexState &= READ_NO_READ_AHEAD
+ if (opts.read) this._read = opts.read
+ if (opts.eagerOpen) this._readableState.updateNextTick()
+ if (opts.encoding) this.setEncoding(opts.encoding)
+ }
+ }
+
+ static deferred(fn, opts) {
+ const out = new PassThrough(opts)
+
+ fn()
+ .then((src) => {
+ if (src === null) return out.end()
+ if (out.destroying) return
+ pipeline(src, out, noop)
+ })
+ .catch((err) => out.destroy(err))
+
+ return out
+ }
+
+ setEncoding(encoding) {
+ const dec = new TextDecoder(encoding)
+ const map = this._readableState.map || echo
+ this._readableState.map = mapOrSkip
+ return this
+
+ function mapOrSkip(data) {
+ const next = dec.push(data)
+ return next === '' && (data.byteLength !== 0 || dec.remaining > 0) ? null : map(next)
+ }
+ }
+
+ _read(cb) {
+ cb(null)
+ }
+
+ pipe(dest, cb) {
+ this._readableState.updateNextTick()
+ this._readableState.pipe(dest, cb)
+ return dest
+ }
+
+ read() {
+ this._readableState.updateNextTick()
+ return this._readableState.read()
+ }
+
+ push(data) {
+ this._readableState.updateNextTickIfOpen()
+ return this._readableState.push(data)
+ }
+
+ unshift(data) {
+ this._readableState.updateNextTickIfOpen()
+ return this._readableState.unshift(data)
+ }
+
+ resume() {
+ this._duplexState |= READ_RESUMED_READ_AHEAD
+ this._readableState.updateNextTick()
+ return this
+ }
+
+ pause() {
+ this._duplexState &=
+ this._readableState.readAhead === false ? READ_PAUSED_NO_READ_AHEAD : READ_PAUSED
+ return this
+ }
+
+ static _fromAsyncIterator(ite, opts) {
+ let destroy
+
+ const rs = new Readable({
+ ...opts,
+ read(cb) {
+ ite.next().then(push).then(cb.bind(null, null)).catch(cb)
+ },
+ predestroy() {
+ destroy = ite.return()
+ },
+ destroy(cb) {
+ if (!destroy) return cb(null)
+ destroy.then(cb.bind(null, null)).catch(cb)
+ }
+ })
+
+ return rs
+
+ function push(data) {
+ if (data.done) rs.push(null)
+ else rs.push(data.value)
+ }
+ }
+
+ static from(data, opts) {
+ if (isReadStreamx(data)) return data
+ if (data[asyncIterator]) return this._fromAsyncIterator(data[asyncIterator](), opts)
+ if (!Array.isArray(data)) data = data === undefined ? [] : [data]
+
+ let i = 0
+ return new Readable({
+ ...opts,
+ read(cb) {
+ this.push(i === data.length ? null : data[i++])
+ cb(null)
+ }
+ })
+ }
+
+ static isBackpressured(rs) {
+ return (
+ (rs._duplexState & READ_BACKPRESSURE_STATUS) !== 0 ||
+ rs._readableState.buffered >= rs._readableState.highWaterMark
+ )
+ }
+
+ static isPaused(rs) {
+ return (rs._duplexState & READ_RESUMED) === 0
+ }
+
+ [asyncIterator]() {
+ const stream = this
+
+ let error = null
+ let promiseResolve = null
+ let promiseReject = null
+
+ this.on('error', (err) => {
+ error = err
+ })
+ this.on('readable', onreadable)
+ this.on('close', onclose)
+
+ return {
+ [asyncIterator]() {
+ return this
+ },
+ next() {
+ return new Promise(function (resolve, reject) {
+ promiseResolve = resolve
+ promiseReject = reject
+ const data = stream.read()
+ if (data !== null) ondata(data)
+ else if ((stream._duplexState & DESTROYED) !== 0) ondata(null)
+ })
+ },
+ return() {
+ return destroy(null)
+ },
+ throw(err) {
+ return destroy(err)
+ }
+ }
+
+ function onreadable() {
+ if (promiseResolve !== null) ondata(stream.read())
+ }
+
+ function onclose() {
+ if (promiseResolve !== null) ondata(null)
+ }
+
+ function ondata(data) {
+ if (promiseReject === null) return
+ if (error) {
+ promiseReject(error)
+ } else if (data === null && (stream._duplexState & READ_DONE) === 0) {
+ promiseReject(StreamError.STREAM_DESTROYED())
+ } else {
+ promiseResolve({ value: data, done: data === null })
+ }
+ promiseReject = promiseResolve = null
+ }
+
+ function destroy(err) {
+ stream.destroy(err)
+ return new Promise((resolve, reject) => {
+ if (stream._duplexState & DESTROYED) return resolve({ value: undefined, done: true })
+ stream.once('close', function () {
+ if (err) reject(err)
+ else resolve({ value: undefined, done: true })
+ })
+ })
+ }
+ }
+}
+
+class Writable extends Stream {
+ constructor(opts) {
+ super(opts)
+
+ this._duplexState |= OPENING | READ_DONE
+ this._writableState = new WritableState(this, opts)
+
+ if (opts) {
+ if (opts.writev) this._writev = opts.writev
+ if (opts.write) this._write = opts.write
+ if (opts.final) this._final = opts.final
+ if (opts.eagerOpen) this._writableState.updateNextTick()
+ }
+ }
+
+ cork() {
+ this._duplexState |= WRITE_CORKED
+ }
+
+ uncork() {
+ this._duplexState &= WRITE_NOT_CORKED
+ this._writableState.updateNextTick()
+ }
+
+ _writev(batch, cb) {
+ cb(null)
+ }
+
+ _write(data, cb) {
+ this._writableState.autoBatch(data, cb)
+ }
+
+ _final(cb) {
+ cb(null)
+ }
+
+ static isBackpressured(ws) {
+ return (ws._duplexState & WRITE_BACKPRESSURE_STATUS) !== 0
+ }
+
+ static drained(ws) {
+ if (ws.destroyed) return Promise.resolve(false)
+
+ const state = ws._writableState
+ const pending = isWritev(ws) ? Math.min(1, state.queue.length) : state.queue.length
+ const writes = pending + (ws._duplexState & WRITE_WRITING ? 1 : 0)
+ if (writes === 0) return Promise.resolve(true)
+
+ if (state.drains === null) state.drains = []
+ return new Promise((resolve) => {
+ state.drains.push({ writes, resolve })
+ })
+ }
+
+ write(data) {
+ this._writableState.updateNextTick()
+ return this._writableState.push(data)
+ }
+
+ end(data) {
+ this._writableState.updateNextTick()
+ this._writableState.end(data)
+ return this
+ }
+}
+
+class Duplex extends Readable {
+ // and Writable
+ constructor(opts) {
+ super(opts)
+
+ this._duplexState = OPENING | (this._duplexState & READ_READ_AHEAD)
+ this._writableState = new WritableState(this, opts)
+
+ if (opts) {
+ if (opts.writev) this._writev = opts.writev
+ if (opts.write) this._write = opts.write
+ if (opts.final) this._final = opts.final
+ }
+ }
+
+ cork() {
+ this._duplexState |= WRITE_CORKED
+ }
+
+ uncork() {
+ this._duplexState &= WRITE_NOT_CORKED
+ this._writableState.updateNextTick()
+ }
+
+ _writev(batch, cb) {
+ cb(null)
+ }
+
+ _write(data, cb) {
+ this._writableState.autoBatch(data, cb)
+ }
+
+ _final(cb) {
+ cb(null)
+ }
+
+ write(data) {
+ this._writableState.updateNextTick()
+ return this._writableState.push(data)
+ }
+
+ end(data) {
+ this._writableState.updateNextTick()
+ this._writableState.end(data)
+ return this
+ }
+}
+
+class Transform extends Duplex {
+ constructor(opts) {
+ super(opts)
+ this._transformState = new TransformState(this)
+
+ if (opts) {
+ if (opts.transform) this._transform = opts.transform
+ if (opts.flush) this._flush = opts.flush
+ }
+ }
+
+ _write(data, cb) {
+ if (this._readableState.buffered >= this._readableState.highWaterMark) {
+ this._transformState.data = data
+ } else {
+ this._transform(data, this._transformState.afterTransform)
+ }
+ }
+
+ _read(cb) {
+ if (this._transformState.data !== null) {
+ const data = this._transformState.data
+ this._transformState.data = null
+ cb(null)
+ this._transform(data, this._transformState.afterTransform)
+ } else {
+ cb(null)
+ }
+ }
+
+ destroy(err) {
+ super.destroy(err)
+ if (this._transformState.data !== null) {
+ this._transformState.data = null
+ this._transformState.afterTransform()
+ }
+ }
+
+ _transform(data, cb) {
+ cb(null, data)
+ }
+
+ _flush(cb) {
+ cb(null)
+ }
+
+ _final(cb) {
+ this._transformState.afterFinal = cb
+ this._flush(transformAfterFlush.bind(this))
+ }
+}
+
+class PassThrough extends Transform {}
+
+function transformAfterFlush(err, data) {
+ const cb = this._transformState.afterFinal
+ if (err) return cb(err)
+
+ if (data !== null && data !== undefined) this.push(data)
+ this.push(null)
+ cb(null)
+}
+
+function pipelinePromise(...streams) {
+ return new Promise((resolve, reject) => {
+ return pipeline(...streams, (err) => {
+ if (err) return reject(err)
+ resolve()
+ })
+ })
+}
+
+function pipeline(stream, ...streams) {
+ const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams]
+ const done = all.length && typeof all[all.length - 1] === 'function' ? all.pop() : null
+
+ if (all.length < 2) throw StreamError.BAD_ARGUMENT('Pipeline requires at least 2 streams')
+
+ let src = all[0]
+ let dest = null
+ let error = null
+
+ for (let i = 1; i < all.length; i++) {
+ dest = all[i]
+
+ if (isStreamx(src)) {
+ src.pipe(dest, onerror)
+ } else {
+ errorHandle(src, true, i > 1, onerror)
+ src.pipe(dest)
+ }
+
+ src = dest
+ }
+
+ if (done) {
+ let fin = false
+
+ const autoDestroy =
+ isStreamx(dest) || !!(dest._writableState && dest._writableState.autoDestroy)
+
+ dest.on('error', (err) => {
+ if (error === null) error = err
+ })
+
+ dest.on('finish', () => {
+ fin = true
+ if (!autoDestroy) done(error)
+ })
+
+ if (autoDestroy) {
+ dest.on('close', () => done(error || (fin ? null : StreamError.PREMATURE_CLOSE())))
+ }
+ }
+
+ return dest
+
+ function errorHandle(s, rd, wr, onerror) {
+ s.on('error', onerror)
+ s.on('close', onclose)
+
+ function onclose() {
+ if (rd && s._readableState && !s._readableState.ended) {
+ return onerror(StreamError.PREMATURE_CLOSE())
+ }
+ if (wr && s._writableState && !s._writableState.ended) {
+ return onerror(StreamError.PREMATURE_CLOSE())
+ }
+ }
+ }
+
+ function onerror(err) {
+ if (!err || error) return
+ error = err
+
+ for (const s of all) {
+ s.destroy(err)
+ }
+ }
+}
+
+function echo(s) {
+ return s
+}
+
+function isStream(stream) {
+ return !!stream._readableState || !!stream._writableState
+}
+
+function isStreamx(stream) {
+ return typeof stream._duplexState === 'number' && isStream(stream)
+}
+
+function isEnding(stream) {
+ return !!stream._readableState && stream._readableState.ending
+}
+
+function isEnded(stream) {
+ return !!stream._readableState && stream._readableState.ended
+}
+
+function isFinishing(stream) {
+ return !!stream._writableState && stream._writableState.ending
+}
+
+function isFinished(stream) {
+ return !!stream._writableState && stream._writableState.ended
+}
+
+function getStreamError(stream, opts = {}) {
+ const err =
+ (stream._readableState && stream._readableState.error) ||
+ (stream._writableState && stream._writableState.error)
+
+ // avoid implicit errors by default
+ return !opts.all && StreamError.isStreamDestroyed(err) ? null : err
+}
+
+function isReadStreamx(stream) {
+ return isStreamx(stream) && stream.readable
+}
+
+function isDisturbed(stream) {
+ return (
+ (stream._duplexState & OPENING) !== OPENING ||
+ (stream._duplexState & DESTROYING) === DESTROYING ||
+ (stream._duplexState & ACTIVE_OR_TICKING) !== 0
+ )
+}
+
+function isTypedArray(data) {
+ return typeof data === 'object' && data !== null && typeof data.byteLength === 'number'
+}
+
+function defaultByteLength(data) {
+ return isTypedArray(data) ? data.byteLength : 1024
+}
+
+function noop() {}
+
+function abort() {
+ this.destroy(StreamError.ABORTED())
+}
+
+function isWritev(s) {
+ return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev
+}
+
+module.exports = {
+ pipeline,
+ pipelinePromise,
+ isStream,
+ isStreamx,
+ isEnding,
+ isEnded,
+ isFinishing,
+ isFinished,
+ isDisturbed,
+ getStreamError,
+ Stream,
+ Writable,
+ Readable,
+ Duplex,
+ Transform,
+ // Export PassThrough for compatibility with Node.js core's stream module
+ PassThrough
+}
diff --git a/node_modules/streamx/lib/errors.d.ts b/node_modules/streamx/lib/errors.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e3464f5f9e0e0c727f0df7209f623633f03803c4
--- /dev/null
+++ b/node_modules/streamx/lib/errors.d.ts
@@ -0,0 +1,13 @@
+declare class StreamError extends Error {
+ readonly code: string
+
+ static isStreamDestroyed(err: Error | null): boolean
+ static isPrematureClose(err: Error | null): boolean
+ static isAborted(err: Error | null): boolean
+
+ static STREAM_DESTROYED(): StreamError
+ static PREMATURE_CLOSE(): StreamError
+ static ABORTED(): StreamError
+}
+
+export = StreamError
diff --git a/node_modules/streamx/lib/errors.js b/node_modules/streamx/lib/errors.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a19df942a425b5aa1ef12226d026ad1d2a148af
--- /dev/null
+++ b/node_modules/streamx/lib/errors.js
@@ -0,0 +1,47 @@
+module.exports = class StreamError extends Error {
+ constructor(msg, code, fn = StreamError) {
+ super(msg)
+
+ this.code = code
+
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, fn)
+ }
+ }
+
+ static isStreamDestroyed(err) {
+ return err && err.code === 'STREAM_DESTROYED'
+ }
+
+ static isPrematureClose(err) {
+ return err && err.code === 'PREMATURE_CLOSE'
+ }
+
+ static isAborted(err) {
+ return err && err.code === 'ABORTED'
+ }
+
+ static isBadArgument(err) {
+ return err && err.code === 'BAD_ARGUMENT'
+ }
+
+ get name() {
+ return 'StreamError'
+ }
+
+ static STREAM_DESTROYED() {
+ return new StreamError('Stream was destroyed', 'STREAM_DESTROYED', StreamError.STREAM_DESTROYED)
+ }
+
+ static PREMATURE_CLOSE(msg = 'Premature close') {
+ return new StreamError(msg, 'PREMATURE_CLOSE', StreamError.PREMATURE_CLOSE)
+ }
+
+ static ABORTED() {
+ return new StreamError('Stream aborted', 'ABORTED', StreamError.ABORTED)
+ }
+
+ static BAD_ARGUMENT(msg = 'Bad argument') {
+ return new StreamError(msg, 'BAD_ARGUMENT', StreamError.BAD_ARGUMENT)
+ }
+}
diff --git a/node_modules/streamx/package.json b/node_modules/streamx/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..7657f46508bc5fb65d33fd84163394a08b0acdab
--- /dev/null
+++ b/node_modules/streamx/package.json
@@ -0,0 +1,51 @@
+{
+ "name": "streamx",
+ "version": "2.28.0",
+ "description": "An iteration of the Node.js core streams with a series of improvements",
+ "main": "index.js",
+ "exports": {
+ ".": {
+ "types": "./index.d.ts",
+ "default": "./index.js"
+ },
+ "./package": "./package.json",
+ "./errors": {
+ "types": "./lib/errors.d.ts",
+ "default": "./lib/errors"
+ }
+ },
+ "dependencies": {
+ "events-universal": "^1.0.0",
+ "fast-fifo": "^1.3.2",
+ "text-decoder": "^1.1.0"
+ },
+ "devDependencies": {
+ "b4a": "^1.6.6",
+ "brittle": "^3.1.1",
+ "end-of-stream": "^1.4.4",
+ "lunte": "^1.8.0",
+ "prettier": "^3.6.2",
+ "prettier-config-holepunch": "^2.0.0"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts",
+ "runtime.d.ts",
+ "lib"
+ ],
+ "scripts": {
+ "format": "prettier . --write",
+ "test": "brittle test/all.js && brittle-bare test/all.js",
+ "lint": "prettier . --check && lunte"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mafintosh/streamx.git"
+ },
+ "author": "Mathias Buus (@mafintosh)",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/mafintosh/streamx/issues"
+ },
+ "homepage": "https://github.com/mafintosh/streamx"
+}
diff --git a/node_modules/streamx/runtime.d.ts b/node_modules/streamx/runtime.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..204685a3699249d18955bdf307c3d84045ced71d
--- /dev/null
+++ b/node_modules/streamx/runtime.d.ts
@@ -0,0 +1,55 @@
+type BufferEncoding =
+ | 'ascii'
+ | 'base64'
+ | 'binary'
+ | 'hex'
+ | 'latin1'
+ | 'ucs-2'
+ | 'ucs2'
+ | 'utf-16le'
+ | 'utf-8'
+ | 'utf16le'
+ | 'utf8'
+
+interface EventMap {
+ [event: string | symbol]: unknown[]
+}
+
+interface EventHandler {
+ (...args: A): R
+}
+
+interface EventEmitter {
+ addListener(name: E, fn: EventHandler): this
+
+ addOnceListener(name: E, fn: EventHandler): this
+
+ prependListener(name: E, fn: EventHandler): this
+
+ prependOnceListener(name: E, fn: EventHandler): this
+
+ removeListener(name: E, fn: EventHandler): this
+
+ removeAllListeners(name?: E): this
+
+ on(name: E, fn: EventHandler): this
+
+ once(name: E, fn: EventHandler): this
+
+ off(name: E, fn: EventHandler): this
+
+ emit(name: E, ...args: M[E]): boolean
+
+ listeners(name: E): EventHandler
+
+ rawListeners(name: E): EventHandler[]
+
+ eventNames(): (keyof M)[]
+
+ listenerCount(name: E): number
+
+ getMaxListeners(): number
+ setMaxListeners(n: number): void
+}
+
+export { BufferEncoding, EventMap, EventEmitter }
diff --git a/node_modules/strict-event-emitter/README.md b/node_modules/strict-event-emitter/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..c972baacd488a347733c713f49b85b03d60b2ef5
--- /dev/null
+++ b/node_modules/strict-event-emitter/README.md
@@ -0,0 +1,79 @@
+# Strict Event Emitter
+
+A type-safe implementation of `EventEmitter` for browser and Node.js.
+
+## Motivation
+
+Despite event emitters potentially accepting any runtime value, defining a strict event contract is crucial when developing complex event-driven architectures. Unfortunately, the native type definitions for Node's `EventEmitter` annotate event names as `string`, which forbids any stricter type validation.
+
+```js
+// index.js
+const emitter = new EventEmitter()
+
+// Let's say our application expects a "ping"
+// event with the number payload.
+emitter.on('ping', (n: number) => {})
+
+// We can, however, emit a different event by mistake.
+emitter.emit('pong', 1)
+
+// Or even the correct event with the wrong data.
+emitter.emit('ping', 'wait, not a number')
+```
+
+The purpose of this library is to provide an `EventEmitter` instance that can accept a generic describing the expected events contract.
+
+```ts
+import { Emitter } from 'strict-event-emitter'
+
+// Define a strict events contract where keys
+// represent event names and values represent
+// the list of arguments expected in ".emit()".
+type Events = {
+ ping: [number]
+}
+
+const emitter = new Emitter()
+emitter.addListener('ping', (n) => {
+ // "n" argument type is inferred as "number'.
+})
+
+emitter.emit('ping', 10) // OK
+emitter.emit('unknown', 10) // TypeError (invalid event name)
+emitter.emit('ping', 'wait, not a number') // TypeError (invalid data)
+```
+
+This library is also a custom `EventEmitter` implementation, which makes it compatible with other environments, like browsers or React Native.
+
+## Getting started
+
+### Install
+
+```bash
+npm install strict-event-emitter
+```
+
+### Use
+
+```ts
+import { Emitter } from 'strict-event-emitter'
+
+// 1. Define an interface that describes your events.
+// Set event names as the keys, and their expected payloads as values.
+interface Events {
+ connect: [id: string]
+ disconnect: [id: string]
+}
+
+// 2. Create a strict emitter and pass the previously defined "Events"
+// as its first generic argument.
+const emitter = new Emitter()
+
+// 3. Use the "emitter" the same way you'd use the regular "EventEmitter" instance.
+emitter.addListener('connect', (id) => {})
+emitter.emit('connect', 'abc-123')
+```
+
+## License
+
+MIT
diff --git a/node_modules/strict-event-emitter/lib/index.d.ts b/node_modules/strict-event-emitter/lib/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7068ce7ba148a872781e2ff1ce8160a77e05fb50
--- /dev/null
+++ b/node_modules/strict-event-emitter/lib/index.d.ts
@@ -0,0 +1,81 @@
+declare type EventMap = {
+ [eventName: string]: Array;
+};
+declare type InternalEventNames = 'newListener' | 'removeListener';
+declare type InternalListener = Listener<[
+ eventName: keyof Events,
+ listener: Listener>
+]>;
+declare type Listener> = (...data: Data) => void;
+/**
+ * Node.js-compatible implementation of `EventEmitter`.
+ *
+ * @example
+ * const emitter = new Emitter<{ hello: [string] }>()
+ * emitter.on('hello', (name) => console.log(name))
+ * emitter.emit('hello', 'John')
+ */
+declare class Emitter {
+ private events;
+ private maxListeners;
+ private hasWarnedAboutPotentialMemoryLeak;
+ static defaultMaxListeners: number;
+ static listenerCount(emitter: Emitter, eventName: keyof Events): number;
+ constructor();
+ private _emitInternalEvent;
+ private _getListeners;
+ private _removeListener;
+ private _wrapOnceListener;
+ setMaxListeners(maxListeners: number): this;
+ /**
+ * Returns the current max listener value for the `Emitter` which is
+ * either set by `emitter.setMaxListeners(n)` or defaults to
+ * `Emitter.defaultMaxListeners`.
+ */
+ getMaxListeners(): number;
+ /**
+ * Returns an array listing the events for which the emitter has registered listeners.
+ * The values in the array will be strings or Symbols.
+ */
+ eventNames(): Array;
+ /**
+ * Synchronously calls each of the listeners registered for the event named `eventName`,
+ * in the order they were registered, passing the supplied arguments to each.
+ * Returns `true` if the event has listeners, `false` otherwise.
+ *
+ * @example
+ * const emitter = new Emitter<{ hello: [string] }>()
+ * emitter.emit('hello', 'John')
+ */
+ emit(eventName: EventName, ...data: Events[EventName]): boolean;
+ addListener(eventName: InternalEventNames, listener: InternalListener): this;
+ addListener(eventName: EventName, listener: Listener): this;
+ on(eventName: InternalEventNames, listener: InternalListener): this;
+ on(eventName: EventName, listener: Listener): this;
+ once(eventName: InternalEventNames, listener: InternalListener): this;
+ once(eventName: EventName, listener: Listener): this;
+ prependListener(eventName: InternalEventNames, listener: InternalListener): this;
+ prependListener(eventName: EventName, listener: Listener): this;
+ prependOnceListener(eventName: InternalEventNames, listener: InternalListener): this;
+ prependOnceListener(eventName: EventName, listener: Listener): this;
+ removeListener(eventName: InternalEventNames, listener: InternalListener): this;
+ removeListener(eventName: EventName, listener: Listener): this;
+ off(eventName: InternalEventNames, listener: InternalListener): this;
+ off(eventName: EventName, listener: Listener): this;
+ removeAllListeners(eventName?: InternalEventNames): this;
+ removeAllListeners(eventName?: EventName): this;
+ listeners(eventName: InternalEventNames): Array>;
+ listeners(eventName: EventName): Array>;
+ listenerCount(eventName: InternalEventNames): number;
+ listenerCount(eventName: EventName): number;
+ rawListeners(eventName: EventName): Array