+
+## Layout DSL
+
+cliui exposes a simple layout DSL:
+
+If you create a single `ui.div`, passing a string rather than an
+object:
+
+* `\n`: characters will be interpreted as new rows.
+* `\t`: characters will be interpreted as new columns.
+* `\s`: characters will be interpreted as padding.
+
+**as an example...**
+
+```js
+var ui = require('./')({
+ width: 60
+})
+
+ui.div(
+ 'Usage: node ./bin/foo.js\n' +
+ ' through2([ options, ] [ transformFunction ] [, flushFunction ])
+
+Consult the **[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`).
+
+### options
+
+The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`).
+
+The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call:
+
+```js
+fs.createReadStream('/tmp/important.dat')
+ .pipe(through2({ objectMode: true, allowHalfOpen: false },
+ (chunk, enc, cb) => {
+ cb(null, 'wut?') // note we can use the second argument on the callback
+ // to provide data as an alternative to this.push('wut?')
+ }
+ )
+ .pipe(fs.createWriteStream('/tmp/wut.txt'))
+```
+
+### transformFunction
+
+The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk.
+
+To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on.
+
+Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error.
+
+If you **do not provide a `transformFunction`** then you will get a simple pass-through stream.
+
+### flushFunction
+
+The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress.
+
+```js
+fs.createReadStream('/tmp/important.dat')
+ .pipe(through2(
+ (chunk, enc, cb) => cb(null, chunk), // transform is a noop
+ function (cb) { // flush function
+ this.push('tacking on an extra buffer to the end');
+ cb();
+ }
+ ))
+ .pipe(fs.createWriteStream('/tmp/wut.txt'));
+```
+
+through2.ctor([ options, ] transformFunction[, flushFunction ])
+
+Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances.
+
+```js
+var FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) {
+ if (record.temp != null && record.unit == "F") {
+ record.temp = ( ( record.temp - 32 ) * 5 ) / 9
+ record.unit = "C"
+ }
+ this.push(record)
+ callback()
+})
+
+// Create instances of FToC like so:
+var converter = new FToC()
+// Or:
+var converter = FToC()
+// Or specify/override options when you instantiate, if you prefer:
+var converter = FToC({objectMode: true})
+```
+
+## See Also
+
+ - [through2-map](https://github.com/brycebaril/through2-map) - Array.prototype.map analog for streams.
+ - [through2-filter](https://github.com/brycebaril/through2-filter) - Array.prototype.filter analog for streams.
+ - [through2-reduce](https://github.com/brycebaril/through2-reduce) - Array.prototype.reduce analog for streams.
+ - [through2-spy](https://github.com/brycebaril/through2-spy) - Wrapper for simple stream.PassThrough spies.
+ - the [mississippi stream utility collection](https://github.com/maxogden/mississippi) includes `through2` as well as many more useful stream modules similar to this one
+
+## License
+
+**through2** is Copyright (c) Rod Vagg [@rvagg](https://twitter.com/rvagg) and additional contributors and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/.npmignore b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/.npmignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/.travis.yml b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/.travis.yml
new file mode 100644
index 0000000..cc4dba2
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+node_js:
+ - "0.8"
+ - "0.10"
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/Makefile b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/Makefile
new file mode 100644
index 0000000..787d56e
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/Makefile
@@ -0,0 +1,6 @@
+
+test:
+ @node_modules/.bin/tape test.js
+
+.PHONY: test
+
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/README.md b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/README.md
new file mode 100644
index 0000000..16d2c59
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/README.md
@@ -0,0 +1,60 @@
+
+# isarray
+
+`Array#isArray` for older browsers.
+
+[](http://travis-ci.org/juliangruber/isarray)
+[](https://www.npmjs.org/package/isarray)
+
+[
+](https://ci.testling.com/juliangruber/isarray)
+
+## Usage
+
+```js
+var isArray = require('isarray');
+
+console.log(isArray([])); // => true
+console.log(isArray({})); // => false
+```
+
+## Installation
+
+With [npm](http://npmjs.org) do
+
+```bash
+$ npm install isarray
+```
+
+Then bundle for the browser with
+[browserify](https://github.com/substack/browserify).
+
+With [component](http://component.io) do
+
+```bash
+$ component install juliangruber/isarray
+```
+
+## License
+
+(MIT)
+
+Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
+
+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/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/component.json b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/component.json
new file mode 100644
index 0000000..9e31b68
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/component.json
@@ -0,0 +1,19 @@
+{
+ "name" : "isarray",
+ "description" : "Array#isArray for older browsers",
+ "version" : "0.0.1",
+ "repository" : "juliangruber/isarray",
+ "homepage": "https://github.com/juliangruber/isarray",
+ "main" : "index.js",
+ "scripts" : [
+ "index.js"
+ ],
+ "dependencies" : {},
+ "keywords": ["browser","isarray","array"],
+ "author": {
+ "name": "Julian Gruber",
+ "email": "mail@juliangruber.com",
+ "url": "http://juliangruber.com"
+ },
+ "license": "MIT"
+}
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/index.js b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/index.js
new file mode 100644
index 0000000..a57f634
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/index.js
@@ -0,0 +1,5 @@
+var toString = {}.toString;
+
+module.exports = Array.isArray || function (arr) {
+ return toString.call(arr) == '[object Array]';
+};
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/package.json b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/package.json
new file mode 100644
index 0000000..1a4317a
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "isarray",
+ "description": "Array#isArray for older browsers",
+ "version": "1.0.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/juliangruber/isarray.git"
+ },
+ "homepage": "https://github.com/juliangruber/isarray",
+ "main": "index.js",
+ "dependencies": {},
+ "devDependencies": {
+ "tape": "~2.13.4"
+ },
+ "keywords": [
+ "browser",
+ "isarray",
+ "array"
+ ],
+ "author": {
+ "name": "Julian Gruber",
+ "email": "mail@juliangruber.com",
+ "url": "http://juliangruber.com"
+ },
+ "license": "MIT",
+ "testling": {
+ "files": "test.js",
+ "browsers": [
+ "ie/8..latest",
+ "firefox/17..latest",
+ "firefox/nightly",
+ "chrome/22..latest",
+ "chrome/canary",
+ "opera/12..latest",
+ "opera/next",
+ "safari/5.1..latest",
+ "ipad/6.0..latest",
+ "iphone/6.0..latest",
+ "android-browser/4.2..latest"
+ ]
+ },
+ "scripts": {
+ "test": "tape test.js"
+ }
+}
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/test.js b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/test.js
new file mode 100644
index 0000000..e0c3444
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/isarray/test.js
@@ -0,0 +1,20 @@
+var isArray = require('./');
+var test = require('tape');
+
+test('is array', function(t){
+ t.ok(isArray([]));
+ t.notOk(isArray({}));
+ t.notOk(isArray(null));
+ t.notOk(isArray(false));
+
+ var obj = {};
+ obj[0] = true;
+ t.notOk(isArray(obj));
+
+ var arr = [];
+ arr.foo = 'bar';
+ t.ok(isArray(arr));
+
+ t.end();
+});
+
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/.travis.yml b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/.travis.yml
new file mode 100644
index 0000000..f62cdac
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/.travis.yml
@@ -0,0 +1,34 @@
+sudo: false
+language: node_js
+before_install:
+ - (test $NPM_LEGACY && npm install -g npm@2 && npm install -g npm@3) || true
+notifications:
+ email: false
+matrix:
+ fast_finish: true
+ include:
+ - node_js: '0.8'
+ env: NPM_LEGACY=true
+ - node_js: '0.10'
+ env: NPM_LEGACY=true
+ - node_js: '0.11'
+ env: NPM_LEGACY=true
+ - node_js: '0.12'
+ env: NPM_LEGACY=true
+ - node_js: 1
+ env: NPM_LEGACY=true
+ - node_js: 2
+ env: NPM_LEGACY=true
+ - node_js: 3
+ env: NPM_LEGACY=true
+ - node_js: 4
+ - node_js: 5
+ - node_js: 6
+ - node_js: 7
+ - node_js: 8
+ - node_js: 9
+script: "npm run test"
+env:
+ global:
+ - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc=
+ - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI=
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/CONTRIBUTING.md b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/CONTRIBUTING.md
new file mode 100644
index 0000000..f478d58
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/CONTRIBUTING.md
@@ -0,0 +1,38 @@
+# Developer's Certificate of Origin 1.1
+
+By making a contribution to this project, I certify that:
+
+* (a) The contribution was created in whole or in part by me and I
+ have the right to submit it under the open source license
+ indicated in the file; or
+
+* (b) The contribution is based upon previous work that, to the best
+ of my knowledge, is covered under an appropriate open source
+ license and I have the right under that license to submit that
+ work with modifications, whether created in whole or in part
+ by me, under the same open source license (unless I am
+ permitted to submit under a different license), as indicated
+ in the file; or
+
+* (c) The contribution was provided directly to me by some other
+ person who certified (a), (b) or (c) and I have not modified
+ it.
+
+* (d) I understand and agree that this project and the contribution
+ are public and that a record of the contribution (including all
+ personal information I submit with it, including my sign-off) is
+ maintained indefinitely and may be redistributed consistent with
+ this project or the open source license(s) involved.
+
+## Moderation Policy
+
+The [Node.js Moderation Policy] applies to this WG.
+
+## Code of Conduct
+
+The [Node.js Code of Conduct][] applies to this WG.
+
+[Node.js Code of Conduct]:
+https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md
+[Node.js Moderation Policy]:
+https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/GOVERNANCE.md b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/GOVERNANCE.md
new file mode 100644
index 0000000..16ffb93
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/GOVERNANCE.md
@@ -0,0 +1,136 @@
+### Streams Working Group
+
+The Node.js Streams is jointly governed by a Working Group
+(WG)
+that is responsible for high-level guidance of the project.
+
+The WG has final authority over this project including:
+
+* Technical direction
+* Project governance and process (including this policy)
+* Contribution policy
+* GitHub repository hosting
+* Conduct guidelines
+* Maintaining the list of additional Collaborators
+
+For the current list of WG members, see the project
+[README.md](./README.md#current-project-team-members).
+
+### Collaborators
+
+The readable-stream GitHub repository is
+maintained by the WG and additional Collaborators who are added by the
+WG on an ongoing basis.
+
+Individuals making significant and valuable contributions are made
+Collaborators and given commit-access to the project. These
+individuals are identified by the WG and their addition as
+Collaborators is discussed during the WG meeting.
+
+_Note:_ If you make a significant contribution and are not considered
+for commit-access log an issue or contact a WG member directly and it
+will be brought up in the next WG meeting.
+
+Modifications of the contents of the readable-stream repository are
+made on
+a collaborative basis. Anybody with a GitHub account may propose a
+modification via pull request and it will be considered by the project
+Collaborators. All pull requests must be reviewed and accepted by a
+Collaborator with sufficient expertise who is able to take full
+responsibility for the change. In the case of pull requests proposed
+by an existing Collaborator, an additional Collaborator is required
+for sign-off. Consensus should be sought if additional Collaborators
+participate and there is disagreement around a particular
+modification. See _Consensus Seeking Process_ below for further detail
+on the consensus model used for governance.
+
+Collaborators may opt to elevate significant or controversial
+modifications, or modifications that have not found consensus to the
+WG for discussion by assigning the ***WG-agenda*** tag to a pull
+request or issue. The WG should serve as the final arbiter where
+required.
+
+For the current list of Collaborators, see the project
+[README.md](./README.md#members).
+
+### WG Membership
+
+WG seats are not time-limited. There is no fixed size of the WG.
+However, the expected target is between 6 and 12, to ensure adequate
+coverage of important areas of expertise, balanced with the ability to
+make decisions efficiently.
+
+There is no specific set of requirements or qualifications for WG
+membership beyond these rules.
+
+The WG may add additional members to the WG by unanimous consensus.
+
+A WG member may be removed from the WG by voluntary resignation, or by
+unanimous consensus of all other WG members.
+
+Changes to WG membership should be posted in the agenda, and may be
+suggested as any other agenda item (see "WG Meetings" below).
+
+If an addition or removal is proposed during a meeting, and the full
+WG is not in attendance to participate, then the addition or removal
+is added to the agenda for the subsequent meeting. This is to ensure
+that all members are given the opportunity to participate in all
+membership decisions. If a WG member is unable to attend a meeting
+where a planned membership decision is being made, then their consent
+is assumed.
+
+No more than 1/3 of the WG members may be affiliated with the same
+employer. If removal or resignation of a WG member, or a change of
+employment by a WG member, creates a situation where more than 1/3 of
+the WG membership shares an employer, then the situation must be
+immediately remedied by the resignation or removal of one or more WG
+members affiliated with the over-represented employer(s).
+
+### WG Meetings
+
+The WG meets occasionally on a Google Hangout On Air. A designated moderator
+approved by the WG runs the meeting. Each meeting should be
+published to YouTube.
+
+Items are added to the WG agenda that are considered contentious or
+are modifications of governance, contribution policy, WG membership,
+or release process.
+
+The intention of the agenda is not to approve or review all patches;
+that should happen continuously on GitHub and be handled by the larger
+group of Collaborators.
+
+Any community member or contributor can ask that something be added to
+the next meeting's agenda by logging a GitHub Issue. Any Collaborator,
+WG member or the moderator can add the item to the agenda by adding
+the ***WG-agenda*** tag to the issue.
+
+Prior to each WG meeting the moderator will share the Agenda with
+members of the WG. WG members can add any items they like to the
+agenda at the beginning of each meeting. The moderator and the WG
+cannot veto or remove items.
+
+The WG may invite persons or representatives from certain projects to
+participate in a non-voting capacity.
+
+The moderator is responsible for summarizing the discussion of each
+agenda item and sends it as a pull request after the meeting.
+
+### Consensus Seeking Process
+
+The WG follows a
+[Consensus
+Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making)
+decision-making model.
+
+When an agenda item has appeared to reach a consensus the moderator
+will ask "Does anyone object?" as a final call for dissent from the
+consensus.
+
+If an agenda item cannot reach a consensus a WG member can call for
+either a closing vote or a vote to table the issue to the next
+meeting. The call for a vote must be seconded by a majority of the WG
+or else the discussion will continue. Simple majority wins.
+
+Note that changes to WG membership require a majority consensus. See
+"WG Membership" above.
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/LICENSE b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/LICENSE
new file mode 100644
index 0000000..2873b3b
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/LICENSE
@@ -0,0 +1,47 @@
+Node.js is licensed for use as follows:
+
+"""
+Copyright Node.js contributors. 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.
+"""
+
+This license applies to parts of Node.js originating from the
+https://github.com/joyent/node repository:
+
+"""
+Copyright Joyent, Inc. and other Node contributors. 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.
+"""
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/README.md b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/README.md
new file mode 100644
index 0000000..f1c5a93
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/README.md
@@ -0,0 +1,58 @@
+# readable-stream
+
+***Node-core v8.17.0 streams for userland*** [](https://travis-ci.org/nodejs/readable-stream)
+
+
+[](https://nodei.co/npm/readable-stream/)
+[](https://nodei.co/npm/readable-stream/)
+
+
+[](https://saucelabs.com/u/readable-stream)
+
+```bash
+npm install --save readable-stream
+```
+
+***Node-core streams for userland***
+
+This package is a mirror of the Streams2 and Streams3 implementations in
+Node-core.
+
+Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.17.0/docs/api/stream.html).
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
+
+As of version 2.0.0 **readable-stream** uses semantic versioning.
+
+# Streams Working Group
+
+`readable-stream` is maintained by the Streams Working Group, which
+oversees the development and maintenance of the Streams API within
+Node.js. The responsibilities of the Streams Working Group include:
+
+* Addressing stream issues on the Node.js issue tracker.
+* Authoring and editing stream documentation within the Node.js project.
+* Reviewing changes to stream subclasses within the Node.js project.
+* Redirecting changes to streams from the Node.js project to this
+ project.
+* Assisting in the implementation of stream providers within Node.js.
+* Recommending versions of `readable-stream` to be included in Node.js.
+* Messaging about the future of streams to give the community advance
+ notice of changes.
+
+
+## Team Members
+
+* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com>
+ - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
+* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>
+ - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
+* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org>
+ - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
+* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com>
+* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>
+* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me>
+* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>
+ - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
+* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com>
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
new file mode 100644
index 0000000..83275f1
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
@@ -0,0 +1,60 @@
+# streams WG Meeting 2015-01-30
+
+## Links
+
+* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg
+* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106
+* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/
+
+## Agenda
+
+Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting.
+
+* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105)
+* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101)
+* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102)
+* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99)
+
+## Minutes
+
+### adopt a charter
+
+* group: +1's all around
+
+### What versioning scheme should be adopted?
+* group: +1’s 3.0.0
+* domenic+group: pulling in patches from other sources where appropriate
+* mikeal: version independently, suggesting versions for io.js
+* mikeal+domenic: work with TC to notify in advance of changes
+simpler stream creation
+
+### streamline creation of streams
+* sam: streamline creation of streams
+* domenic: nice simple solution posted
+ but, we lose the opportunity to change the model
+ may not be backwards incompatible (double check keys)
+
+ **action item:** domenic will check
+
+### remove implicit flowing of streams on(‘data’)
+* add isFlowing / isPaused
+* mikeal: worrying that we’re documenting polyfill methods – confuses users
+* domenic: more reflective API is probably good, with warning labels for users
+* new section for mad scientists (reflective stream access)
+* calvin: name the “third state”
+* mikeal: maybe borrow the name from whatwg?
+* domenic: we’re missing the “third state”
+* consensus: kind of difficult to name the third state
+* mikeal: figure out differences in states / compat
+* mathias: always flow on data – eliminates third state
+ * explore what it breaks
+
+**action items:**
+* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream)
+* ask rod/build for infrastructure
+* **chris**: explore the “flow on data” approach
+* add isPaused/isFlowing
+* add new docs section
+* move isPaused to that section
+
+
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/duplex-browser.js b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/duplex-browser.js
new file mode 100644
index 0000000..f8b2db8
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/duplex-browser.js
@@ -0,0 +1 @@
+module.exports = require('./lib/_stream_duplex.js');
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/duplex.js b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/duplex.js
new file mode 100644
index 0000000..46924cb
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/duplex.js
@@ -0,0 +1 @@
+module.exports = require('./readable').Duplex
diff --git a/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/lib/_stream_duplex.js b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/lib/_stream_duplex.js
new file mode 100644
index 0000000..57003c3
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/through2/node_modules/readable-stream/lib/_stream_duplex.js
@@ -0,0 +1,131 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// 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.
+
+// a duplex stream is just a stream that is both readable and writable.
+// Since JS doesn't have multiple prototypal inheritance, this class
+// prototypally inherits from Readable, and then parasitically from
+// Writable.
+
+'use strict';
+
+/*\\d+)m|\\${ANSI_ESCAPE_LINK}(?.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}};
+ if (groups.code !== undefined) {
+ const code = Number.parseFloat(groups.code);
+ escapeCode = code === END_CODE ? undefined : code;
+ } else if (groups.uri !== undefined) {
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
+ }
+ }
+
+ const code = ansiStyles.codes.get(Number(escapeCode));
+
+ if (pre[index + 1] === '\n') {
+ if (escapeUrl) {
+ returnValue += wrapAnsiHyperlink('');
+ }
+
+ if (escapeCode && code) {
+ returnValue += wrapAnsi(code);
+ }
+ } else if (character === '\n') {
+ if (escapeCode && code) {
+ returnValue += wrapAnsi(escapeCode);
+ }
+
+ if (escapeUrl) {
+ returnValue += wrapAnsiHyperlink(escapeUrl);
+ }
+ }
+ }
+
+ return returnValue;
+};
+
+// For each newline, invoke the method separately
+module.exports = (string, columns, options) => {
+ return String(string)
+ .normalize()
+ .replace(/\r\n/g, '\n')
+ .split('\n')
+ .map(line => exec(line, columns, options))
+ .join('\n');
+};
diff --git a/projects/arabica/src/sprint2/node_modules/wrap-ansi/license b/projects/arabica/src/sprint2/node_modules/wrap-ansi/license
new file mode 100644
index 0000000..fa7ceba
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/wrap-ansi/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus (https://sindresorhus.com)
+
+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/projects/arabica/src/sprint2/node_modules/wrap-ansi/package.json b/projects/arabica/src/sprint2/node_modules/wrap-ansi/package.json
new file mode 100644
index 0000000..dfb2f4f
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/wrap-ansi/package.json
@@ -0,0 +1,62 @@
+{
+ "name": "wrap-ansi",
+ "version": "7.0.0",
+ "description": "Wordwrap a string with ANSI escape codes",
+ "license": "MIT",
+ "repository": "chalk/wrap-ansi",
+ "funding": "https://github.com/chalk/wrap-ansi?sponsor=1",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "https://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "scripts": {
+ "test": "xo && nyc ava"
+ },
+ "files": [
+ "index.js"
+ ],
+ "keywords": [
+ "wrap",
+ "break",
+ "wordwrap",
+ "wordbreak",
+ "linewrap",
+ "ansi",
+ "styles",
+ "color",
+ "colour",
+ "colors",
+ "terminal",
+ "console",
+ "cli",
+ "string",
+ "tty",
+ "escape",
+ "formatting",
+ "rgb",
+ "256",
+ "shell",
+ "xterm",
+ "log",
+ "logging",
+ "command-line",
+ "text"
+ ],
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "devDependencies": {
+ "ava": "^2.1.0",
+ "chalk": "^4.0.0",
+ "coveralls": "^3.0.3",
+ "has-ansi": "^4.0.0",
+ "nyc": "^15.0.1",
+ "xo": "^0.29.1"
+ }
+}
diff --git a/projects/arabica/src/sprint2/node_modules/wrap-ansi/readme.md b/projects/arabica/src/sprint2/node_modules/wrap-ansi/readme.md
new file mode 100644
index 0000000..68779ba
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/wrap-ansi/readme.md
@@ -0,0 +1,91 @@
+# wrap-ansi [](https://travis-ci.com/chalk/wrap-ansi) [](https://coveralls.io/github/chalk/wrap-ansi?branch=master)
+
+> Wordwrap a string with [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles)
+
+## Install
+
+```
+$ npm install wrap-ansi
+```
+
+## Usage
+
+```js
+const chalk = require('chalk');
+const wrapAnsi = require('wrap-ansi');
+
+const input = 'The quick brown ' + chalk.red('fox jumped over ') +
+ 'the lazy ' + chalk.green('dog and then ran away with the unicorn.');
+
+console.log(wrapAnsi(input, 20));
+```
+
+
+
+## API
+
+### wrapAnsi(string, columns, options?)
+
+Wrap words to the specified column width.
+
+#### string
+
+Type: `string`
+
+String with ANSI escape codes. Like one styled by [`chalk`](https://github.com/chalk/chalk). Newline characters will be normalized to `\n`.
+
+#### columns
+
+Type: `number`
+
+Number of columns to wrap the text to.
+
+#### options
+
+Type: `object`
+
+##### hard
+
+Type: `boolean`\
+Default: `false`
+
+By default the wrap is soft, meaning long words may extend past the column width. Setting this to `true` will make it hard wrap at the column width.
+
+##### wordWrap
+
+Type: `boolean`\
+Default: `true`
+
+By default, an attempt is made to split words at spaces, ensuring that they don't extend past the configured columns. If wordWrap is `false`, each column will instead be completely filled splitting words as necessary.
+
+##### trim
+
+Type: `boolean`\
+Default: `true`
+
+Whitespace on all lines is removed by default. Set this option to `false` if you don't want to trim.
+
+## Related
+
+- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
+- [cli-truncate](https://github.com/sindresorhus/cli-truncate) - Truncate a string to a specific width in the terminal
+- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
+- [jsesc](https://github.com/mathiasbynens/jsesc) - Generate ASCII-only output from Unicode strings. Useful for creating test fixtures.
+
+## Maintainers
+
+- [Sindre Sorhus](https://github.com/sindresorhus)
+- [Josh Junon](https://github.com/qix-)
+- [Benjamin Coe](https://github.com/bcoe)
+
+---
+
+
+
+ Get professional support for this package with a Tidelift subscription
+
+
+
+ Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
+
+
diff --git a/projects/arabica/src/sprint2/node_modules/xtend/.jshintrc b/projects/arabica/src/sprint2/node_modules/xtend/.jshintrc
new file mode 100644
index 0000000..77887b5
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/xtend/.jshintrc
@@ -0,0 +1,30 @@
+{
+ "maxdepth": 4,
+ "maxstatements": 200,
+ "maxcomplexity": 12,
+ "maxlen": 80,
+ "maxparams": 5,
+
+ "curly": true,
+ "eqeqeq": true,
+ "immed": true,
+ "latedef": false,
+ "noarg": true,
+ "noempty": true,
+ "nonew": true,
+ "undef": true,
+ "unused": "vars",
+ "trailing": true,
+
+ "quotmark": true,
+ "expr": true,
+ "asi": true,
+
+ "browser": false,
+ "esnext": true,
+ "devel": false,
+ "node": false,
+ "nonstandard": false,
+
+ "predef": ["require", "module", "__dirname", "__filename"]
+}
diff --git a/projects/arabica/src/sprint2/node_modules/xtend/LICENSE b/projects/arabica/src/sprint2/node_modules/xtend/LICENSE
new file mode 100644
index 0000000..0099f4f
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/xtend/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+Copyright (c) 2012-2014 Raynos.
+
+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/projects/arabica/src/sprint2/node_modules/xtend/README.md b/projects/arabica/src/sprint2/node_modules/xtend/README.md
new file mode 100644
index 0000000..4a2703c
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/xtend/README.md
@@ -0,0 +1,32 @@
+# xtend
+
+[![browser support][3]][4]
+
+[](http://github.com/badges/stability-badges)
+
+Extend like a boss
+
+xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence.
+
+## Examples
+
+```js
+var extend = require("xtend")
+
+// extend returns a new object. Does not mutate arguments
+var combination = extend({
+ a: "a",
+ b: "c"
+}, {
+ b: "b"
+})
+// { a: "a", b: "b" }
+```
+
+## Stability status: Locked
+
+## MIT Licensed
+
+
+ [3]: http://ci.testling.com/Raynos/xtend.png
+ [4]: http://ci.testling.com/Raynos/xtend
diff --git a/projects/arabica/src/sprint2/node_modules/xtend/immutable.js b/projects/arabica/src/sprint2/node_modules/xtend/immutable.js
new file mode 100644
index 0000000..94889c9
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/xtend/immutable.js
@@ -0,0 +1,19 @@
+module.exports = extend
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function extend() {
+ var target = {}
+
+ for (var i = 0; i < arguments.length; i++) {
+ var source = arguments[i]
+
+ for (var key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ target[key] = source[key]
+ }
+ }
+ }
+
+ return target
+}
diff --git a/projects/arabica/src/sprint2/node_modules/xtend/mutable.js b/projects/arabica/src/sprint2/node_modules/xtend/mutable.js
new file mode 100644
index 0000000..72debed
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/xtend/mutable.js
@@ -0,0 +1,17 @@
+module.exports = extend
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function extend(target) {
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments[i]
+
+ for (var key in source) {
+ if (hasOwnProperty.call(source, key)) {
+ target[key] = source[key]
+ }
+ }
+ }
+
+ return target
+}
diff --git a/projects/arabica/src/sprint2/node_modules/xtend/package.json b/projects/arabica/src/sprint2/node_modules/xtend/package.json
new file mode 100644
index 0000000..f7a39d1
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/xtend/package.json
@@ -0,0 +1,55 @@
+{
+ "name": "xtend",
+ "version": "4.0.2",
+ "description": "extend like a boss",
+ "keywords": [
+ "extend",
+ "merge",
+ "options",
+ "opts",
+ "object",
+ "array"
+ ],
+ "author": "Raynos ",
+ "repository": "git://github.com/Raynos/xtend.git",
+ "main": "immutable",
+ "scripts": {
+ "test": "node test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tape": "~1.1.0"
+ },
+ "homepage": "https://github.com/Raynos/xtend",
+ "contributors": [
+ {
+ "name": "Jake Verbaten"
+ },
+ {
+ "name": "Matt Esch"
+ }
+ ],
+ "bugs": {
+ "url": "https://github.com/Raynos/xtend/issues",
+ "email": "raynos2@gmail.com"
+ },
+ "license": "MIT",
+ "testling": {
+ "files": "test.js",
+ "browsers": [
+ "ie/7..latest",
+ "firefox/16..latest",
+ "firefox/nightly",
+ "chrome/22..latest",
+ "chrome/canary",
+ "opera/12..latest",
+ "opera/next",
+ "safari/5.1..latest",
+ "ipad/6.0..latest",
+ "iphone/6.0..latest"
+ ]
+ },
+ "engines": {
+ "node": ">=0.4"
+ }
+}
diff --git a/projects/arabica/src/sprint2/node_modules/xtend/test.js b/projects/arabica/src/sprint2/node_modules/xtend/test.js
new file mode 100644
index 0000000..b895b42
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/xtend/test.js
@@ -0,0 +1,103 @@
+var test = require("tape")
+var extend = require("./")
+var mutableExtend = require("./mutable")
+
+test("merge", function(assert) {
+ var a = { a: "foo" }
+ var b = { b: "bar" }
+
+ assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
+ assert.end()
+})
+
+test("replace", function(assert) {
+ var a = { a: "foo" }
+ var b = { a: "bar" }
+
+ assert.deepEqual(extend(a, b), { a: "bar" })
+ assert.end()
+})
+
+test("undefined", function(assert) {
+ var a = { a: undefined }
+ var b = { b: "foo" }
+
+ assert.deepEqual(extend(a, b), { a: undefined, b: "foo" })
+ assert.deepEqual(extend(b, a), { a: undefined, b: "foo" })
+ assert.end()
+})
+
+test("handle 0", function(assert) {
+ var a = { a: "default" }
+ var b = { a: 0 }
+
+ assert.deepEqual(extend(a, b), { a: 0 })
+ assert.deepEqual(extend(b, a), { a: "default" })
+ assert.end()
+})
+
+test("is immutable", function (assert) {
+ var record = {}
+
+ extend(record, { foo: "bar" })
+ assert.equal(record.foo, undefined)
+ assert.end()
+})
+
+test("null as argument", function (assert) {
+ var a = { foo: "bar" }
+ var b = null
+ var c = void 0
+
+ assert.deepEqual(extend(b, a, c), { foo: "bar" })
+ assert.end()
+})
+
+test("mutable", function (assert) {
+ var a = { foo: "bar" }
+
+ mutableExtend(a, { bar: "baz" })
+
+ assert.equal(a.bar, "baz")
+ assert.end()
+})
+
+test("null prototype", function(assert) {
+ var a = { a: "foo" }
+ var b = Object.create(null)
+ b.b = "bar";
+
+ assert.deepEqual(extend(a, b), { a: "foo", b: "bar" })
+ assert.end()
+})
+
+test("null prototype mutable", function (assert) {
+ var a = { foo: "bar" }
+ var b = Object.create(null)
+ b.bar = "baz";
+
+ mutableExtend(a, b)
+
+ assert.equal(a.bar, "baz")
+ assert.end()
+})
+
+test("prototype pollution", function (assert) {
+ var a = {}
+ var maliciousPayload = '{"__proto__":{"oops":"It works!"}}'
+
+ assert.strictEqual(a.oops, undefined)
+ extend({}, maliciousPayload)
+ assert.strictEqual(a.oops, undefined)
+ assert.end()
+})
+
+test("prototype pollution mutable", function (assert) {
+ var a = {}
+ var maliciousPayload = '{"__proto__":{"oops":"It works!"}}'
+
+ assert.strictEqual(a.oops, undefined)
+ mutableExtend({}, maliciousPayload)
+ assert.strictEqual(a.oops, undefined)
+ assert.end()
+})
diff --git a/projects/arabica/src/sprint2/node_modules/y18n/CHANGELOG.md b/projects/arabica/src/sprint2/node_modules/y18n/CHANGELOG.md
new file mode 100644
index 0000000..244d838
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/CHANGELOG.md
@@ -0,0 +1,100 @@
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+### [5.0.8](https://www.github.com/yargs/y18n/compare/v5.0.7...v5.0.8) (2021-04-07)
+
+
+### Bug Fixes
+
+* **deno:** force modern release for Deno ([b1c215a](https://www.github.com/yargs/y18n/commit/b1c215aed714bee5830e76de3e335504dc2c4dab))
+
+### [5.0.7](https://www.github.com/yargs/y18n/compare/v5.0.6...v5.0.7) (2021-04-07)
+
+
+### Bug Fixes
+
+* **deno:** force release for deno ([#121](https://www.github.com/yargs/y18n/issues/121)) ([d3f2560](https://www.github.com/yargs/y18n/commit/d3f2560e6cedf2bfa2352e9eec044da53f9a06b2))
+
+### [5.0.6](https://www.github.com/yargs/y18n/compare/v5.0.5...v5.0.6) (2021-04-05)
+
+
+### Bug Fixes
+
+* **webpack:** skip readFileSync if not defined ([#117](https://www.github.com/yargs/y18n/issues/117)) ([6966fa9](https://www.github.com/yargs/y18n/commit/6966fa91d2881cc6a6c531e836099e01f4da1616))
+
+### [5.0.5](https://www.github.com/yargs/y18n/compare/v5.0.4...v5.0.5) (2020-10-25)
+
+
+### Bug Fixes
+
+* address prototype pollution issue ([#108](https://www.github.com/yargs/y18n/issues/108)) ([a9ac604](https://www.github.com/yargs/y18n/commit/a9ac604abf756dec9687be3843e2c93bfe581f25))
+
+### [5.0.4](https://www.github.com/yargs/y18n/compare/v5.0.3...v5.0.4) (2020-10-16)
+
+
+### Bug Fixes
+
+* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#105](https://www.github.com/yargs/y18n/issues/105)) ([4f85d80](https://www.github.com/yargs/y18n/commit/4f85d80dbaae6d2c7899ae394f7ad97805df4886))
+
+### [5.0.3](https://www.github.com/yargs/y18n/compare/v5.0.2...v5.0.3) (2020-10-16)
+
+
+### Bug Fixes
+
+* **exports:** node 13.0-13.6 require a string fallback ([#103](https://www.github.com/yargs/y18n/issues/103)) ([e39921e](https://www.github.com/yargs/y18n/commit/e39921e1017f88f5d8ea97ddea854ffe92d68e74))
+
+### [5.0.2](https://www.github.com/yargs/y18n/compare/v5.0.1...v5.0.2) (2020-10-01)
+
+
+### Bug Fixes
+
+* **deno:** update types for deno ^1.4.0 ([#100](https://www.github.com/yargs/y18n/issues/100)) ([3834d9a](https://www.github.com/yargs/y18n/commit/3834d9ab1332f2937c935ada5e76623290efae81))
+
+### [5.0.1](https://www.github.com/yargs/y18n/compare/v5.0.0...v5.0.1) (2020-09-05)
+
+
+### Bug Fixes
+
+* main had old index path ([#98](https://www.github.com/yargs/y18n/issues/98)) ([124f7b0](https://www.github.com/yargs/y18n/commit/124f7b047ba9596bdbdf64459988304e77f3de1b))
+
+## [5.0.0](https://www.github.com/yargs/y18n/compare/v4.0.0...v5.0.0) (2020-09-05)
+
+
+### ⚠ BREAKING CHANGES
+
+* exports maps are now used, which modifies import behavior.
+* drops Node 6 and 4. begin following Node.js LTS schedule (#89)
+
+### Features
+
+* add support for ESM and Deno [#95](https://www.github.com/yargs/y18n/issues/95)) ([4d7ae94](https://www.github.com/yargs/y18n/commit/4d7ae94bcb42e84164e2180366474b1cd321ed94))
+
+
+### Build System
+
+* drops Node 6 and 4. begin following Node.js LTS schedule ([#89](https://www.github.com/yargs/y18n/issues/89)) ([3cc0c28](https://www.github.com/yargs/y18n/commit/3cc0c287240727b84eaf1927f903612ec80f5e43))
+
+### 4.0.1 (2020-10-25)
+
+
+### Bug Fixes
+
+* address prototype pollution issue ([#108](https://www.github.com/yargs/y18n/issues/108)) ([a9ac604](https://www.github.com/yargs/y18n/commit/7de58ca0d315990cdb38234e97fc66254cdbcd71))
+
+## [4.0.0](https://github.com/yargs/y18n/compare/v3.2.1...v4.0.0) (2017-10-10)
+
+
+### Bug Fixes
+
+* allow support for falsy values like 0 in tagged literal ([#45](https://github.com/yargs/y18n/issues/45)) ([c926123](https://github.com/yargs/y18n/commit/c926123))
+
+
+### Features
+
+* **__:** added tagged template literal support ([#44](https://github.com/yargs/y18n/issues/44)) ([0598daf](https://github.com/yargs/y18n/commit/0598daf))
+
+
+### BREAKING CHANGES
+
+* **__:** dropping Node 0.10/Node 0.12 support
diff --git a/projects/arabica/src/sprint2/node_modules/y18n/LICENSE b/projects/arabica/src/sprint2/node_modules/y18n/LICENSE
new file mode 100644
index 0000000..3c157f0
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/LICENSE
@@ -0,0 +1,13 @@
+Copyright (c) 2015, 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/projects/arabica/src/sprint2/node_modules/y18n/README.md b/projects/arabica/src/sprint2/node_modules/y18n/README.md
new file mode 100644
index 0000000..5102bb1
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/README.md
@@ -0,0 +1,127 @@
+# y18n
+
+[![NPM version][npm-image]][npm-url]
+[![js-standard-style][standard-image]][standard-url]
+[](https://conventionalcommits.org)
+
+The bare-bones internationalization library used by yargs.
+
+Inspired by [i18n](https://www.npmjs.com/package/i18n).
+
+## Examples
+
+_simple string translation:_
+
+```js
+const __ = require('y18n')().__;
+
+console.log(__('my awesome string %s', 'foo'));
+```
+
+output:
+
+`my awesome string foo`
+
+_using tagged template literals_
+
+```js
+const __ = require('y18n')().__;
+
+const str = 'foo';
+
+console.log(__`my awesome string ${str}`);
+```
+
+output:
+
+`my awesome string foo`
+
+_pluralization support:_
+
+```js
+const __n = require('y18n')().__n;
+
+console.log(__n('one fish %s', '%d fishes %s', 2, 'foo'));
+```
+
+output:
+
+`2 fishes foo`
+
+## Deno Example
+
+As of `v5` `y18n` supports [Deno](https://github.com/denoland/deno):
+
+```typescript
+import y18n from "https://deno.land/x/y18n/deno.ts";
+
+const __ = y18n({
+ locale: 'pirate',
+ directory: './test/locales'
+}).__
+
+console.info(__`Hi, ${'Ben'} ${'Coe'}!`)
+```
+
+You will need to run with `--allow-read` to load alternative locales.
+
+## JSON Language Files
+
+The JSON language files should be stored in a `./locales` folder.
+File names correspond to locales, e.g., `en.json`, `pirate.json`.
+
+When strings are observed for the first time they will be
+added to the JSON file corresponding to the current locale.
+
+## Methods
+
+### require('y18n')(config)
+
+Create an instance of y18n with the config provided, options include:
+
+* `directory`: the locale directory, default `./locales`.
+* `updateFiles`: should newly observed strings be updated in file, default `true`.
+* `locale`: what locale should be used.
+* `fallbackToLanguage`: should fallback to a language-only file (e.g. `en.json`)
+ be allowed if a file matching the locale does not exist (e.g. `en_US.json`),
+ default `true`.
+
+### y18n.\_\_(str, arg, arg, arg)
+
+Print a localized string, `%s` will be replaced with `arg`s.
+
+This function can also be used as a tag for a template literal. You can use it
+like this: __`hello ${'world'}`. This will be equivalent to
+`__('hello %s', 'world')`.
+
+### y18n.\_\_n(singularString, pluralString, count, arg, arg, arg)
+
+Print a localized string with appropriate pluralization. If `%d` is provided
+in the string, the `count` will replace this placeholder.
+
+### y18n.setLocale(str)
+
+Set the current locale being used.
+
+### y18n.getLocale()
+
+What locale is currently being used?
+
+### y18n.updateLocale(obj)
+
+Update the current locale with the key value pairs in `obj`.
+
+## Supported Node.js Versions
+
+Libraries in this ecosystem make a best effort to track
+[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
+post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
+
+## License
+
+ISC
+
+[npm-url]: https://npmjs.org/package/y18n
+[npm-image]: https://img.shields.io/npm/v/y18n.svg
+[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
+[standard-url]: https://github.com/feross/standard
diff --git a/projects/arabica/src/sprint2/node_modules/y18n/build/index.cjs b/projects/arabica/src/sprint2/node_modules/y18n/build/index.cjs
new file mode 100644
index 0000000..b2731e1
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/build/index.cjs
@@ -0,0 +1,203 @@
+'use strict';
+
+var fs = require('fs');
+var util = require('util');
+var path = require('path');
+
+let shim;
+class Y18N {
+ constructor(opts) {
+ // configurable options.
+ opts = opts || {};
+ this.directory = opts.directory || './locales';
+ this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true;
+ this.locale = opts.locale || 'en';
+ this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true;
+ // internal stuff.
+ this.cache = Object.create(null);
+ this.writeQueue = [];
+ }
+ __(...args) {
+ if (typeof arguments[0] !== 'string') {
+ return this._taggedLiteral(arguments[0], ...arguments);
+ }
+ const str = args.shift();
+ let cb = function () { }; // start with noop.
+ if (typeof args[args.length - 1] === 'function')
+ cb = args.pop();
+ cb = cb || function () { }; // noop.
+ if (!this.cache[this.locale])
+ this._readLocaleFile();
+ // we've observed a new string, update the language file.
+ if (!this.cache[this.locale][str] && this.updateFiles) {
+ this.cache[this.locale][str] = str;
+ // include the current directory and locale,
+ // since these values could change before the
+ // write is performed.
+ this._enqueueWrite({
+ directory: this.directory,
+ locale: this.locale,
+ cb
+ });
+ }
+ else {
+ cb();
+ }
+ return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args));
+ }
+ __n() {
+ const args = Array.prototype.slice.call(arguments);
+ const singular = args.shift();
+ const plural = args.shift();
+ const quantity = args.shift();
+ let cb = function () { }; // start with noop.
+ if (typeof args[args.length - 1] === 'function')
+ cb = args.pop();
+ if (!this.cache[this.locale])
+ this._readLocaleFile();
+ let str = quantity === 1 ? singular : plural;
+ if (this.cache[this.locale][singular]) {
+ const entry = this.cache[this.locale][singular];
+ str = entry[quantity === 1 ? 'one' : 'other'];
+ }
+ // we've observed a new string, update the language file.
+ if (!this.cache[this.locale][singular] && this.updateFiles) {
+ this.cache[this.locale][singular] = {
+ one: singular,
+ other: plural
+ };
+ // include the current directory and locale,
+ // since these values could change before the
+ // write is performed.
+ this._enqueueWrite({
+ directory: this.directory,
+ locale: this.locale,
+ cb
+ });
+ }
+ else {
+ cb();
+ }
+ // if a %d placeholder is provided, add quantity
+ // to the arguments expanded by util.format.
+ const values = [str];
+ if (~str.indexOf('%d'))
+ values.push(quantity);
+ return shim.format.apply(shim.format, values.concat(args));
+ }
+ setLocale(locale) {
+ this.locale = locale;
+ }
+ getLocale() {
+ return this.locale;
+ }
+ updateLocale(obj) {
+ if (!this.cache[this.locale])
+ this._readLocaleFile();
+ for (const key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ this.cache[this.locale][key] = obj[key];
+ }
+ }
+ }
+ _taggedLiteral(parts, ...args) {
+ let str = '';
+ parts.forEach(function (part, i) {
+ const arg = args[i + 1];
+ str += part;
+ if (typeof arg !== 'undefined') {
+ str += '%s';
+ }
+ });
+ return this.__.apply(this, [str].concat([].slice.call(args, 1)));
+ }
+ _enqueueWrite(work) {
+ this.writeQueue.push(work);
+ if (this.writeQueue.length === 1)
+ this._processWriteQueue();
+ }
+ _processWriteQueue() {
+ const _this = this;
+ const work = this.writeQueue[0];
+ // destructure the enqueued work.
+ const directory = work.directory;
+ const locale = work.locale;
+ const cb = work.cb;
+ const languageFile = this._resolveLocaleFile(directory, locale);
+ const serializedLocale = JSON.stringify(this.cache[locale], null, 2);
+ shim.fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) {
+ _this.writeQueue.shift();
+ if (_this.writeQueue.length > 0)
+ _this._processWriteQueue();
+ cb(err);
+ });
+ }
+ _readLocaleFile() {
+ let localeLookup = {};
+ const languageFile = this._resolveLocaleFile(this.directory, this.locale);
+ try {
+ // When using a bundler such as webpack, readFileSync may not be defined:
+ if (shim.fs.readFileSync) {
+ localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8'));
+ }
+ }
+ catch (err) {
+ if (err instanceof SyntaxError) {
+ err.message = 'syntax error in ' + languageFile;
+ }
+ if (err.code === 'ENOENT')
+ localeLookup = {};
+ else
+ throw err;
+ }
+ this.cache[this.locale] = localeLookup;
+ }
+ _resolveLocaleFile(directory, locale) {
+ let file = shim.resolve(directory, './', locale + '.json');
+ if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
+ // attempt fallback to language only
+ const languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json');
+ if (this._fileExistsSync(languageFile))
+ file = languageFile;
+ }
+ return file;
+ }
+ _fileExistsSync(file) {
+ return shim.exists(file);
+ }
+}
+function y18n$1(opts, _shim) {
+ shim = _shim;
+ const y18n = new Y18N(opts);
+ return {
+ __: y18n.__.bind(y18n),
+ __n: y18n.__n.bind(y18n),
+ setLocale: y18n.setLocale.bind(y18n),
+ getLocale: y18n.getLocale.bind(y18n),
+ updateLocale: y18n.updateLocale.bind(y18n),
+ locale: y18n.locale
+ };
+}
+
+var nodePlatformShim = {
+ fs: {
+ readFileSync: fs.readFileSync,
+ writeFile: fs.writeFile
+ },
+ format: util.format,
+ resolve: path.resolve,
+ exists: (file) => {
+ try {
+ return fs.statSync(file).isFile();
+ }
+ catch (err) {
+ return false;
+ }
+ }
+};
+
+const y18n = (opts) => {
+ return y18n$1(opts, nodePlatformShim);
+};
+
+module.exports = y18n;
diff --git a/projects/arabica/src/sprint2/node_modules/y18n/build/lib/cjs.js b/projects/arabica/src/sprint2/node_modules/y18n/build/lib/cjs.js
new file mode 100644
index 0000000..ff58470
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/build/lib/cjs.js
@@ -0,0 +1,6 @@
+import { y18n as _y18n } from './index.js';
+import nodePlatformShim from './platform-shims/node.js';
+const y18n = (opts) => {
+ return _y18n(opts, nodePlatformShim);
+};
+export default y18n;
diff --git a/projects/arabica/src/sprint2/node_modules/y18n/build/lib/index.js b/projects/arabica/src/sprint2/node_modules/y18n/build/lib/index.js
new file mode 100644
index 0000000..e38f335
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/build/lib/index.js
@@ -0,0 +1,174 @@
+let shim;
+class Y18N {
+ constructor(opts) {
+ // configurable options.
+ opts = opts || {};
+ this.directory = opts.directory || './locales';
+ this.updateFiles = typeof opts.updateFiles === 'boolean' ? opts.updateFiles : true;
+ this.locale = opts.locale || 'en';
+ this.fallbackToLanguage = typeof opts.fallbackToLanguage === 'boolean' ? opts.fallbackToLanguage : true;
+ // internal stuff.
+ this.cache = Object.create(null);
+ this.writeQueue = [];
+ }
+ __(...args) {
+ if (typeof arguments[0] !== 'string') {
+ return this._taggedLiteral(arguments[0], ...arguments);
+ }
+ const str = args.shift();
+ let cb = function () { }; // start with noop.
+ if (typeof args[args.length - 1] === 'function')
+ cb = args.pop();
+ cb = cb || function () { }; // noop.
+ if (!this.cache[this.locale])
+ this._readLocaleFile();
+ // we've observed a new string, update the language file.
+ if (!this.cache[this.locale][str] && this.updateFiles) {
+ this.cache[this.locale][str] = str;
+ // include the current directory and locale,
+ // since these values could change before the
+ // write is performed.
+ this._enqueueWrite({
+ directory: this.directory,
+ locale: this.locale,
+ cb
+ });
+ }
+ else {
+ cb();
+ }
+ return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args));
+ }
+ __n() {
+ const args = Array.prototype.slice.call(arguments);
+ const singular = args.shift();
+ const plural = args.shift();
+ const quantity = args.shift();
+ let cb = function () { }; // start with noop.
+ if (typeof args[args.length - 1] === 'function')
+ cb = args.pop();
+ if (!this.cache[this.locale])
+ this._readLocaleFile();
+ let str = quantity === 1 ? singular : plural;
+ if (this.cache[this.locale][singular]) {
+ const entry = this.cache[this.locale][singular];
+ str = entry[quantity === 1 ? 'one' : 'other'];
+ }
+ // we've observed a new string, update the language file.
+ if (!this.cache[this.locale][singular] && this.updateFiles) {
+ this.cache[this.locale][singular] = {
+ one: singular,
+ other: plural
+ };
+ // include the current directory and locale,
+ // since these values could change before the
+ // write is performed.
+ this._enqueueWrite({
+ directory: this.directory,
+ locale: this.locale,
+ cb
+ });
+ }
+ else {
+ cb();
+ }
+ // if a %d placeholder is provided, add quantity
+ // to the arguments expanded by util.format.
+ const values = [str];
+ if (~str.indexOf('%d'))
+ values.push(quantity);
+ return shim.format.apply(shim.format, values.concat(args));
+ }
+ setLocale(locale) {
+ this.locale = locale;
+ }
+ getLocale() {
+ return this.locale;
+ }
+ updateLocale(obj) {
+ if (!this.cache[this.locale])
+ this._readLocaleFile();
+ for (const key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ this.cache[this.locale][key] = obj[key];
+ }
+ }
+ }
+ _taggedLiteral(parts, ...args) {
+ let str = '';
+ parts.forEach(function (part, i) {
+ const arg = args[i + 1];
+ str += part;
+ if (typeof arg !== 'undefined') {
+ str += '%s';
+ }
+ });
+ return this.__.apply(this, [str].concat([].slice.call(args, 1)));
+ }
+ _enqueueWrite(work) {
+ this.writeQueue.push(work);
+ if (this.writeQueue.length === 1)
+ this._processWriteQueue();
+ }
+ _processWriteQueue() {
+ const _this = this;
+ const work = this.writeQueue[0];
+ // destructure the enqueued work.
+ const directory = work.directory;
+ const locale = work.locale;
+ const cb = work.cb;
+ const languageFile = this._resolveLocaleFile(directory, locale);
+ const serializedLocale = JSON.stringify(this.cache[locale], null, 2);
+ shim.fs.writeFile(languageFile, serializedLocale, 'utf-8', function (err) {
+ _this.writeQueue.shift();
+ if (_this.writeQueue.length > 0)
+ _this._processWriteQueue();
+ cb(err);
+ });
+ }
+ _readLocaleFile() {
+ let localeLookup = {};
+ const languageFile = this._resolveLocaleFile(this.directory, this.locale);
+ try {
+ // When using a bundler such as webpack, readFileSync may not be defined:
+ if (shim.fs.readFileSync) {
+ localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, 'utf-8'));
+ }
+ }
+ catch (err) {
+ if (err instanceof SyntaxError) {
+ err.message = 'syntax error in ' + languageFile;
+ }
+ if (err.code === 'ENOENT')
+ localeLookup = {};
+ else
+ throw err;
+ }
+ this.cache[this.locale] = localeLookup;
+ }
+ _resolveLocaleFile(directory, locale) {
+ let file = shim.resolve(directory, './', locale + '.json');
+ if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf('_')) {
+ // attempt fallback to language only
+ const languageFile = shim.resolve(directory, './', locale.split('_')[0] + '.json');
+ if (this._fileExistsSync(languageFile))
+ file = languageFile;
+ }
+ return file;
+ }
+ _fileExistsSync(file) {
+ return shim.exists(file);
+ }
+}
+export function y18n(opts, _shim) {
+ shim = _shim;
+ const y18n = new Y18N(opts);
+ return {
+ __: y18n.__.bind(y18n),
+ __n: y18n.__n.bind(y18n),
+ setLocale: y18n.setLocale.bind(y18n),
+ getLocale: y18n.getLocale.bind(y18n),
+ updateLocale: y18n.updateLocale.bind(y18n),
+ locale: y18n.locale
+ };
+}
diff --git a/projects/arabica/src/sprint2/node_modules/y18n/build/lib/platform-shims/node.js b/projects/arabica/src/sprint2/node_modules/y18n/build/lib/platform-shims/node.js
new file mode 100644
index 0000000..181208b
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/build/lib/platform-shims/node.js
@@ -0,0 +1,19 @@
+import { readFileSync, statSync, writeFile } from 'fs';
+import { format } from 'util';
+import { resolve } from 'path';
+export default {
+ fs: {
+ readFileSync,
+ writeFile
+ },
+ format,
+ resolve,
+ exists: (file) => {
+ try {
+ return statSync(file).isFile();
+ }
+ catch (err) {
+ return false;
+ }
+ }
+};
diff --git a/projects/arabica/src/sprint2/node_modules/y18n/index.mjs b/projects/arabica/src/sprint2/node_modules/y18n/index.mjs
new file mode 100644
index 0000000..46c8213
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/index.mjs
@@ -0,0 +1,8 @@
+import shim from './build/lib/platform-shims/node.js'
+import { y18n as _y18n } from './build/lib/index.js'
+
+const y18n = (opts) => {
+ return _y18n(opts, shim)
+}
+
+export default y18n
diff --git a/projects/arabica/src/sprint2/node_modules/y18n/package.json b/projects/arabica/src/sprint2/node_modules/y18n/package.json
new file mode 100644
index 0000000..4e5c1ca
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/y18n/package.json
@@ -0,0 +1,70 @@
+{
+ "name": "y18n",
+ "version": "5.0.8",
+ "description": "the bare-bones internationalization library used by yargs",
+ "exports": {
+ ".": [
+ {
+ "import": "./index.mjs",
+ "require": "./build/index.cjs"
+ },
+ "./build/index.cjs"
+ ]
+ },
+ "type": "module",
+ "module": "./build/lib/index.js",
+ "keywords": [
+ "i18n",
+ "internationalization",
+ "yargs"
+ ],
+ "homepage": "https://github.com/yargs/y18n",
+ "bugs": {
+ "url": "https://github.com/yargs/y18n/issues"
+ },
+ "repository": "yargs/y18n",
+ "license": "ISC",
+ "author": "Ben Coe ",
+ "main": "./build/index.cjs",
+ "scripts": {
+ "check": "standardx **/*.ts **/*.cjs **/*.mjs",
+ "fix": "standardx --fix **/*.ts **/*.cjs **/*.mjs",
+ "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
+ "test": "c8 --reporter=text --reporter=html mocha test/*.cjs",
+ "test:esm": "c8 --reporter=text --reporter=html mocha test/esm/*.mjs",
+ "posttest": "npm run check",
+ "coverage": "c8 report --check-coverage",
+ "precompile": "rimraf build",
+ "compile": "tsc",
+ "postcompile": "npm run build:cjs",
+ "build:cjs": "rollup -c",
+ "prepare": "npm run compile"
+ },
+ "devDependencies": {
+ "@types/node": "^14.6.4",
+ "@wessberg/rollup-plugin-ts": "^1.3.1",
+ "c8": "^7.3.0",
+ "chai": "^4.0.1",
+ "cross-env": "^7.0.2",
+ "gts": "^3.0.0",
+ "mocha": "^8.0.0",
+ "rimraf": "^3.0.2",
+ "rollup": "^2.26.10",
+ "standardx": "^7.0.0",
+ "ts-transform-default-export": "^1.0.2",
+ "typescript": "^4.0.0"
+ },
+ "files": [
+ "build",
+ "index.mjs",
+ "!*.d.ts"
+ ],
+ "engines": {
+ "node": ">=10"
+ },
+ "standardx": {
+ "ignore": [
+ "build"
+ ]
+ }
+}
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/CHANGELOG.md b/projects/arabica/src/sprint2/node_modules/yargs-parser/CHANGELOG.md
new file mode 100644
index 0000000..2aad0ac
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/CHANGELOG.md
@@ -0,0 +1,263 @@
+# Changelog
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+### [20.2.9](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.8...yargs-parser-v20.2.9) (2021-06-20)
+
+
+### Bug Fixes
+
+* **build:** fixed automated release pipeline ([1fe9135](https://www.github.com/yargs/yargs-parser/commit/1fe9135884790a083615419b2861683e2597dac3))
+
+### [20.2.8](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.7...yargs-parser-v20.2.8) (2021-06-20)
+
+
+### Bug Fixes
+
+* **locale:** Turkish camelize and decamelize issues with toLocaleLowerCase/toLocaleUpperCase ([2617303](https://www.github.com/yargs/yargs-parser/commit/261730383e02448562f737b94bbd1f164aed5143))
+* **perf:** address slow parse when using unknown-options-as-args ([#394](https://www.github.com/yargs/yargs-parser/issues/394)) ([441f059](https://www.github.com/yargs/yargs-parser/commit/441f059d585d446551068ad213db79ac91daf83a))
+* **string-utils:** detect [0,1] ranged values as numbers ([#388](https://www.github.com/yargs/yargs-parser/issues/388)) ([efcc32c](https://www.github.com/yargs/yargs-parser/commit/efcc32c2d6b09aba31abfa2db9bd947befe5586b))
+
+### [20.2.7](https://www.github.com/yargs/yargs-parser/compare/v20.2.6...v20.2.7) (2021-03-10)
+
+
+### Bug Fixes
+
+* **deno:** force release for Deno ([6687c97](https://www.github.com/yargs/yargs-parser/commit/6687c972d0f3ca7865a97908dde3080b05f8b026))
+
+### [20.2.6](https://www.github.com/yargs/yargs-parser/compare/v20.2.5...v20.2.6) (2021-02-22)
+
+
+### Bug Fixes
+
+* **populate--:** -- should always be array ([#354](https://www.github.com/yargs/yargs-parser/issues/354)) ([585ae8f](https://www.github.com/yargs/yargs-parser/commit/585ae8ffad74cc02974f92d788e750137fd65146))
+
+### [20.2.5](https://www.github.com/yargs/yargs-parser/compare/v20.2.4...v20.2.5) (2021-02-13)
+
+
+### Bug Fixes
+
+* do not lowercase camel cased string ([#348](https://www.github.com/yargs/yargs-parser/issues/348)) ([5f4da1f](https://www.github.com/yargs/yargs-parser/commit/5f4da1f17d9d50542d2aaa206c9806ce3e320335))
+
+### [20.2.4](https://www.github.com/yargs/yargs-parser/compare/v20.2.3...v20.2.4) (2020-11-09)
+
+
+### Bug Fixes
+
+* **deno:** address import issues in Deno ([#339](https://www.github.com/yargs/yargs-parser/issues/339)) ([3b54e5e](https://www.github.com/yargs/yargs-parser/commit/3b54e5eef6e9a7b7c6eec7c12bab3ba3b8ba8306))
+
+### [20.2.3](https://www.github.com/yargs/yargs-parser/compare/v20.2.2...v20.2.3) (2020-10-16)
+
+
+### Bug Fixes
+
+* **exports:** node 13.0 and 13.1 require the dotted object form _with_ a string fallback ([#336](https://www.github.com/yargs/yargs-parser/issues/336)) ([3ae7242](https://www.github.com/yargs/yargs-parser/commit/3ae7242040ff876d28dabded60ac226e00150c88))
+
+### [20.2.2](https://www.github.com/yargs/yargs-parser/compare/v20.2.1...v20.2.2) (2020-10-14)
+
+
+### Bug Fixes
+
+* **exports:** node 13.0-13.6 require a string fallback ([#333](https://www.github.com/yargs/yargs-parser/issues/333)) ([291aeda](https://www.github.com/yargs/yargs-parser/commit/291aeda06b685b7a015d83bdf2558e180b37388d))
+
+### [20.2.1](https://www.github.com/yargs/yargs-parser/compare/v20.2.0...v20.2.1) (2020-10-01)
+
+
+### Bug Fixes
+
+* **deno:** update types for deno ^1.4.0 ([#330](https://www.github.com/yargs/yargs-parser/issues/330)) ([0ab92e5](https://www.github.com/yargs/yargs-parser/commit/0ab92e50b090f11196334c048c9c92cecaddaf56))
+
+## [20.2.0](https://www.github.com/yargs/yargs-parser/compare/v20.1.0...v20.2.0) (2020-09-21)
+
+
+### Features
+
+* **string-utils:** export looksLikeNumber helper ([#324](https://www.github.com/yargs/yargs-parser/issues/324)) ([c8580a2](https://www.github.com/yargs/yargs-parser/commit/c8580a2327b55f6342acecb6e72b62963d506750))
+
+
+### Bug Fixes
+
+* **unknown-options-as-args:** convert positionals that look like numbers ([#326](https://www.github.com/yargs/yargs-parser/issues/326)) ([f85ebb4](https://www.github.com/yargs/yargs-parser/commit/f85ebb4face9d4b0f56147659404cbe0002f3dad))
+
+## [20.1.0](https://www.github.com/yargs/yargs-parser/compare/v20.0.0...v20.1.0) (2020-09-20)
+
+
+### Features
+
+* adds parse-positional-numbers configuration ([#321](https://www.github.com/yargs/yargs-parser/issues/321)) ([9cec00a](https://www.github.com/yargs/yargs-parser/commit/9cec00a622251292ffb7dce6f78f5353afaa0d4c))
+
+
+### Bug Fixes
+
+* **build:** update release-please; make labels kick off builds ([#323](https://www.github.com/yargs/yargs-parser/issues/323)) ([09f448b](https://www.github.com/yargs/yargs-parser/commit/09f448b4cd66e25d2872544718df46dab8af062a))
+
+## [20.0.0](https://www.github.com/yargs/yargs-parser/compare/v19.0.4...v20.0.0) (2020-09-09)
+
+
+### ⚠ BREAKING CHANGES
+
+* do not ship type definitions (#318)
+
+### Bug Fixes
+
+* only strip camel case if hyphenated ([#316](https://www.github.com/yargs/yargs-parser/issues/316)) ([95a9e78](https://www.github.com/yargs/yargs-parser/commit/95a9e785127b9bbf2d1db1f1f808ca1fb100e82a)), closes [#315](https://www.github.com/yargs/yargs-parser/issues/315)
+
+
+### Code Refactoring
+
+* do not ship type definitions ([#318](https://www.github.com/yargs/yargs-parser/issues/318)) ([8fbd56f](https://www.github.com/yargs/yargs-parser/commit/8fbd56f1d0b6c44c30fca62708812151ca0ce330))
+
+### [19.0.4](https://www.github.com/yargs/yargs-parser/compare/v19.0.3...v19.0.4) (2020-08-27)
+
+
+### Bug Fixes
+
+* **build:** fixing publication ([#310](https://www.github.com/yargs/yargs-parser/issues/310)) ([5d3c6c2](https://www.github.com/yargs/yargs-parser/commit/5d3c6c29a9126248ba601920d9cf87c78e161ff5))
+
+### [19.0.3](https://www.github.com/yargs/yargs-parser/compare/v19.0.2...v19.0.3) (2020-08-27)
+
+
+### Bug Fixes
+
+* **build:** switch to action for publish ([#308](https://www.github.com/yargs/yargs-parser/issues/308)) ([5c2f305](https://www.github.com/yargs/yargs-parser/commit/5c2f30585342bcd8aaf926407c863099d256d174))
+
+### [19.0.2](https://www.github.com/yargs/yargs-parser/compare/v19.0.1...v19.0.2) (2020-08-27)
+
+
+### Bug Fixes
+
+* **types:** envPrefix should be optional ([#305](https://www.github.com/yargs/yargs-parser/issues/305)) ([ae3f180](https://www.github.com/yargs/yargs-parser/commit/ae3f180e14df2de2fd962145f4518f9aa0e76523))
+
+### [19.0.1](https://www.github.com/yargs/yargs-parser/compare/v19.0.0...v19.0.1) (2020-08-09)
+
+
+### Bug Fixes
+
+* **build:** push tag created for deno ([2186a14](https://www.github.com/yargs/yargs-parser/commit/2186a14989749887d56189867602e39e6679f8b0))
+
+## [19.0.0](https://www.github.com/yargs/yargs-parser/compare/v18.1.3...v19.0.0) (2020-08-09)
+
+
+### ⚠ BREAKING CHANGES
+
+* adds support for ESM and Deno (#295)
+* **ts:** projects using `@types/yargs-parser` may see variations in type definitions.
+* drops Node 6. begin following Node.js LTS schedule (#278)
+
+### Features
+
+* adds support for ESM and Deno ([#295](https://www.github.com/yargs/yargs-parser/issues/295)) ([195bc4a](https://www.github.com/yargs/yargs-parser/commit/195bc4a7f20c2a8f8e33fbb6ba96ef6e9a0120a1))
+* expose camelCase and decamelize helpers ([#296](https://www.github.com/yargs/yargs-parser/issues/296)) ([39154ce](https://www.github.com/yargs/yargs-parser/commit/39154ceb5bdcf76b5f59a9219b34cedb79b67f26))
+* **deps:** update to latest camelcase/decamelize ([#281](https://www.github.com/yargs/yargs-parser/issues/281)) ([8931ab0](https://www.github.com/yargs/yargs-parser/commit/8931ab08f686cc55286f33a95a83537da2be5516))
+
+
+### Bug Fixes
+
+* boolean numeric short option ([#294](https://www.github.com/yargs/yargs-parser/issues/294)) ([f600082](https://www.github.com/yargs/yargs-parser/commit/f600082c959e092076caf420bbbc9d7a231e2418))
+* raise permission error for Deno if config load fails ([#298](https://www.github.com/yargs/yargs-parser/issues/298)) ([1174e2b](https://www.github.com/yargs/yargs-parser/commit/1174e2b3f0c845a1cd64e14ffc3703e730567a84))
+* **deps:** update dependency decamelize to v3 ([#274](https://www.github.com/yargs/yargs-parser/issues/274)) ([4d98698](https://www.github.com/yargs/yargs-parser/commit/4d98698bc6767e84ec54a0842908191739be73b7))
+* **types:** switch back to using Partial types ([#293](https://www.github.com/yargs/yargs-parser/issues/293)) ([bdc80ba](https://www.github.com/yargs/yargs-parser/commit/bdc80ba59fa13bc3025ce0a85e8bad9f9da24ea7))
+
+
+### Build System
+
+* drops Node 6. begin following Node.js LTS schedule ([#278](https://www.github.com/yargs/yargs-parser/issues/278)) ([9014ed7](https://www.github.com/yargs/yargs-parser/commit/9014ed722a32768b96b829e65a31705db5c1458a))
+
+
+### Code Refactoring
+
+* **ts:** move index.js to TypeScript ([#292](https://www.github.com/yargs/yargs-parser/issues/292)) ([f78d2b9](https://www.github.com/yargs/yargs-parser/commit/f78d2b97567ac4828624406e420b4047c710b789))
+
+### [18.1.3](https://www.github.com/yargs/yargs-parser/compare/v18.1.2...v18.1.3) (2020-04-16)
+
+
+### Bug Fixes
+
+* **setArg:** options using camel-case and dot-notation populated twice ([#268](https://www.github.com/yargs/yargs-parser/issues/268)) ([f7e15b9](https://www.github.com/yargs/yargs-parser/commit/f7e15b9800900b9856acac1a830a5f35847be73e))
+
+### [18.1.2](https://www.github.com/yargs/yargs-parser/compare/v18.1.1...v18.1.2) (2020-03-26)
+
+
+### Bug Fixes
+
+* **array, nargs:** support -o=--value and --option=--value format ([#262](https://www.github.com/yargs/yargs-parser/issues/262)) ([41d3f81](https://www.github.com/yargs/yargs-parser/commit/41d3f8139e116706b28de9b0de3433feb08d2f13))
+
+### [18.1.1](https://www.github.com/yargs/yargs-parser/compare/v18.1.0...v18.1.1) (2020-03-16)
+
+
+### Bug Fixes
+
+* \_\_proto\_\_ will now be replaced with \_\_\_proto\_\_\_ in parse ([#258](https://www.github.com/yargs/yargs-parser/issues/258)), patching a potential
+prototype pollution vulnerability. This was reported by the Snyk Security Research Team.([63810ca](https://www.github.com/yargs/yargs-parser/commit/63810ca1ae1a24b08293a4d971e70e058c7a41e2))
+
+## [18.1.0](https://www.github.com/yargs/yargs-parser/compare/v18.0.0...v18.1.0) (2020-03-07)
+
+
+### Features
+
+* introduce single-digit boolean aliases ([#255](https://www.github.com/yargs/yargs-parser/issues/255)) ([9c60265](https://www.github.com/yargs/yargs-parser/commit/9c60265fd7a03cb98e6df3e32c8c5e7508d9f56f))
+
+## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02)
+
+
+### ⚠ BREAKING CHANGES
+
+* the narg count is now enforced when parsing arrays.
+
+### Features
+
+* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c))
+
+## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01)
+
+
+### Features
+
+* introduce greedy-arrays config, for specifying whether arrays consume multiple positionals ([#249](https://www.github.com/yargs/yargs-parser/issues/249)) ([60e880a](https://www.github.com/yargs/yargs-parser/commit/60e880a837046314d89fa4725f923837fd33a9eb))
+
+### [17.0.1](https://www.github.com/yargs/yargs-parser/compare/v17.0.0...v17.0.1) (2020-02-29)
+
+
+### Bug Fixes
+
+* normalized keys were not enumerable ([#247](https://www.github.com/yargs/yargs-parser/issues/247)) ([57119f9](https://www.github.com/yargs/yargs-parser/commit/57119f9f17cf27499bd95e61c2f72d18314f11ba))
+
+## [17.0.0](https://www.github.com/yargs/yargs-parser/compare/v16.1.0...v17.0.0) (2020-02-10)
+
+
+### ⚠ BREAKING CHANGES
+
+* this reverts parsing behavior of booleans to that of yargs@14
+* objects used during parsing are now created with a null
+prototype. There may be some scenarios where this change in behavior
+leaks externally.
+
+### Features
+
+* boolean arguments will not be collected into an implicit array ([#236](https://www.github.com/yargs/yargs-parser/issues/236)) ([34c4e19](https://www.github.com/yargs/yargs-parser/commit/34c4e19bae4e7af63e3cb6fa654a97ed476e5eb5))
+* introduce nargs-eats-options config option ([#246](https://www.github.com/yargs/yargs-parser/issues/246)) ([d50822a](https://www.github.com/yargs/yargs-parser/commit/d50822ac10e1b05f2e9643671ca131ac251b6732))
+
+
+### Bug Fixes
+
+* address bugs with "uknown-options-as-args" ([bc023e3](https://www.github.com/yargs/yargs-parser/commit/bc023e3b13e20a118353f9507d1c999bf388a346))
+* array should take precedence over nargs, but enforce nargs ([#243](https://www.github.com/yargs/yargs-parser/issues/243)) ([4cbc188](https://www.github.com/yargs/yargs-parser/commit/4cbc188b7abb2249529a19c090338debdad2fe6c))
+* support keys that collide with object prototypes ([#234](https://www.github.com/yargs/yargs-parser/issues/234)) ([1587b6d](https://www.github.com/yargs/yargs-parser/commit/1587b6d91db853a9109f1be6b209077993fee4de))
+* unknown options terminated with digits now handled by unknown-options-as-args ([#238](https://www.github.com/yargs/yargs-parser/issues/238)) ([d36cdfa](https://www.github.com/yargs/yargs-parser/commit/d36cdfa854254d7c7e0fe1d583818332ac46c2a5))
+
+## [16.1.0](https://www.github.com/yargs/yargs-parser/compare/v16.0.0...v16.1.0) (2019-11-01)
+
+
+### ⚠ BREAKING CHANGES
+
+* populate error if incompatible narg/count or array/count options are used (#191)
+
+### Features
+
+* options that have had their default value used are now tracked ([#211](https://www.github.com/yargs/yargs-parser/issues/211)) ([a525234](https://www.github.com/yargs/yargs-parser/commit/a525234558c847deedd73f8792e0a3b77b26e2c0))
+* populate error if incompatible narg/count or array/count options are used ([#191](https://www.github.com/yargs/yargs-parser/issues/191)) ([84a401f](https://www.github.com/yargs/yargs-parser/commit/84a401f0fa3095e0a19661670d1570d0c3b9d3c9))
+
+
+### Reverts
+
+* revert 16.0.0 CHANGELOG entry ([920320a](https://www.github.com/yargs/yargs-parser/commit/920320ad9861bbfd58eda39221ae211540fc1daf))
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/LICENSE.txt b/projects/arabica/src/sprint2/node_modules/yargs-parser/LICENSE.txt
new file mode 100644
index 0000000..836440b
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/LICENSE.txt
@@ -0,0 +1,14 @@
+Copyright (c) 2016, 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/projects/arabica/src/sprint2/node_modules/yargs-parser/README.md b/projects/arabica/src/sprint2/node_modules/yargs-parser/README.md
new file mode 100644
index 0000000..2614840
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/README.md
@@ -0,0 +1,518 @@
+# yargs-parser
+
+
+[](https://www.npmjs.com/package/yargs-parser)
+[](https://conventionalcommits.org)
+
+
+The mighty option parser used by [yargs](https://github.com/yargs/yargs).
+
+visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.
+
+
+
+## Example
+
+```sh
+npm i yargs-parser --save
+```
+
+```js
+const argv = require('yargs-parser')(process.argv.slice(2))
+console.log(argv)
+```
+
+```console
+$ node example.js --foo=33 --bar hello
+{ _: [], foo: 33, bar: 'hello' }
+```
+
+_or parse a string!_
+
+```js
+const argv = require('yargs-parser')('--foo=99 --bar=33')
+console.log(argv)
+```
+
+```console
+{ _: [], foo: 99, bar: 33 }
+```
+
+Convert an array of mixed types before passing to `yargs-parser`:
+
+```js
+const parse = require('yargs-parser')
+parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string
+parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings
+```
+
+## Deno Example
+
+As of `v19` `yargs-parser` supports [Deno](https://github.com/denoland/deno):
+
+```typescript
+import parser from "https://deno.land/x/yargs_parser/deno.ts";
+
+const argv = parser('--foo=99 --bar=9987930', {
+ string: ['bar']
+})
+console.log(argv)
+```
+
+## ESM Example
+
+As of `v19` `yargs-parser` supports ESM (_both in Node.js and in the browser_):
+
+**Node.js:**
+
+```js
+import parser from 'yargs-parser'
+
+const argv = parser('--foo=99 --bar=9987930', {
+ string: ['bar']
+})
+console.log(argv)
+```
+
+**Browsers:**
+
+```html
+
+
+
+
+```
+
+## API
+
+### parser(args, opts={})
+
+Parses command line arguments returning a simple mapping of keys and values.
+
+**expects:**
+
+* `args`: a string or array of strings representing the options to parse.
+* `opts`: provide a set of hints indicating how `args` should be parsed:
+ * `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.
+ * `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.
+ Indicate that keys should be parsed as an array and coerced to booleans / numbers:
+ `{array: [{ key: 'foo', boolean: true }, {key: 'bar', number: true}]}`.
+ * `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`.
+ * `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided
+ (or throws an error). For arrays the function is called only once for the entire array:
+ `{coerce: {foo: function (arg) {return modifiedArg}}}`.
+ * `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed).
+ * `opts.configObjects`: configuration objects to parse, their properties will be set as arguments:
+ `{configObjects: [{'x': 5, 'y': 33}, {'z': 44}]}`.
+ * `opts.configuration`: provide configuration options to the yargs-parser (see: [configuration](#configuration)).
+ * `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`.
+ * `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`.
+ * `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed.
+ * `opts.narg`: specify that a key requires `n` arguments: `{narg: {x: 2}}`.
+ * `opts.normalize`: `path.normalize()` will be applied to values set to this key.
+ * `opts.number`: keys should be treated as numbers.
+ * `opts.string`: keys should be treated as strings (even if they resemble a number `-x 33`).
+
+**returns:**
+
+* `obj`: an object representing the parsed value of `args`
+ * `key/value`: key value pairs for each argument and their aliases.
+ * `_`: an array representing the positional arguments.
+ * [optional] `--`: an array with arguments after the end-of-options flag `--`.
+
+### require('yargs-parser').detailed(args, opts={})
+
+Parses a command line string, returning detailed information required by the
+yargs engine.
+
+**expects:**
+
+* `args`: a string or array of strings representing options to parse.
+* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.
+
+**returns:**
+
+* `argv`: an object representing the parsed value of `args`
+ * `key/value`: key value pairs for each argument and their aliases.
+ * `_`: an array representing the positional arguments.
+ * [optional] `--`: an array with arguments after the end-of-options flag `--`.
+* `error`: populated with an error object if an exception occurred during parsing.
+* `aliases`: the inferred list of aliases built by combining lists in `opts.alias`.
+* `newAliases`: any new aliases added via camel-case expansion:
+ * `boolean`: `{ fooBar: true }`
+* `defaulted`: any new argument created by `opts.default`, no aliases included.
+ * `boolean`: `{ foo: true }`
+* `configuration`: given by default settings and `opts.configuration`.
+
+
+
+### Configuration
+
+The yargs-parser applies several automated transformations on the keys provided
+in `args`. These features can be turned on and off using the `configuration` field
+of `opts`.
+
+```js
+var parsed = parser(['--no-dice'], {
+ configuration: {
+ 'boolean-negation': false
+ }
+})
+```
+
+### short option groups
+
+* default: `true`.
+* key: `short-option-groups`.
+
+Should a group of short-options be treated as boolean flags?
+
+```console
+$ node example.js -abc
+{ _: [], a: true, b: true, c: true }
+```
+
+_if disabled:_
+
+```console
+$ node example.js -abc
+{ _: [], abc: true }
+```
+
+### camel-case expansion
+
+* default: `true`.
+* key: `camel-case-expansion`.
+
+Should hyphenated arguments be expanded into camel-case aliases?
+
+```console
+$ node example.js --foo-bar
+{ _: [], 'foo-bar': true, fooBar: true }
+```
+
+_if disabled:_
+
+```console
+$ node example.js --foo-bar
+{ _: [], 'foo-bar': true }
+```
+
+### dot-notation
+
+* default: `true`
+* key: `dot-notation`
+
+Should keys that contain `.` be treated as objects?
+
+```console
+$ node example.js --foo.bar
+{ _: [], foo: { bar: true } }
+```
+
+_if disabled:_
+
+```console
+$ node example.js --foo.bar
+{ _: [], "foo.bar": true }
+```
+
+### parse numbers
+
+* default: `true`
+* key: `parse-numbers`
+
+Should keys that look like numbers be treated as such?
+
+```console
+$ node example.js --foo=99.3
+{ _: [], foo: 99.3 }
+```
+
+_if disabled:_
+
+```console
+$ node example.js --foo=99.3
+{ _: [], foo: "99.3" }
+```
+
+### parse positional numbers
+
+* default: `true`
+* key: `parse-positional-numbers`
+
+Should positional keys that look like numbers be treated as such.
+
+```console
+$ node example.js 99.3
+{ _: [99.3] }
+```
+
+_if disabled:_
+
+```console
+$ node example.js 99.3
+{ _: ['99.3'] }
+```
+
+### boolean negation
+
+* default: `true`
+* key: `boolean-negation`
+
+Should variables prefixed with `--no` be treated as negations?
+
+```console
+$ node example.js --no-foo
+{ _: [], foo: false }
+```
+
+_if disabled:_
+
+```console
+$ node example.js --no-foo
+{ _: [], "no-foo": true }
+```
+
+### combine arrays
+
+* default: `false`
+* key: `combine-arrays`
+
+Should arrays be combined when provided by both command line arguments and
+a configuration file.
+
+### duplicate arguments array
+
+* default: `true`
+* key: `duplicate-arguments-array`
+
+Should arguments be coerced into an array when duplicated:
+
+```console
+$ node example.js -x 1 -x 2
+{ _: [], x: [1, 2] }
+```
+
+_if disabled:_
+
+```console
+$ node example.js -x 1 -x 2
+{ _: [], x: 2 }
+```
+
+### flatten duplicate arrays
+
+* default: `true`
+* key: `flatten-duplicate-arrays`
+
+Should array arguments be coerced into a single array when duplicated:
+
+```console
+$ node example.js -x 1 2 -x 3 4
+{ _: [], x: [1, 2, 3, 4] }
+```
+
+_if disabled:_
+
+```console
+$ node example.js -x 1 2 -x 3 4
+{ _: [], x: [[1, 2], [3, 4]] }
+```
+
+### greedy arrays
+
+* default: `true`
+* key: `greedy-arrays`
+
+Should arrays consume more than one positional argument following their flag.
+
+```console
+$ node example --arr 1 2
+{ _: [], arr: [1, 2] }
+```
+
+_if disabled:_
+
+```console
+$ node example --arr 1 2
+{ _: [2], arr: [1] }
+```
+
+**Note: in `v18.0.0` we are considering defaulting greedy arrays to `false`.**
+
+### nargs eats options
+
+* default: `false`
+* key: `nargs-eats-options`
+
+Should nargs consume dash options as well as positional arguments.
+
+### negation prefix
+
+* default: `no-`
+* key: `negation-prefix`
+
+The prefix to use for negated boolean variables.
+
+```console
+$ node example.js --no-foo
+{ _: [], foo: false }
+```
+
+_if set to `quux`:_
+
+```console
+$ node example.js --quuxfoo
+{ _: [], foo: false }
+```
+
+### populate --
+
+* default: `false`.
+* key: `populate--`
+
+Should unparsed flags be stored in `--` or `_`.
+
+_If disabled:_
+
+```console
+$ node example.js a -b -- x y
+{ _: [ 'a', 'x', 'y' ], b: true }
+```
+
+_If enabled:_
+
+```console
+$ node example.js a -b -- x y
+{ _: [ 'a' ], '--': [ 'x', 'y' ], b: true }
+```
+
+### set placeholder key
+
+* default: `false`.
+* key: `set-placeholder-key`.
+
+Should a placeholder be added for keys not set via the corresponding CLI argument?
+
+_If disabled:_
+
+```console
+$ node example.js -a 1 -c 2
+{ _: [], a: 1, c: 2 }
+```
+
+_If enabled:_
+
+```console
+$ node example.js -a 1 -c 2
+{ _: [], a: 1, b: undefined, c: 2 }
+```
+
+### halt at non-option
+
+* default: `false`.
+* key: `halt-at-non-option`.
+
+Should parsing stop at the first positional argument? This is similar to how e.g. `ssh` parses its command line.
+
+_If disabled:_
+
+```console
+$ node example.js -a run b -x y
+{ _: [ 'b' ], a: 'run', x: 'y' }
+```
+
+_If enabled:_
+
+```console
+$ node example.js -a run b -x y
+{ _: [ 'b', '-x', 'y' ], a: 'run' }
+```
+
+### strip aliased
+
+* default: `false`
+* key: `strip-aliased`
+
+Should aliases be removed before returning results?
+
+_If disabled:_
+
+```console
+$ node example.js --test-field 1
+{ _: [], 'test-field': 1, testField: 1, 'test-alias': 1, testAlias: 1 }
+```
+
+_If enabled:_
+
+```console
+$ node example.js --test-field 1
+{ _: [], 'test-field': 1, testField: 1 }
+```
+
+### strip dashed
+
+* default: `false`
+* key: `strip-dashed`
+
+Should dashed keys be removed before returning results? This option has no effect if
+`camel-case-expansion` is disabled.
+
+_If disabled:_
+
+```console
+$ node example.js --test-field 1
+{ _: [], 'test-field': 1, testField: 1 }
+```
+
+_If enabled:_
+
+```console
+$ node example.js --test-field 1
+{ _: [], testField: 1 }
+```
+
+### unknown options as args
+
+* default: `false`
+* key: `unknown-options-as-args`
+
+Should unknown options be treated like regular arguments? An unknown option is one that is not
+configured in `opts`.
+
+_If disabled_
+
+```console
+$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
+{ _: [], unknownOption: true, knownOption: 2, stringOption: '', unknownOption2: true }
+```
+
+_If enabled_
+
+```console
+$ node example.js --unknown-option --known-option 2 --string-option --unknown-option2
+{ _: ['--unknown-option'], knownOption: 2, stringOption: '--unknown-option2' }
+```
+
+## Supported Node.js Versions
+
+Libraries in this ecosystem make a best effort to track
+[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
+post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
+
+## Special Thanks
+
+The yargs project evolves from optimist and minimist. It owes its
+existence to a lot of James Halliday's hard work. Thanks [substack](https://github.com/substack) **beep** **boop** \o/
+
+## License
+
+ISC
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/browser.js b/projects/arabica/src/sprint2/node_modules/yargs-parser/browser.js
new file mode 100644
index 0000000..241202c
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/browser.js
@@ -0,0 +1,29 @@
+// Main entrypoint for ESM web browser environments. Avoids using Node.js
+// specific libraries, such as "path".
+//
+// TODO: figure out reasonable web equivalents for "resolve", "normalize", etc.
+import { camelCase, decamelize, looksLikeNumber } from './build/lib/string-utils.js'
+import { YargsParser } from './build/lib/yargs-parser.js'
+const parser = new YargsParser({
+ cwd: () => { return '' },
+ format: (str, arg) => { return str.replace('%s', arg) },
+ normalize: (str) => { return str },
+ resolve: (str) => { return str },
+ require: () => {
+ throw Error('loading config from files not currently supported in browser')
+ },
+ env: () => {}
+})
+
+const yargsParser = function Parser (args, opts) {
+ const result = parser.parse(args.slice(), opts)
+ return result.argv
+}
+yargsParser.detailed = function (args, opts) {
+ return parser.parse(args.slice(), opts)
+}
+yargsParser.camelCase = camelCase
+yargsParser.decamelize = decamelize
+yargsParser.looksLikeNumber = looksLikeNumber
+
+export default yargsParser
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/build/index.cjs b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/index.cjs
new file mode 100644
index 0000000..33b5ebd
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/index.cjs
@@ -0,0 +1,1042 @@
+'use strict';
+
+var util = require('util');
+var fs = require('fs');
+var path = require('path');
+
+function camelCase(str) {
+ const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
+ if (!isCamelCase) {
+ str = str.toLowerCase();
+ }
+ if (str.indexOf('-') === -1 && str.indexOf('_') === -1) {
+ return str;
+ }
+ else {
+ let camelcase = '';
+ let nextChrUpper = false;
+ const leadingHyphens = str.match(/^-+/);
+ for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
+ let chr = str.charAt(i);
+ if (nextChrUpper) {
+ nextChrUpper = false;
+ chr = chr.toUpperCase();
+ }
+ if (i !== 0 && (chr === '-' || chr === '_')) {
+ nextChrUpper = true;
+ }
+ else if (chr !== '-' && chr !== '_') {
+ camelcase += chr;
+ }
+ }
+ return camelcase;
+ }
+}
+function decamelize(str, joinString) {
+ const lowercase = str.toLowerCase();
+ joinString = joinString || '-';
+ let notCamelcase = '';
+ for (let i = 0; i < str.length; i++) {
+ const chrLower = lowercase.charAt(i);
+ const chrString = str.charAt(i);
+ if (chrLower !== chrString && i > 0) {
+ notCamelcase += `${joinString}${lowercase.charAt(i)}`;
+ }
+ else {
+ notCamelcase += chrString;
+ }
+ }
+ return notCamelcase;
+}
+function looksLikeNumber(x) {
+ if (x === null || x === undefined)
+ return false;
+ if (typeof x === 'number')
+ return true;
+ if (/^0x[0-9a-f]+$/i.test(x))
+ return true;
+ if (/^0[^.]/.test(x))
+ return false;
+ return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
+}
+
+function tokenizeArgString(argString) {
+ if (Array.isArray(argString)) {
+ return argString.map(e => typeof e !== 'string' ? e + '' : e);
+ }
+ argString = argString.trim();
+ let i = 0;
+ let prevC = null;
+ let c = null;
+ let opening = null;
+ const args = [];
+ for (let ii = 0; ii < argString.length; ii++) {
+ prevC = c;
+ c = argString.charAt(ii);
+ if (c === ' ' && !opening) {
+ if (!(prevC === ' ')) {
+ i++;
+ }
+ continue;
+ }
+ if (c === opening) {
+ opening = null;
+ }
+ else if ((c === "'" || c === '"') && !opening) {
+ opening = c;
+ }
+ if (!args[i])
+ args[i] = '';
+ args[i] += c;
+ }
+ return args;
+}
+
+var DefaultValuesForTypeKey;
+(function (DefaultValuesForTypeKey) {
+ DefaultValuesForTypeKey["BOOLEAN"] = "boolean";
+ DefaultValuesForTypeKey["STRING"] = "string";
+ DefaultValuesForTypeKey["NUMBER"] = "number";
+ DefaultValuesForTypeKey["ARRAY"] = "array";
+})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
+
+let mixin;
+class YargsParser {
+ constructor(_mixin) {
+ mixin = _mixin;
+ }
+ parse(argsInput, options) {
+ const opts = Object.assign({
+ alias: undefined,
+ array: undefined,
+ boolean: undefined,
+ config: undefined,
+ configObjects: undefined,
+ configuration: undefined,
+ coerce: undefined,
+ count: undefined,
+ default: undefined,
+ envPrefix: undefined,
+ narg: undefined,
+ normalize: undefined,
+ string: undefined,
+ number: undefined,
+ __: undefined,
+ key: undefined
+ }, options);
+ const args = tokenizeArgString(argsInput);
+ const aliases = combineAliases(Object.assign(Object.create(null), opts.alias));
+ const configuration = Object.assign({
+ 'boolean-negation': true,
+ 'camel-case-expansion': true,
+ 'combine-arrays': false,
+ 'dot-notation': true,
+ 'duplicate-arguments-array': true,
+ 'flatten-duplicate-arrays': true,
+ 'greedy-arrays': true,
+ 'halt-at-non-option': false,
+ 'nargs-eats-options': false,
+ 'negation-prefix': 'no-',
+ 'parse-numbers': true,
+ 'parse-positional-numbers': true,
+ 'populate--': false,
+ 'set-placeholder-key': false,
+ 'short-option-groups': true,
+ 'strip-aliased': false,
+ 'strip-dashed': false,
+ 'unknown-options-as-args': false
+ }, opts.configuration);
+ const defaults = Object.assign(Object.create(null), opts.default);
+ const configObjects = opts.configObjects || [];
+ const envPrefix = opts.envPrefix;
+ const notFlagsOption = configuration['populate--'];
+ const notFlagsArgv = notFlagsOption ? '--' : '_';
+ const newAliases = Object.create(null);
+ const defaulted = Object.create(null);
+ const __ = opts.__ || mixin.format;
+ const flags = {
+ aliases: Object.create(null),
+ arrays: Object.create(null),
+ bools: Object.create(null),
+ strings: Object.create(null),
+ numbers: Object.create(null),
+ counts: Object.create(null),
+ normalize: Object.create(null),
+ configs: Object.create(null),
+ nargs: Object.create(null),
+ coercions: Object.create(null),
+ keys: []
+ };
+ const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
+ const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)');
+ [].concat(opts.array || []).filter(Boolean).forEach(function (opt) {
+ const key = typeof opt === 'object' ? opt.key : opt;
+ const assignment = Object.keys(opt).map(function (key) {
+ const arrayFlagKeys = {
+ boolean: 'bools',
+ string: 'strings',
+ number: 'numbers'
+ };
+ return arrayFlagKeys[key];
+ }).filter(Boolean).pop();
+ if (assignment) {
+ flags[assignment][key] = true;
+ }
+ flags.arrays[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.boolean || []).filter(Boolean).forEach(function (key) {
+ flags.bools[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.string || []).filter(Boolean).forEach(function (key) {
+ flags.strings[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.number || []).filter(Boolean).forEach(function (key) {
+ flags.numbers[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.count || []).filter(Boolean).forEach(function (key) {
+ flags.counts[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.normalize || []).filter(Boolean).forEach(function (key) {
+ flags.normalize[key] = true;
+ flags.keys.push(key);
+ });
+ if (typeof opts.narg === 'object') {
+ Object.entries(opts.narg).forEach(([key, value]) => {
+ if (typeof value === 'number') {
+ flags.nargs[key] = value;
+ flags.keys.push(key);
+ }
+ });
+ }
+ if (typeof opts.coerce === 'object') {
+ Object.entries(opts.coerce).forEach(([key, value]) => {
+ if (typeof value === 'function') {
+ flags.coercions[key] = value;
+ flags.keys.push(key);
+ }
+ });
+ }
+ if (typeof opts.config !== 'undefined') {
+ if (Array.isArray(opts.config) || typeof opts.config === 'string') {
+ [].concat(opts.config).filter(Boolean).forEach(function (key) {
+ flags.configs[key] = true;
+ });
+ }
+ else if (typeof opts.config === 'object') {
+ Object.entries(opts.config).forEach(([key, value]) => {
+ if (typeof value === 'boolean' || typeof value === 'function') {
+ flags.configs[key] = value;
+ }
+ });
+ }
+ }
+ extendAliases(opts.key, aliases, opts.default, flags.arrays);
+ Object.keys(defaults).forEach(function (key) {
+ (flags.aliases[key] || []).forEach(function (alias) {
+ defaults[alias] = defaults[key];
+ });
+ });
+ let error = null;
+ checkConfiguration();
+ let notFlags = [];
+ const argv = Object.assign(Object.create(null), { _: [] });
+ const argvReturn = {};
+ for (let i = 0; i < args.length; i++) {
+ const arg = args[i];
+ const truncatedArg = arg.replace(/^-{3,}/, '---');
+ let broken;
+ let key;
+ let letters;
+ let m;
+ let next;
+ let value;
+ if (arg !== '--' && isUnknownOptionAsArg(arg)) {
+ pushPositional(arg);
+ }
+ else if (truncatedArg.match(/---+(=|$)/)) {
+ pushPositional(arg);
+ continue;
+ }
+ else if (arg.match(/^--.+=/) || (!configuration['short-option-groups'] && arg.match(/^-.+=/))) {
+ m = arg.match(/^--?([^=]+)=([\s\S]*)$/);
+ if (m !== null && Array.isArray(m) && m.length >= 3) {
+ if (checkAllAliases(m[1], flags.arrays)) {
+ i = eatArray(i, m[1], args, m[2]);
+ }
+ else if (checkAllAliases(m[1], flags.nargs) !== false) {
+ i = eatNargs(i, m[1], args, m[2]);
+ }
+ else {
+ setArg(m[1], m[2]);
+ }
+ }
+ }
+ else if (arg.match(negatedBoolean) && configuration['boolean-negation']) {
+ m = arg.match(negatedBoolean);
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
+ key = m[1];
+ setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false);
+ }
+ }
+ else if (arg.match(/^--.+/) || (!configuration['short-option-groups'] && arg.match(/^-[^-]+/))) {
+ m = arg.match(/^--?(.+)/);
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
+ key = m[1];
+ if (checkAllAliases(key, flags.arrays)) {
+ i = eatArray(i, key, args);
+ }
+ else if (checkAllAliases(key, flags.nargs) !== false) {
+ i = eatNargs(i, key, args);
+ }
+ else {
+ next = args[i + 1];
+ if (next !== undefined && (!next.match(/^-/) ||
+ next.match(negative)) &&
+ !checkAllAliases(key, flags.bools) &&
+ !checkAllAliases(key, flags.counts)) {
+ setArg(key, next);
+ i++;
+ }
+ else if (/^(true|false)$/.test(next)) {
+ setArg(key, next);
+ i++;
+ }
+ else {
+ setArg(key, defaultValue(key));
+ }
+ }
+ }
+ }
+ else if (arg.match(/^-.\..+=/)) {
+ m = arg.match(/^-([^=]+)=([\s\S]*)$/);
+ if (m !== null && Array.isArray(m) && m.length >= 3) {
+ setArg(m[1], m[2]);
+ }
+ }
+ else if (arg.match(/^-.\..+/) && !arg.match(negative)) {
+ next = args[i + 1];
+ m = arg.match(/^-(.\..+)/);
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
+ key = m[1];
+ if (next !== undefined && !next.match(/^-/) &&
+ !checkAllAliases(key, flags.bools) &&
+ !checkAllAliases(key, flags.counts)) {
+ setArg(key, next);
+ i++;
+ }
+ else {
+ setArg(key, defaultValue(key));
+ }
+ }
+ }
+ else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
+ letters = arg.slice(1, -1).split('');
+ broken = false;
+ for (let j = 0; j < letters.length; j++) {
+ next = arg.slice(j + 2);
+ if (letters[j + 1] && letters[j + 1] === '=') {
+ value = arg.slice(j + 3);
+ key = letters[j];
+ if (checkAllAliases(key, flags.arrays)) {
+ i = eatArray(i, key, args, value);
+ }
+ else if (checkAllAliases(key, flags.nargs) !== false) {
+ i = eatNargs(i, key, args, value);
+ }
+ else {
+ setArg(key, value);
+ }
+ broken = true;
+ break;
+ }
+ if (next === '-') {
+ setArg(letters[j], next);
+ continue;
+ }
+ if (/[A-Za-z]/.test(letters[j]) &&
+ /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) &&
+ checkAllAliases(next, flags.bools) === false) {
+ setArg(letters[j], next);
+ broken = true;
+ break;
+ }
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
+ setArg(letters[j], next);
+ broken = true;
+ break;
+ }
+ else {
+ setArg(letters[j], defaultValue(letters[j]));
+ }
+ }
+ key = arg.slice(-1)[0];
+ if (!broken && key !== '-') {
+ if (checkAllAliases(key, flags.arrays)) {
+ i = eatArray(i, key, args);
+ }
+ else if (checkAllAliases(key, flags.nargs) !== false) {
+ i = eatNargs(i, key, args);
+ }
+ else {
+ next = args[i + 1];
+ if (next !== undefined && (!/^(-|--)[^-]/.test(next) ||
+ next.match(negative)) &&
+ !checkAllAliases(key, flags.bools) &&
+ !checkAllAliases(key, flags.counts)) {
+ setArg(key, next);
+ i++;
+ }
+ else if (/^(true|false)$/.test(next)) {
+ setArg(key, next);
+ i++;
+ }
+ else {
+ setArg(key, defaultValue(key));
+ }
+ }
+ }
+ }
+ else if (arg.match(/^-[0-9]$/) &&
+ arg.match(negative) &&
+ checkAllAliases(arg.slice(1), flags.bools)) {
+ key = arg.slice(1);
+ setArg(key, defaultValue(key));
+ }
+ else if (arg === '--') {
+ notFlags = args.slice(i + 1);
+ break;
+ }
+ else if (configuration['halt-at-non-option']) {
+ notFlags = args.slice(i);
+ break;
+ }
+ else {
+ pushPositional(arg);
+ }
+ }
+ applyEnvVars(argv, true);
+ applyEnvVars(argv, false);
+ setConfig(argv);
+ setConfigObjects();
+ applyDefaultsAndAliases(argv, flags.aliases, defaults, true);
+ applyCoercions(argv);
+ if (configuration['set-placeholder-key'])
+ setPlaceholderKeys(argv);
+ Object.keys(flags.counts).forEach(function (key) {
+ if (!hasKey(argv, key.split('.')))
+ setArg(key, 0);
+ });
+ if (notFlagsOption && notFlags.length)
+ argv[notFlagsArgv] = [];
+ notFlags.forEach(function (key) {
+ argv[notFlagsArgv].push(key);
+ });
+ if (configuration['camel-case-expansion'] && configuration['strip-dashed']) {
+ Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => {
+ delete argv[key];
+ });
+ }
+ if (configuration['strip-aliased']) {
+ [].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => {
+ if (configuration['camel-case-expansion'] && alias.includes('-')) {
+ delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')];
+ }
+ delete argv[alias];
+ });
+ }
+ function pushPositional(arg) {
+ const maybeCoercedNumber = maybeCoerceNumber('_', arg);
+ if (typeof maybeCoercedNumber === 'string' || typeof maybeCoercedNumber === 'number') {
+ argv._.push(maybeCoercedNumber);
+ }
+ }
+ function eatNargs(i, key, args, argAfterEqualSign) {
+ let ii;
+ let toEat = checkAllAliases(key, flags.nargs);
+ toEat = typeof toEat !== 'number' || isNaN(toEat) ? 1 : toEat;
+ if (toEat === 0) {
+ if (!isUndefined(argAfterEqualSign)) {
+ error = Error(__('Argument unexpected for: %s', key));
+ }
+ setArg(key, defaultValue(key));
+ return i;
+ }
+ let available = isUndefined(argAfterEqualSign) ? 0 : 1;
+ if (configuration['nargs-eats-options']) {
+ if (args.length - (i + 1) + available < toEat) {
+ error = Error(__('Not enough arguments following: %s', key));
+ }
+ available = toEat;
+ }
+ else {
+ for (ii = i + 1; ii < args.length; ii++) {
+ if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii]))
+ available++;
+ else
+ break;
+ }
+ if (available < toEat)
+ error = Error(__('Not enough arguments following: %s', key));
+ }
+ let consumed = Math.min(available, toEat);
+ if (!isUndefined(argAfterEqualSign) && consumed > 0) {
+ setArg(key, argAfterEqualSign);
+ consumed--;
+ }
+ for (ii = i + 1; ii < (consumed + i + 1); ii++) {
+ setArg(key, args[ii]);
+ }
+ return (i + consumed);
+ }
+ function eatArray(i, key, args, argAfterEqualSign) {
+ let argsToSet = [];
+ let next = argAfterEqualSign || args[i + 1];
+ const nargsCount = checkAllAliases(key, flags.nargs);
+ if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) {
+ argsToSet.push(true);
+ }
+ else if (isUndefined(next) ||
+ (isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) {
+ if (defaults[key] !== undefined) {
+ const defVal = defaults[key];
+ argsToSet = Array.isArray(defVal) ? defVal : [defVal];
+ }
+ }
+ else {
+ if (!isUndefined(argAfterEqualSign)) {
+ argsToSet.push(processValue(key, argAfterEqualSign));
+ }
+ for (let ii = i + 1; ii < args.length; ii++) {
+ if ((!configuration['greedy-arrays'] && argsToSet.length > 0) ||
+ (nargsCount && typeof nargsCount === 'number' && argsToSet.length >= nargsCount))
+ break;
+ next = args[ii];
+ if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))
+ break;
+ i = ii;
+ argsToSet.push(processValue(key, next));
+ }
+ }
+ if (typeof nargsCount === 'number' && ((nargsCount && argsToSet.length < nargsCount) ||
+ (isNaN(nargsCount) && argsToSet.length === 0))) {
+ error = Error(__('Not enough arguments following: %s', key));
+ }
+ setArg(key, argsToSet);
+ return i;
+ }
+ function setArg(key, val) {
+ if (/-/.test(key) && configuration['camel-case-expansion']) {
+ const alias = key.split('.').map(function (prop) {
+ return camelCase(prop);
+ }).join('.');
+ addNewAlias(key, alias);
+ }
+ const value = processValue(key, val);
+ const splitKey = key.split('.');
+ setKey(argv, splitKey, value);
+ if (flags.aliases[key]) {
+ flags.aliases[key].forEach(function (x) {
+ const keyProperties = x.split('.');
+ setKey(argv, keyProperties, value);
+ });
+ }
+ if (splitKey.length > 1 && configuration['dot-notation']) {
+ (flags.aliases[splitKey[0]] || []).forEach(function (x) {
+ let keyProperties = x.split('.');
+ const a = [].concat(splitKey);
+ a.shift();
+ keyProperties = keyProperties.concat(a);
+ if (!(flags.aliases[key] || []).includes(keyProperties.join('.'))) {
+ setKey(argv, keyProperties, value);
+ }
+ });
+ }
+ if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) {
+ const keys = [key].concat(flags.aliases[key] || []);
+ keys.forEach(function (key) {
+ Object.defineProperty(argvReturn, key, {
+ enumerable: true,
+ get() {
+ return val;
+ },
+ set(value) {
+ val = typeof value === 'string' ? mixin.normalize(value) : value;
+ }
+ });
+ });
+ }
+ }
+ function addNewAlias(key, alias) {
+ if (!(flags.aliases[key] && flags.aliases[key].length)) {
+ flags.aliases[key] = [alias];
+ newAliases[alias] = true;
+ }
+ if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
+ addNewAlias(alias, key);
+ }
+ }
+ function processValue(key, val) {
+ if (typeof val === 'string' &&
+ (val[0] === "'" || val[0] === '"') &&
+ val[val.length - 1] === val[0]) {
+ val = val.substring(1, val.length - 1);
+ }
+ if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
+ if (typeof val === 'string')
+ val = val === 'true';
+ }
+ let value = Array.isArray(val)
+ ? val.map(function (v) { return maybeCoerceNumber(key, v); })
+ : maybeCoerceNumber(key, val);
+ if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) {
+ value = increment();
+ }
+ if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
+ if (Array.isArray(val))
+ value = val.map((val) => { return mixin.normalize(val); });
+ else
+ value = mixin.normalize(val);
+ }
+ return value;
+ }
+ function maybeCoerceNumber(key, value) {
+ if (!configuration['parse-positional-numbers'] && key === '_')
+ return value;
+ if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) {
+ const shouldCoerceNumber = looksLikeNumber(value) && configuration['parse-numbers'] && (Number.isSafeInteger(Math.floor(parseFloat(`${value}`))));
+ if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) {
+ value = Number(value);
+ }
+ }
+ return value;
+ }
+ function setConfig(argv) {
+ const configLookup = Object.create(null);
+ applyDefaultsAndAliases(configLookup, flags.aliases, defaults);
+ Object.keys(flags.configs).forEach(function (configKey) {
+ const configPath = argv[configKey] || configLookup[configKey];
+ if (configPath) {
+ try {
+ let config = null;
+ const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath);
+ const resolveConfig = flags.configs[configKey];
+ if (typeof resolveConfig === 'function') {
+ try {
+ config = resolveConfig(resolvedConfigPath);
+ }
+ catch (e) {
+ config = e;
+ }
+ if (config instanceof Error) {
+ error = config;
+ return;
+ }
+ }
+ else {
+ config = mixin.require(resolvedConfigPath);
+ }
+ setConfigObject(config);
+ }
+ catch (ex) {
+ if (ex.name === 'PermissionDenied')
+ error = ex;
+ else if (argv[configKey])
+ error = Error(__('Invalid JSON config file: %s', configPath));
+ }
+ }
+ });
+ }
+ function setConfigObject(config, prev) {
+ Object.keys(config).forEach(function (key) {
+ const value = config[key];
+ const fullKey = prev ? prev + '.' + key : key;
+ if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) {
+ setConfigObject(value, fullKey);
+ }
+ else {
+ if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) {
+ setArg(fullKey, value);
+ }
+ }
+ });
+ }
+ function setConfigObjects() {
+ if (typeof configObjects !== 'undefined') {
+ configObjects.forEach(function (configObject) {
+ setConfigObject(configObject);
+ });
+ }
+ }
+ function applyEnvVars(argv, configOnly) {
+ if (typeof envPrefix === 'undefined')
+ return;
+ const prefix = typeof envPrefix === 'string' ? envPrefix : '';
+ const env = mixin.env();
+ Object.keys(env).forEach(function (envVar) {
+ if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) {
+ const keys = envVar.split('__').map(function (key, i) {
+ if (i === 0) {
+ key = key.substring(prefix.length);
+ }
+ return camelCase(key);
+ });
+ if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) {
+ setArg(keys.join('.'), env[envVar]);
+ }
+ }
+ });
+ }
+ function applyCoercions(argv) {
+ let coerce;
+ const applied = new Set();
+ Object.keys(argv).forEach(function (key) {
+ if (!applied.has(key)) {
+ coerce = checkAllAliases(key, flags.coercions);
+ if (typeof coerce === 'function') {
+ try {
+ const value = maybeCoerceNumber(key, coerce(argv[key]));
+ ([].concat(flags.aliases[key] || [], key)).forEach(ali => {
+ applied.add(ali);
+ argv[ali] = value;
+ });
+ }
+ catch (err) {
+ error = err;
+ }
+ }
+ }
+ });
+ }
+ function setPlaceholderKeys(argv) {
+ flags.keys.forEach((key) => {
+ if (~key.indexOf('.'))
+ return;
+ if (typeof argv[key] === 'undefined')
+ argv[key] = undefined;
+ });
+ return argv;
+ }
+ function applyDefaultsAndAliases(obj, aliases, defaults, canLog = false) {
+ Object.keys(defaults).forEach(function (key) {
+ if (!hasKey(obj, key.split('.'))) {
+ setKey(obj, key.split('.'), defaults[key]);
+ if (canLog)
+ defaulted[key] = true;
+ (aliases[key] || []).forEach(function (x) {
+ if (hasKey(obj, x.split('.')))
+ return;
+ setKey(obj, x.split('.'), defaults[key]);
+ });
+ }
+ });
+ }
+ function hasKey(obj, keys) {
+ let o = obj;
+ if (!configuration['dot-notation'])
+ keys = [keys.join('.')];
+ keys.slice(0, -1).forEach(function (key) {
+ o = (o[key] || {});
+ });
+ const key = keys[keys.length - 1];
+ if (typeof o !== 'object')
+ return false;
+ else
+ return key in o;
+ }
+ function setKey(obj, keys, value) {
+ let o = obj;
+ if (!configuration['dot-notation'])
+ keys = [keys.join('.')];
+ keys.slice(0, -1).forEach(function (key) {
+ key = sanitizeKey(key);
+ if (typeof o === 'object' && o[key] === undefined) {
+ o[key] = {};
+ }
+ if (typeof o[key] !== 'object' || Array.isArray(o[key])) {
+ if (Array.isArray(o[key])) {
+ o[key].push({});
+ }
+ else {
+ o[key] = [o[key], {}];
+ }
+ o = o[key][o[key].length - 1];
+ }
+ else {
+ o = o[key];
+ }
+ });
+ const key = sanitizeKey(keys[keys.length - 1]);
+ const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays);
+ const isValueArray = Array.isArray(value);
+ let duplicate = configuration['duplicate-arguments-array'];
+ if (!duplicate && checkAllAliases(key, flags.nargs)) {
+ duplicate = true;
+ if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) {
+ o[key] = undefined;
+ }
+ }
+ if (value === increment()) {
+ o[key] = increment(o[key]);
+ }
+ else if (Array.isArray(o[key])) {
+ if (duplicate && isTypeArray && isValueArray) {
+ o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]);
+ }
+ else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
+ o[key] = value;
+ }
+ else {
+ o[key] = o[key].concat([value]);
+ }
+ }
+ else if (o[key] === undefined && isTypeArray) {
+ o[key] = isValueArray ? value : [value];
+ }
+ else if (duplicate && !(o[key] === undefined ||
+ checkAllAliases(key, flags.counts) ||
+ checkAllAliases(key, flags.bools))) {
+ o[key] = [o[key], value];
+ }
+ else {
+ o[key] = value;
+ }
+ }
+ function extendAliases(...args) {
+ args.forEach(function (obj) {
+ Object.keys(obj || {}).forEach(function (key) {
+ if (flags.aliases[key])
+ return;
+ flags.aliases[key] = [].concat(aliases[key] || []);
+ flags.aliases[key].concat(key).forEach(function (x) {
+ if (/-/.test(x) && configuration['camel-case-expansion']) {
+ const c = camelCase(x);
+ if (c !== key && flags.aliases[key].indexOf(c) === -1) {
+ flags.aliases[key].push(c);
+ newAliases[c] = true;
+ }
+ }
+ });
+ flags.aliases[key].concat(key).forEach(function (x) {
+ if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) {
+ const c = decamelize(x, '-');
+ if (c !== key && flags.aliases[key].indexOf(c) === -1) {
+ flags.aliases[key].push(c);
+ newAliases[c] = true;
+ }
+ }
+ });
+ flags.aliases[key].forEach(function (x) {
+ flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {
+ return x !== y;
+ }));
+ });
+ });
+ });
+ }
+ function checkAllAliases(key, flag) {
+ const toCheck = [].concat(flags.aliases[key] || [], key);
+ const keys = Object.keys(flag);
+ const setAlias = toCheck.find(key => keys.includes(key));
+ return setAlias ? flag[setAlias] : false;
+ }
+ function hasAnyFlag(key) {
+ const flagsKeys = Object.keys(flags);
+ const toCheck = [].concat(flagsKeys.map(k => flags[k]));
+ return toCheck.some(function (flag) {
+ return Array.isArray(flag) ? flag.includes(key) : flag[key];
+ });
+ }
+ function hasFlagsMatching(arg, ...patterns) {
+ const toCheck = [].concat(...patterns);
+ return toCheck.some(function (pattern) {
+ const match = arg.match(pattern);
+ return match && hasAnyFlag(match[1]);
+ });
+ }
+ function hasAllShortFlags(arg) {
+ if (arg.match(negative) || !arg.match(/^-[^-]+/)) {
+ return false;
+ }
+ let hasAllFlags = true;
+ let next;
+ const letters = arg.slice(1).split('');
+ for (let j = 0; j < letters.length; j++) {
+ next = arg.slice(j + 2);
+ if (!hasAnyFlag(letters[j])) {
+ hasAllFlags = false;
+ break;
+ }
+ if ((letters[j + 1] && letters[j + 1] === '=') ||
+ next === '-' ||
+ (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) ||
+ (letters[j + 1] && letters[j + 1].match(/\W/))) {
+ break;
+ }
+ }
+ return hasAllFlags;
+ }
+ function isUnknownOptionAsArg(arg) {
+ return configuration['unknown-options-as-args'] && isUnknownOption(arg);
+ }
+ function isUnknownOption(arg) {
+ arg = arg.replace(/^-{3,}/, '--');
+ if (arg.match(negative)) {
+ return false;
+ }
+ if (hasAllShortFlags(arg)) {
+ return false;
+ }
+ const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/;
+ const normalFlag = /^-+([^=]+?)$/;
+ const flagEndingInHyphen = /^-+([^=]+?)-$/;
+ const flagEndingInDigits = /^-+([^=]+?\d+)$/;
+ const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/;
+ return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters);
+ }
+ function defaultValue(key) {
+ if (!checkAllAliases(key, flags.bools) &&
+ !checkAllAliases(key, flags.counts) &&
+ `${key}` in defaults) {
+ return defaults[key];
+ }
+ else {
+ return defaultForType(guessType(key));
+ }
+ }
+ function defaultForType(type) {
+ const def = {
+ [DefaultValuesForTypeKey.BOOLEAN]: true,
+ [DefaultValuesForTypeKey.STRING]: '',
+ [DefaultValuesForTypeKey.NUMBER]: undefined,
+ [DefaultValuesForTypeKey.ARRAY]: []
+ };
+ return def[type];
+ }
+ function guessType(key) {
+ let type = DefaultValuesForTypeKey.BOOLEAN;
+ if (checkAllAliases(key, flags.strings))
+ type = DefaultValuesForTypeKey.STRING;
+ else if (checkAllAliases(key, flags.numbers))
+ type = DefaultValuesForTypeKey.NUMBER;
+ else if (checkAllAliases(key, flags.bools))
+ type = DefaultValuesForTypeKey.BOOLEAN;
+ else if (checkAllAliases(key, flags.arrays))
+ type = DefaultValuesForTypeKey.ARRAY;
+ return type;
+ }
+ function isUndefined(num) {
+ return num === undefined;
+ }
+ function checkConfiguration() {
+ Object.keys(flags.counts).find(key => {
+ if (checkAllAliases(key, flags.arrays)) {
+ error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key));
+ return true;
+ }
+ else if (checkAllAliases(key, flags.nargs)) {
+ error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key));
+ return true;
+ }
+ return false;
+ });
+ }
+ return {
+ aliases: Object.assign({}, flags.aliases),
+ argv: Object.assign(argvReturn, argv),
+ configuration: configuration,
+ defaulted: Object.assign({}, defaulted),
+ error: error,
+ newAliases: Object.assign({}, newAliases)
+ };
+ }
+}
+function combineAliases(aliases) {
+ const aliasArrays = [];
+ const combined = Object.create(null);
+ let change = true;
+ Object.keys(aliases).forEach(function (key) {
+ aliasArrays.push([].concat(aliases[key], key));
+ });
+ while (change) {
+ change = false;
+ for (let i = 0; i < aliasArrays.length; i++) {
+ for (let ii = i + 1; ii < aliasArrays.length; ii++) {
+ const intersect = aliasArrays[i].filter(function (v) {
+ return aliasArrays[ii].indexOf(v) !== -1;
+ });
+ if (intersect.length) {
+ aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]);
+ aliasArrays.splice(ii, 1);
+ change = true;
+ break;
+ }
+ }
+ }
+ }
+ aliasArrays.forEach(function (aliasArray) {
+ aliasArray = aliasArray.filter(function (v, i, self) {
+ return self.indexOf(v) === i;
+ });
+ const lastAlias = aliasArray.pop();
+ if (lastAlias !== undefined && typeof lastAlias === 'string') {
+ combined[lastAlias] = aliasArray;
+ }
+ });
+ return combined;
+}
+function increment(orig) {
+ return orig !== undefined ? orig + 1 : 1;
+}
+function sanitizeKey(key) {
+ if (key === '__proto__')
+ return '___proto___';
+ return key;
+}
+
+const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
+ ? Number(process.env.YARGS_MIN_NODE_VERSION)
+ : 10;
+if (process && process.version) {
+ const major = Number(process.version.match(/v([^.]+)/)[1]);
+ if (major < minNodeVersion) {
+ throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
+ }
+}
+const env = process ? process.env : {};
+const parser = new YargsParser({
+ cwd: process.cwd,
+ env: () => {
+ return env;
+ },
+ format: util.format,
+ normalize: path.normalize,
+ resolve: path.resolve,
+ require: (path) => {
+ if (typeof require !== 'undefined') {
+ return require(path);
+ }
+ else if (path.match(/\.json$/)) {
+ return fs.readFileSync(path, 'utf8');
+ }
+ else {
+ throw Error('only .json config files are supported in ESM');
+ }
+ }
+});
+const yargsParser = function Parser(args, opts) {
+ const result = parser.parse(args.slice(), opts);
+ return result.argv;
+};
+yargsParser.detailed = function (args, opts) {
+ return parser.parse(args.slice(), opts);
+};
+yargsParser.camelCase = camelCase;
+yargsParser.decamelize = decamelize;
+yargsParser.looksLikeNumber = looksLikeNumber;
+
+module.exports = yargsParser;
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/index.js b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/index.js
new file mode 100644
index 0000000..cc50788
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/index.js
@@ -0,0 +1,59 @@
+/**
+ * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
+ * CJS and ESM environments.
+ *
+ * @license
+ * Copyright (c) 2016, Contributors
+ * SPDX-License-Identifier: ISC
+ */
+import { format } from 'util';
+import { readFileSync } from 'fs';
+import { normalize, resolve } from 'path';
+import { camelCase, decamelize, looksLikeNumber } from './string-utils.js';
+import { YargsParser } from './yargs-parser.js';
+// See https://github.com/yargs/yargs-parser#supported-nodejs-versions for our
+// version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.
+const minNodeVersion = (process && process.env && process.env.YARGS_MIN_NODE_VERSION)
+ ? Number(process.env.YARGS_MIN_NODE_VERSION)
+ : 10;
+if (process && process.version) {
+ const major = Number(process.version.match(/v([^.]+)/)[1]);
+ if (major < minNodeVersion) {
+ throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
+ }
+}
+// Creates a yargs-parser instance using Node.js standard libraries:
+const env = process ? process.env : {};
+const parser = new YargsParser({
+ cwd: process.cwd,
+ env: () => {
+ return env;
+ },
+ format,
+ normalize,
+ resolve,
+ // TODO: figure out a way to combine ESM and CJS coverage, such that
+ // we can exercise all the lines below:
+ require: (path) => {
+ if (typeof require !== 'undefined') {
+ return require(path);
+ }
+ else if (path.match(/\.json$/)) {
+ return readFileSync(path, 'utf8');
+ }
+ else {
+ throw Error('only .json config files are supported in ESM');
+ }
+ }
+});
+const yargsParser = function Parser(args, opts) {
+ const result = parser.parse(args.slice(), opts);
+ return result.argv;
+};
+yargsParser.detailed = function (args, opts) {
+ return parser.parse(args.slice(), opts);
+};
+yargsParser.camelCase = camelCase;
+yargsParser.decamelize = decamelize;
+yargsParser.looksLikeNumber = looksLikeNumber;
+export default yargsParser;
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/string-utils.js b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/string-utils.js
new file mode 100644
index 0000000..4e8bd99
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/string-utils.js
@@ -0,0 +1,65 @@
+/**
+ * @license
+ * Copyright (c) 2016, Contributors
+ * SPDX-License-Identifier: ISC
+ */
+export function camelCase(str) {
+ // Handle the case where an argument is provided as camel case, e.g., fooBar.
+ // by ensuring that the string isn't already mixed case:
+ const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
+ if (!isCamelCase) {
+ str = str.toLowerCase();
+ }
+ if (str.indexOf('-') === -1 && str.indexOf('_') === -1) {
+ return str;
+ }
+ else {
+ let camelcase = '';
+ let nextChrUpper = false;
+ const leadingHyphens = str.match(/^-+/);
+ for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
+ let chr = str.charAt(i);
+ if (nextChrUpper) {
+ nextChrUpper = false;
+ chr = chr.toUpperCase();
+ }
+ if (i !== 0 && (chr === '-' || chr === '_')) {
+ nextChrUpper = true;
+ }
+ else if (chr !== '-' && chr !== '_') {
+ camelcase += chr;
+ }
+ }
+ return camelcase;
+ }
+}
+export function decamelize(str, joinString) {
+ const lowercase = str.toLowerCase();
+ joinString = joinString || '-';
+ let notCamelcase = '';
+ for (let i = 0; i < str.length; i++) {
+ const chrLower = lowercase.charAt(i);
+ const chrString = str.charAt(i);
+ if (chrLower !== chrString && i > 0) {
+ notCamelcase += `${joinString}${lowercase.charAt(i)}`;
+ }
+ else {
+ notCamelcase += chrString;
+ }
+ }
+ return notCamelcase;
+}
+export function looksLikeNumber(x) {
+ if (x === null || x === undefined)
+ return false;
+ // if loaded from config, may already be a number.
+ if (typeof x === 'number')
+ return true;
+ // hexadecimal.
+ if (/^0x[0-9a-f]+$/i.test(x))
+ return true;
+ // don't treat 0123 as a number; as it drops the leading '0'.
+ if (/^0[^.]/.test(x))
+ return false;
+ return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
+}
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/tokenize-arg-string.js b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/tokenize-arg-string.js
new file mode 100644
index 0000000..5e732ef
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/tokenize-arg-string.js
@@ -0,0 +1,40 @@
+/**
+ * @license
+ * Copyright (c) 2016, Contributors
+ * SPDX-License-Identifier: ISC
+ */
+// take an un-split argv string and tokenize it.
+export function tokenizeArgString(argString) {
+ if (Array.isArray(argString)) {
+ return argString.map(e => typeof e !== 'string' ? e + '' : e);
+ }
+ argString = argString.trim();
+ let i = 0;
+ let prevC = null;
+ let c = null;
+ let opening = null;
+ const args = [];
+ for (let ii = 0; ii < argString.length; ii++) {
+ prevC = c;
+ c = argString.charAt(ii);
+ // split on spaces unless we're in quotes.
+ if (c === ' ' && !opening) {
+ if (!(prevC === ' ')) {
+ i++;
+ }
+ continue;
+ }
+ // don't split the string if we're in matching
+ // opening or closing single and double quotes.
+ if (c === opening) {
+ opening = null;
+ }
+ else if ((c === "'" || c === '"') && !opening) {
+ opening = c;
+ }
+ if (!args[i])
+ args[i] = '';
+ args[i] += c;
+ }
+ return args;
+}
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/yargs-parser-types.js b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/yargs-parser-types.js
new file mode 100644
index 0000000..63b7c31
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/yargs-parser-types.js
@@ -0,0 +1,12 @@
+/**
+ * @license
+ * Copyright (c) 2016, Contributors
+ * SPDX-License-Identifier: ISC
+ */
+export var DefaultValuesForTypeKey;
+(function (DefaultValuesForTypeKey) {
+ DefaultValuesForTypeKey["BOOLEAN"] = "boolean";
+ DefaultValuesForTypeKey["STRING"] = "string";
+ DefaultValuesForTypeKey["NUMBER"] = "number";
+ DefaultValuesForTypeKey["ARRAY"] = "array";
+})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/yargs-parser.js b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/yargs-parser.js
new file mode 100644
index 0000000..828a440
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/build/lib/yargs-parser.js
@@ -0,0 +1,1037 @@
+/**
+ * @license
+ * Copyright (c) 2016, Contributors
+ * SPDX-License-Identifier: ISC
+ */
+import { tokenizeArgString } from './tokenize-arg-string.js';
+import { DefaultValuesForTypeKey } from './yargs-parser-types.js';
+import { camelCase, decamelize, looksLikeNumber } from './string-utils.js';
+let mixin;
+export class YargsParser {
+ constructor(_mixin) {
+ mixin = _mixin;
+ }
+ parse(argsInput, options) {
+ const opts = Object.assign({
+ alias: undefined,
+ array: undefined,
+ boolean: undefined,
+ config: undefined,
+ configObjects: undefined,
+ configuration: undefined,
+ coerce: undefined,
+ count: undefined,
+ default: undefined,
+ envPrefix: undefined,
+ narg: undefined,
+ normalize: undefined,
+ string: undefined,
+ number: undefined,
+ __: undefined,
+ key: undefined
+ }, options);
+ // allow a string argument to be passed in rather
+ // than an argv array.
+ const args = tokenizeArgString(argsInput);
+ // aliases might have transitive relationships, normalize this.
+ const aliases = combineAliases(Object.assign(Object.create(null), opts.alias));
+ const configuration = Object.assign({
+ 'boolean-negation': true,
+ 'camel-case-expansion': true,
+ 'combine-arrays': false,
+ 'dot-notation': true,
+ 'duplicate-arguments-array': true,
+ 'flatten-duplicate-arrays': true,
+ 'greedy-arrays': true,
+ 'halt-at-non-option': false,
+ 'nargs-eats-options': false,
+ 'negation-prefix': 'no-',
+ 'parse-numbers': true,
+ 'parse-positional-numbers': true,
+ 'populate--': false,
+ 'set-placeholder-key': false,
+ 'short-option-groups': true,
+ 'strip-aliased': false,
+ 'strip-dashed': false,
+ 'unknown-options-as-args': false
+ }, opts.configuration);
+ const defaults = Object.assign(Object.create(null), opts.default);
+ const configObjects = opts.configObjects || [];
+ const envPrefix = opts.envPrefix;
+ const notFlagsOption = configuration['populate--'];
+ const notFlagsArgv = notFlagsOption ? '--' : '_';
+ const newAliases = Object.create(null);
+ const defaulted = Object.create(null);
+ // allow a i18n handler to be passed in, default to a fake one (util.format).
+ const __ = opts.__ || mixin.format;
+ const flags = {
+ aliases: Object.create(null),
+ arrays: Object.create(null),
+ bools: Object.create(null),
+ strings: Object.create(null),
+ numbers: Object.create(null),
+ counts: Object.create(null),
+ normalize: Object.create(null),
+ configs: Object.create(null),
+ nargs: Object.create(null),
+ coercions: Object.create(null),
+ keys: []
+ };
+ const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
+ const negatedBoolean = new RegExp('^--' + configuration['negation-prefix'] + '(.+)');
+ [].concat(opts.array || []).filter(Boolean).forEach(function (opt) {
+ const key = typeof opt === 'object' ? opt.key : opt;
+ // assign to flags[bools|strings|numbers]
+ const assignment = Object.keys(opt).map(function (key) {
+ const arrayFlagKeys = {
+ boolean: 'bools',
+ string: 'strings',
+ number: 'numbers'
+ };
+ return arrayFlagKeys[key];
+ }).filter(Boolean).pop();
+ // assign key to be coerced
+ if (assignment) {
+ flags[assignment][key] = true;
+ }
+ flags.arrays[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.boolean || []).filter(Boolean).forEach(function (key) {
+ flags.bools[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.string || []).filter(Boolean).forEach(function (key) {
+ flags.strings[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.number || []).filter(Boolean).forEach(function (key) {
+ flags.numbers[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.count || []).filter(Boolean).forEach(function (key) {
+ flags.counts[key] = true;
+ flags.keys.push(key);
+ });
+ [].concat(opts.normalize || []).filter(Boolean).forEach(function (key) {
+ flags.normalize[key] = true;
+ flags.keys.push(key);
+ });
+ if (typeof opts.narg === 'object') {
+ Object.entries(opts.narg).forEach(([key, value]) => {
+ if (typeof value === 'number') {
+ flags.nargs[key] = value;
+ flags.keys.push(key);
+ }
+ });
+ }
+ if (typeof opts.coerce === 'object') {
+ Object.entries(opts.coerce).forEach(([key, value]) => {
+ if (typeof value === 'function') {
+ flags.coercions[key] = value;
+ flags.keys.push(key);
+ }
+ });
+ }
+ if (typeof opts.config !== 'undefined') {
+ if (Array.isArray(opts.config) || typeof opts.config === 'string') {
+ ;
+ [].concat(opts.config).filter(Boolean).forEach(function (key) {
+ flags.configs[key] = true;
+ });
+ }
+ else if (typeof opts.config === 'object') {
+ Object.entries(opts.config).forEach(([key, value]) => {
+ if (typeof value === 'boolean' || typeof value === 'function') {
+ flags.configs[key] = value;
+ }
+ });
+ }
+ }
+ // create a lookup table that takes into account all
+ // combinations of aliases: {f: ['foo'], foo: ['f']}
+ extendAliases(opts.key, aliases, opts.default, flags.arrays);
+ // apply default values to all aliases.
+ Object.keys(defaults).forEach(function (key) {
+ (flags.aliases[key] || []).forEach(function (alias) {
+ defaults[alias] = defaults[key];
+ });
+ });
+ let error = null;
+ checkConfiguration();
+ let notFlags = [];
+ const argv = Object.assign(Object.create(null), { _: [] });
+ // TODO(bcoe): for the first pass at removing object prototype we didn't
+ // remove all prototypes from objects returned by this API, we might want
+ // to gradually move towards doing so.
+ const argvReturn = {};
+ for (let i = 0; i < args.length; i++) {
+ const arg = args[i];
+ const truncatedArg = arg.replace(/^-{3,}/, '---');
+ let broken;
+ let key;
+ let letters;
+ let m;
+ let next;
+ let value;
+ // any unknown option (except for end-of-options, "--")
+ if (arg !== '--' && isUnknownOptionAsArg(arg)) {
+ pushPositional(arg);
+ // ---, ---=, ----, etc,
+ }
+ else if (truncatedArg.match(/---+(=|$)/)) {
+ // options without key name are invalid.
+ pushPositional(arg);
+ continue;
+ // -- separated by =
+ }
+ else if (arg.match(/^--.+=/) || (!configuration['short-option-groups'] && arg.match(/^-.+=/))) {
+ // Using [\s\S] instead of . because js doesn't support the
+ // 'dotall' regex modifier. See:
+ // http://stackoverflow.com/a/1068308/13216
+ m = arg.match(/^--?([^=]+)=([\s\S]*)$/);
+ // arrays format = '--f=a b c'
+ if (m !== null && Array.isArray(m) && m.length >= 3) {
+ if (checkAllAliases(m[1], flags.arrays)) {
+ i = eatArray(i, m[1], args, m[2]);
+ }
+ else if (checkAllAliases(m[1], flags.nargs) !== false) {
+ // nargs format = '--f=monkey washing cat'
+ i = eatNargs(i, m[1], args, m[2]);
+ }
+ else {
+ setArg(m[1], m[2]);
+ }
+ }
+ }
+ else if (arg.match(negatedBoolean) && configuration['boolean-negation']) {
+ m = arg.match(negatedBoolean);
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
+ key = m[1];
+ setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false);
+ }
+ // -- separated by space.
+ }
+ else if (arg.match(/^--.+/) || (!configuration['short-option-groups'] && arg.match(/^-[^-]+/))) {
+ m = arg.match(/^--?(.+)/);
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
+ key = m[1];
+ if (checkAllAliases(key, flags.arrays)) {
+ // array format = '--foo a b c'
+ i = eatArray(i, key, args);
+ }
+ else if (checkAllAliases(key, flags.nargs) !== false) {
+ // nargs format = '--foo a b c'
+ // should be truthy even if: flags.nargs[key] === 0
+ i = eatNargs(i, key, args);
+ }
+ else {
+ next = args[i + 1];
+ if (next !== undefined && (!next.match(/^-/) ||
+ next.match(negative)) &&
+ !checkAllAliases(key, flags.bools) &&
+ !checkAllAliases(key, flags.counts)) {
+ setArg(key, next);
+ i++;
+ }
+ else if (/^(true|false)$/.test(next)) {
+ setArg(key, next);
+ i++;
+ }
+ else {
+ setArg(key, defaultValue(key));
+ }
+ }
+ }
+ // dot-notation flag separated by '='.
+ }
+ else if (arg.match(/^-.\..+=/)) {
+ m = arg.match(/^-([^=]+)=([\s\S]*)$/);
+ if (m !== null && Array.isArray(m) && m.length >= 3) {
+ setArg(m[1], m[2]);
+ }
+ // dot-notation flag separated by space.
+ }
+ else if (arg.match(/^-.\..+/) && !arg.match(negative)) {
+ next = args[i + 1];
+ m = arg.match(/^-(.\..+)/);
+ if (m !== null && Array.isArray(m) && m.length >= 2) {
+ key = m[1];
+ if (next !== undefined && !next.match(/^-/) &&
+ !checkAllAliases(key, flags.bools) &&
+ !checkAllAliases(key, flags.counts)) {
+ setArg(key, next);
+ i++;
+ }
+ else {
+ setArg(key, defaultValue(key));
+ }
+ }
+ }
+ else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
+ letters = arg.slice(1, -1).split('');
+ broken = false;
+ for (let j = 0; j < letters.length; j++) {
+ next = arg.slice(j + 2);
+ if (letters[j + 1] && letters[j + 1] === '=') {
+ value = arg.slice(j + 3);
+ key = letters[j];
+ if (checkAllAliases(key, flags.arrays)) {
+ // array format = '-f=a b c'
+ i = eatArray(i, key, args, value);
+ }
+ else if (checkAllAliases(key, flags.nargs) !== false) {
+ // nargs format = '-f=monkey washing cat'
+ i = eatNargs(i, key, args, value);
+ }
+ else {
+ setArg(key, value);
+ }
+ broken = true;
+ break;
+ }
+ if (next === '-') {
+ setArg(letters[j], next);
+ continue;
+ }
+ // current letter is an alphabetic character and next value is a number
+ if (/[A-Za-z]/.test(letters[j]) &&
+ /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) &&
+ checkAllAliases(next, flags.bools) === false) {
+ setArg(letters[j], next);
+ broken = true;
+ break;
+ }
+ if (letters[j + 1] && letters[j + 1].match(/\W/)) {
+ setArg(letters[j], next);
+ broken = true;
+ break;
+ }
+ else {
+ setArg(letters[j], defaultValue(letters[j]));
+ }
+ }
+ key = arg.slice(-1)[0];
+ if (!broken && key !== '-') {
+ if (checkAllAliases(key, flags.arrays)) {
+ // array format = '-f a b c'
+ i = eatArray(i, key, args);
+ }
+ else if (checkAllAliases(key, flags.nargs) !== false) {
+ // nargs format = '-f a b c'
+ // should be truthy even if: flags.nargs[key] === 0
+ i = eatNargs(i, key, args);
+ }
+ else {
+ next = args[i + 1];
+ if (next !== undefined && (!/^(-|--)[^-]/.test(next) ||
+ next.match(negative)) &&
+ !checkAllAliases(key, flags.bools) &&
+ !checkAllAliases(key, flags.counts)) {
+ setArg(key, next);
+ i++;
+ }
+ else if (/^(true|false)$/.test(next)) {
+ setArg(key, next);
+ i++;
+ }
+ else {
+ setArg(key, defaultValue(key));
+ }
+ }
+ }
+ }
+ else if (arg.match(/^-[0-9]$/) &&
+ arg.match(negative) &&
+ checkAllAliases(arg.slice(1), flags.bools)) {
+ // single-digit boolean alias, e.g: xargs -0
+ key = arg.slice(1);
+ setArg(key, defaultValue(key));
+ }
+ else if (arg === '--') {
+ notFlags = args.slice(i + 1);
+ break;
+ }
+ else if (configuration['halt-at-non-option']) {
+ notFlags = args.slice(i);
+ break;
+ }
+ else {
+ pushPositional(arg);
+ }
+ }
+ // order of precedence:
+ // 1. command line arg
+ // 2. value from env var
+ // 3. value from config file
+ // 4. value from config objects
+ // 5. configured default value
+ applyEnvVars(argv, true); // special case: check env vars that point to config file
+ applyEnvVars(argv, false);
+ setConfig(argv);
+ setConfigObjects();
+ applyDefaultsAndAliases(argv, flags.aliases, defaults, true);
+ applyCoercions(argv);
+ if (configuration['set-placeholder-key'])
+ setPlaceholderKeys(argv);
+ // for any counts either not in args or without an explicit default, set to 0
+ Object.keys(flags.counts).forEach(function (key) {
+ if (!hasKey(argv, key.split('.')))
+ setArg(key, 0);
+ });
+ // '--' defaults to undefined.
+ if (notFlagsOption && notFlags.length)
+ argv[notFlagsArgv] = [];
+ notFlags.forEach(function (key) {
+ argv[notFlagsArgv].push(key);
+ });
+ if (configuration['camel-case-expansion'] && configuration['strip-dashed']) {
+ Object.keys(argv).filter(key => key !== '--' && key.includes('-')).forEach(key => {
+ delete argv[key];
+ });
+ }
+ if (configuration['strip-aliased']) {
+ ;
+ [].concat(...Object.keys(aliases).map(k => aliases[k])).forEach(alias => {
+ if (configuration['camel-case-expansion'] && alias.includes('-')) {
+ delete argv[alias.split('.').map(prop => camelCase(prop)).join('.')];
+ }
+ delete argv[alias];
+ });
+ }
+ // Push argument into positional array, applying numeric coercion:
+ function pushPositional(arg) {
+ const maybeCoercedNumber = maybeCoerceNumber('_', arg);
+ if (typeof maybeCoercedNumber === 'string' || typeof maybeCoercedNumber === 'number') {
+ argv._.push(maybeCoercedNumber);
+ }
+ }
+ // how many arguments should we consume, based
+ // on the nargs option?
+ function eatNargs(i, key, args, argAfterEqualSign) {
+ let ii;
+ let toEat = checkAllAliases(key, flags.nargs);
+ // NaN has a special meaning for the array type, indicating that one or
+ // more values are expected.
+ toEat = typeof toEat !== 'number' || isNaN(toEat) ? 1 : toEat;
+ if (toEat === 0) {
+ if (!isUndefined(argAfterEqualSign)) {
+ error = Error(__('Argument unexpected for: %s', key));
+ }
+ setArg(key, defaultValue(key));
+ return i;
+ }
+ let available = isUndefined(argAfterEqualSign) ? 0 : 1;
+ if (configuration['nargs-eats-options']) {
+ // classic behavior, yargs eats positional and dash arguments.
+ if (args.length - (i + 1) + available < toEat) {
+ error = Error(__('Not enough arguments following: %s', key));
+ }
+ available = toEat;
+ }
+ else {
+ // nargs will not consume flag arguments, e.g., -abc, --foo,
+ // and terminates when one is observed.
+ for (ii = i + 1; ii < args.length; ii++) {
+ if (!args[ii].match(/^-[^0-9]/) || args[ii].match(negative) || isUnknownOptionAsArg(args[ii]))
+ available++;
+ else
+ break;
+ }
+ if (available < toEat)
+ error = Error(__('Not enough arguments following: %s', key));
+ }
+ let consumed = Math.min(available, toEat);
+ if (!isUndefined(argAfterEqualSign) && consumed > 0) {
+ setArg(key, argAfterEqualSign);
+ consumed--;
+ }
+ for (ii = i + 1; ii < (consumed + i + 1); ii++) {
+ setArg(key, args[ii]);
+ }
+ return (i + consumed);
+ }
+ // if an option is an array, eat all non-hyphenated arguments
+ // following it... YUM!
+ // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
+ function eatArray(i, key, args, argAfterEqualSign) {
+ let argsToSet = [];
+ let next = argAfterEqualSign || args[i + 1];
+ // If both array and nargs are configured, enforce the nargs count:
+ const nargsCount = checkAllAliases(key, flags.nargs);
+ if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) {
+ argsToSet.push(true);
+ }
+ else if (isUndefined(next) ||
+ (isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))) {
+ // for keys without value ==> argsToSet remains an empty []
+ // set user default value, if available
+ if (defaults[key] !== undefined) {
+ const defVal = defaults[key];
+ argsToSet = Array.isArray(defVal) ? defVal : [defVal];
+ }
+ }
+ else {
+ // value in --option=value is eaten as is
+ if (!isUndefined(argAfterEqualSign)) {
+ argsToSet.push(processValue(key, argAfterEqualSign));
+ }
+ for (let ii = i + 1; ii < args.length; ii++) {
+ if ((!configuration['greedy-arrays'] && argsToSet.length > 0) ||
+ (nargsCount && typeof nargsCount === 'number' && argsToSet.length >= nargsCount))
+ break;
+ next = args[ii];
+ if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))
+ break;
+ i = ii;
+ argsToSet.push(processValue(key, next));
+ }
+ }
+ // If both array and nargs are configured, create an error if less than
+ // nargs positionals were found. NaN has special meaning, indicating
+ // that at least one value is required (more are okay).
+ if (typeof nargsCount === 'number' && ((nargsCount && argsToSet.length < nargsCount) ||
+ (isNaN(nargsCount) && argsToSet.length === 0))) {
+ error = Error(__('Not enough arguments following: %s', key));
+ }
+ setArg(key, argsToSet);
+ return i;
+ }
+ function setArg(key, val) {
+ if (/-/.test(key) && configuration['camel-case-expansion']) {
+ const alias = key.split('.').map(function (prop) {
+ return camelCase(prop);
+ }).join('.');
+ addNewAlias(key, alias);
+ }
+ const value = processValue(key, val);
+ const splitKey = key.split('.');
+ setKey(argv, splitKey, value);
+ // handle populating aliases of the full key
+ if (flags.aliases[key]) {
+ flags.aliases[key].forEach(function (x) {
+ const keyProperties = x.split('.');
+ setKey(argv, keyProperties, value);
+ });
+ }
+ // handle populating aliases of the first element of the dot-notation key
+ if (splitKey.length > 1 && configuration['dot-notation']) {
+ ;
+ (flags.aliases[splitKey[0]] || []).forEach(function (x) {
+ let keyProperties = x.split('.');
+ // expand alias with nested objects in key
+ const a = [].concat(splitKey);
+ a.shift(); // nuke the old key.
+ keyProperties = keyProperties.concat(a);
+ // populate alias only if is not already an alias of the full key
+ // (already populated above)
+ if (!(flags.aliases[key] || []).includes(keyProperties.join('.'))) {
+ setKey(argv, keyProperties, value);
+ }
+ });
+ }
+ // Set normalize getter and setter when key is in 'normalize' but isn't an array
+ if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) {
+ const keys = [key].concat(flags.aliases[key] || []);
+ keys.forEach(function (key) {
+ Object.defineProperty(argvReturn, key, {
+ enumerable: true,
+ get() {
+ return val;
+ },
+ set(value) {
+ val = typeof value === 'string' ? mixin.normalize(value) : value;
+ }
+ });
+ });
+ }
+ }
+ function addNewAlias(key, alias) {
+ if (!(flags.aliases[key] && flags.aliases[key].length)) {
+ flags.aliases[key] = [alias];
+ newAliases[alias] = true;
+ }
+ if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
+ addNewAlias(alias, key);
+ }
+ }
+ function processValue(key, val) {
+ // strings may be quoted, clean this up as we assign values.
+ if (typeof val === 'string' &&
+ (val[0] === "'" || val[0] === '"') &&
+ val[val.length - 1] === val[0]) {
+ val = val.substring(1, val.length - 1);
+ }
+ // handle parsing boolean arguments --foo=true --bar false.
+ if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
+ if (typeof val === 'string')
+ val = val === 'true';
+ }
+ let value = Array.isArray(val)
+ ? val.map(function (v) { return maybeCoerceNumber(key, v); })
+ : maybeCoerceNumber(key, val);
+ // increment a count given as arg (either no value or value parsed as boolean)
+ if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) {
+ value = increment();
+ }
+ // Set normalized value when key is in 'normalize' and in 'arrays'
+ if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
+ if (Array.isArray(val))
+ value = val.map((val) => { return mixin.normalize(val); });
+ else
+ value = mixin.normalize(val);
+ }
+ return value;
+ }
+ function maybeCoerceNumber(key, value) {
+ if (!configuration['parse-positional-numbers'] && key === '_')
+ return value;
+ if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) {
+ const shouldCoerceNumber = looksLikeNumber(value) && configuration['parse-numbers'] && (Number.isSafeInteger(Math.floor(parseFloat(`${value}`))));
+ if (shouldCoerceNumber || (!isUndefined(value) && checkAllAliases(key, flags.numbers))) {
+ value = Number(value);
+ }
+ }
+ return value;
+ }
+ // set args from config.json file, this should be
+ // applied last so that defaults can be applied.
+ function setConfig(argv) {
+ const configLookup = Object.create(null);
+ // expand defaults/aliases, in-case any happen to reference
+ // the config.json file.
+ applyDefaultsAndAliases(configLookup, flags.aliases, defaults);
+ Object.keys(flags.configs).forEach(function (configKey) {
+ const configPath = argv[configKey] || configLookup[configKey];
+ if (configPath) {
+ try {
+ let config = null;
+ const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath);
+ const resolveConfig = flags.configs[configKey];
+ if (typeof resolveConfig === 'function') {
+ try {
+ config = resolveConfig(resolvedConfigPath);
+ }
+ catch (e) {
+ config = e;
+ }
+ if (config instanceof Error) {
+ error = config;
+ return;
+ }
+ }
+ else {
+ config = mixin.require(resolvedConfigPath);
+ }
+ setConfigObject(config);
+ }
+ catch (ex) {
+ // Deno will receive a PermissionDenied error if an attempt is
+ // made to load config without the --allow-read flag:
+ if (ex.name === 'PermissionDenied')
+ error = ex;
+ else if (argv[configKey])
+ error = Error(__('Invalid JSON config file: %s', configPath));
+ }
+ }
+ });
+ }
+ // set args from config object.
+ // it recursively checks nested objects.
+ function setConfigObject(config, prev) {
+ Object.keys(config).forEach(function (key) {
+ const value = config[key];
+ const fullKey = prev ? prev + '.' + key : key;
+ // if the value is an inner object and we have dot-notation
+ // enabled, treat inner objects in config the same as
+ // heavily nested dot notations (foo.bar.apple).
+ if (typeof value === 'object' && value !== null && !Array.isArray(value) && configuration['dot-notation']) {
+ // if the value is an object but not an array, check nested object
+ setConfigObject(value, fullKey);
+ }
+ else {
+ // setting arguments via CLI takes precedence over
+ // values within the config file.
+ if (!hasKey(argv, fullKey.split('.')) || (checkAllAliases(fullKey, flags.arrays) && configuration['combine-arrays'])) {
+ setArg(fullKey, value);
+ }
+ }
+ });
+ }
+ // set all config objects passed in opts
+ function setConfigObjects() {
+ if (typeof configObjects !== 'undefined') {
+ configObjects.forEach(function (configObject) {
+ setConfigObject(configObject);
+ });
+ }
+ }
+ function applyEnvVars(argv, configOnly) {
+ if (typeof envPrefix === 'undefined')
+ return;
+ const prefix = typeof envPrefix === 'string' ? envPrefix : '';
+ const env = mixin.env();
+ Object.keys(env).forEach(function (envVar) {
+ if (prefix === '' || envVar.lastIndexOf(prefix, 0) === 0) {
+ // get array of nested keys and convert them to camel case
+ const keys = envVar.split('__').map(function (key, i) {
+ if (i === 0) {
+ key = key.substring(prefix.length);
+ }
+ return camelCase(key);
+ });
+ if (((configOnly && flags.configs[keys.join('.')]) || !configOnly) && !hasKey(argv, keys)) {
+ setArg(keys.join('.'), env[envVar]);
+ }
+ }
+ });
+ }
+ function applyCoercions(argv) {
+ let coerce;
+ const applied = new Set();
+ Object.keys(argv).forEach(function (key) {
+ if (!applied.has(key)) { // If we haven't already coerced this option via one of its aliases
+ coerce = checkAllAliases(key, flags.coercions);
+ if (typeof coerce === 'function') {
+ try {
+ const value = maybeCoerceNumber(key, coerce(argv[key]));
+ ([].concat(flags.aliases[key] || [], key)).forEach(ali => {
+ applied.add(ali);
+ argv[ali] = value;
+ });
+ }
+ catch (err) {
+ error = err;
+ }
+ }
+ }
+ });
+ }
+ function setPlaceholderKeys(argv) {
+ flags.keys.forEach((key) => {
+ // don't set placeholder keys for dot notation options 'foo.bar'.
+ if (~key.indexOf('.'))
+ return;
+ if (typeof argv[key] === 'undefined')
+ argv[key] = undefined;
+ });
+ return argv;
+ }
+ function applyDefaultsAndAliases(obj, aliases, defaults, canLog = false) {
+ Object.keys(defaults).forEach(function (key) {
+ if (!hasKey(obj, key.split('.'))) {
+ setKey(obj, key.split('.'), defaults[key]);
+ if (canLog)
+ defaulted[key] = true;
+ (aliases[key] || []).forEach(function (x) {
+ if (hasKey(obj, x.split('.')))
+ return;
+ setKey(obj, x.split('.'), defaults[key]);
+ });
+ }
+ });
+ }
+ function hasKey(obj, keys) {
+ let o = obj;
+ if (!configuration['dot-notation'])
+ keys = [keys.join('.')];
+ keys.slice(0, -1).forEach(function (key) {
+ o = (o[key] || {});
+ });
+ const key = keys[keys.length - 1];
+ if (typeof o !== 'object')
+ return false;
+ else
+ return key in o;
+ }
+ function setKey(obj, keys, value) {
+ let o = obj;
+ if (!configuration['dot-notation'])
+ keys = [keys.join('.')];
+ keys.slice(0, -1).forEach(function (key) {
+ // TODO(bcoe): in the next major version of yargs, switch to
+ // Object.create(null) for dot notation:
+ key = sanitizeKey(key);
+ if (typeof o === 'object' && o[key] === undefined) {
+ o[key] = {};
+ }
+ if (typeof o[key] !== 'object' || Array.isArray(o[key])) {
+ // ensure that o[key] is an array, and that the last item is an empty object.
+ if (Array.isArray(o[key])) {
+ o[key].push({});
+ }
+ else {
+ o[key] = [o[key], {}];
+ }
+ // we want to update the empty object at the end of the o[key] array, so set o to that object
+ o = o[key][o[key].length - 1];
+ }
+ else {
+ o = o[key];
+ }
+ });
+ // TODO(bcoe): in the next major version of yargs, switch to
+ // Object.create(null) for dot notation:
+ const key = sanitizeKey(keys[keys.length - 1]);
+ const isTypeArray = checkAllAliases(keys.join('.'), flags.arrays);
+ const isValueArray = Array.isArray(value);
+ let duplicate = configuration['duplicate-arguments-array'];
+ // nargs has higher priority than duplicate
+ if (!duplicate && checkAllAliases(key, flags.nargs)) {
+ duplicate = true;
+ if ((!isUndefined(o[key]) && flags.nargs[key] === 1) || (Array.isArray(o[key]) && o[key].length === flags.nargs[key])) {
+ o[key] = undefined;
+ }
+ }
+ if (value === increment()) {
+ o[key] = increment(o[key]);
+ }
+ else if (Array.isArray(o[key])) {
+ if (duplicate && isTypeArray && isValueArray) {
+ o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]);
+ }
+ else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
+ o[key] = value;
+ }
+ else {
+ o[key] = o[key].concat([value]);
+ }
+ }
+ else if (o[key] === undefined && isTypeArray) {
+ o[key] = isValueArray ? value : [value];
+ }
+ else if (duplicate && !(o[key] === undefined ||
+ checkAllAliases(key, flags.counts) ||
+ checkAllAliases(key, flags.bools))) {
+ o[key] = [o[key], value];
+ }
+ else {
+ o[key] = value;
+ }
+ }
+ // extend the aliases list with inferred aliases.
+ function extendAliases(...args) {
+ args.forEach(function (obj) {
+ Object.keys(obj || {}).forEach(function (key) {
+ // short-circuit if we've already added a key
+ // to the aliases array, for example it might
+ // exist in both 'opts.default' and 'opts.key'.
+ if (flags.aliases[key])
+ return;
+ flags.aliases[key] = [].concat(aliases[key] || []);
+ // For "--option-name", also set argv.optionName
+ flags.aliases[key].concat(key).forEach(function (x) {
+ if (/-/.test(x) && configuration['camel-case-expansion']) {
+ const c = camelCase(x);
+ if (c !== key && flags.aliases[key].indexOf(c) === -1) {
+ flags.aliases[key].push(c);
+ newAliases[c] = true;
+ }
+ }
+ });
+ // For "--optionName", also set argv['option-name']
+ flags.aliases[key].concat(key).forEach(function (x) {
+ if (x.length > 1 && /[A-Z]/.test(x) && configuration['camel-case-expansion']) {
+ const c = decamelize(x, '-');
+ if (c !== key && flags.aliases[key].indexOf(c) === -1) {
+ flags.aliases[key].push(c);
+ newAliases[c] = true;
+ }
+ }
+ });
+ flags.aliases[key].forEach(function (x) {
+ flags.aliases[x] = [key].concat(flags.aliases[key].filter(function (y) {
+ return x !== y;
+ }));
+ });
+ });
+ });
+ }
+ function checkAllAliases(key, flag) {
+ const toCheck = [].concat(flags.aliases[key] || [], key);
+ const keys = Object.keys(flag);
+ const setAlias = toCheck.find(key => keys.includes(key));
+ return setAlias ? flag[setAlias] : false;
+ }
+ function hasAnyFlag(key) {
+ const flagsKeys = Object.keys(flags);
+ const toCheck = [].concat(flagsKeys.map(k => flags[k]));
+ return toCheck.some(function (flag) {
+ return Array.isArray(flag) ? flag.includes(key) : flag[key];
+ });
+ }
+ function hasFlagsMatching(arg, ...patterns) {
+ const toCheck = [].concat(...patterns);
+ return toCheck.some(function (pattern) {
+ const match = arg.match(pattern);
+ return match && hasAnyFlag(match[1]);
+ });
+ }
+ // based on a simplified version of the short flag group parsing logic
+ function hasAllShortFlags(arg) {
+ // if this is a negative number, or doesn't start with a single hyphen, it's not a short flag group
+ if (arg.match(negative) || !arg.match(/^-[^-]+/)) {
+ return false;
+ }
+ let hasAllFlags = true;
+ let next;
+ const letters = arg.slice(1).split('');
+ for (let j = 0; j < letters.length; j++) {
+ next = arg.slice(j + 2);
+ if (!hasAnyFlag(letters[j])) {
+ hasAllFlags = false;
+ break;
+ }
+ if ((letters[j + 1] && letters[j + 1] === '=') ||
+ next === '-' ||
+ (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) ||
+ (letters[j + 1] && letters[j + 1].match(/\W/))) {
+ break;
+ }
+ }
+ return hasAllFlags;
+ }
+ function isUnknownOptionAsArg(arg) {
+ return configuration['unknown-options-as-args'] && isUnknownOption(arg);
+ }
+ function isUnknownOption(arg) {
+ arg = arg.replace(/^-{3,}/, '--');
+ // ignore negative numbers
+ if (arg.match(negative)) {
+ return false;
+ }
+ // if this is a short option group and all of them are configured, it isn't unknown
+ if (hasAllShortFlags(arg)) {
+ return false;
+ }
+ // e.g. '--count=2'
+ const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/;
+ // e.g. '-a' or '--arg'
+ const normalFlag = /^-+([^=]+?)$/;
+ // e.g. '-a-'
+ const flagEndingInHyphen = /^-+([^=]+?)-$/;
+ // e.g. '-abc123'
+ const flagEndingInDigits = /^-+([^=]+?\d+)$/;
+ // e.g. '-a/usr/local'
+ const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/;
+ // check the different types of flag styles, including negatedBoolean, a pattern defined near the start of the parse method
+ return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters);
+ }
+ // make a best effort to pick a default value
+ // for an option based on name and type.
+ function defaultValue(key) {
+ if (!checkAllAliases(key, flags.bools) &&
+ !checkAllAliases(key, flags.counts) &&
+ `${key}` in defaults) {
+ return defaults[key];
+ }
+ else {
+ return defaultForType(guessType(key));
+ }
+ }
+ // return a default value, given the type of a flag.,
+ function defaultForType(type) {
+ const def = {
+ [DefaultValuesForTypeKey.BOOLEAN]: true,
+ [DefaultValuesForTypeKey.STRING]: '',
+ [DefaultValuesForTypeKey.NUMBER]: undefined,
+ [DefaultValuesForTypeKey.ARRAY]: []
+ };
+ return def[type];
+ }
+ // given a flag, enforce a default type.
+ function guessType(key) {
+ let type = DefaultValuesForTypeKey.BOOLEAN;
+ if (checkAllAliases(key, flags.strings))
+ type = DefaultValuesForTypeKey.STRING;
+ else if (checkAllAliases(key, flags.numbers))
+ type = DefaultValuesForTypeKey.NUMBER;
+ else if (checkAllAliases(key, flags.bools))
+ type = DefaultValuesForTypeKey.BOOLEAN;
+ else if (checkAllAliases(key, flags.arrays))
+ type = DefaultValuesForTypeKey.ARRAY;
+ return type;
+ }
+ function isUndefined(num) {
+ return num === undefined;
+ }
+ // check user configuration settings for inconsistencies
+ function checkConfiguration() {
+ // count keys should not be set as array/narg
+ Object.keys(flags.counts).find(key => {
+ if (checkAllAliases(key, flags.arrays)) {
+ error = Error(__('Invalid configuration: %s, opts.count excludes opts.array.', key));
+ return true;
+ }
+ else if (checkAllAliases(key, flags.nargs)) {
+ error = Error(__('Invalid configuration: %s, opts.count excludes opts.narg.', key));
+ return true;
+ }
+ return false;
+ });
+ }
+ return {
+ aliases: Object.assign({}, flags.aliases),
+ argv: Object.assign(argvReturn, argv),
+ configuration: configuration,
+ defaulted: Object.assign({}, defaulted),
+ error: error,
+ newAliases: Object.assign({}, newAliases)
+ };
+ }
+}
+// if any aliases reference each other, we should
+// merge them together.
+function combineAliases(aliases) {
+ const aliasArrays = [];
+ const combined = Object.create(null);
+ let change = true;
+ // turn alias lookup hash {key: ['alias1', 'alias2']} into
+ // a simple array ['key', 'alias1', 'alias2']
+ Object.keys(aliases).forEach(function (key) {
+ aliasArrays.push([].concat(aliases[key], key));
+ });
+ // combine arrays until zero changes are
+ // made in an iteration.
+ while (change) {
+ change = false;
+ for (let i = 0; i < aliasArrays.length; i++) {
+ for (let ii = i + 1; ii < aliasArrays.length; ii++) {
+ const intersect = aliasArrays[i].filter(function (v) {
+ return aliasArrays[ii].indexOf(v) !== -1;
+ });
+ if (intersect.length) {
+ aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]);
+ aliasArrays.splice(ii, 1);
+ change = true;
+ break;
+ }
+ }
+ }
+ }
+ // map arrays back to the hash-lookup (de-dupe while
+ // we're at it).
+ aliasArrays.forEach(function (aliasArray) {
+ aliasArray = aliasArray.filter(function (v, i, self) {
+ return self.indexOf(v) === i;
+ });
+ const lastAlias = aliasArray.pop();
+ if (lastAlias !== undefined && typeof lastAlias === 'string') {
+ combined[lastAlias] = aliasArray;
+ }
+ });
+ return combined;
+}
+// this function should only be called when a count is given as an arg
+// it is NOT called to set a default value
+// thus we can start the count at 1 instead of 0
+function increment(orig) {
+ return orig !== undefined ? orig + 1 : 1;
+}
+// TODO(bcoe): in the next major version of yargs, switch to
+// Object.create(null) for dot notation:
+function sanitizeKey(key) {
+ if (key === '__proto__')
+ return '___proto___';
+ return key;
+}
diff --git a/projects/arabica/src/sprint2/node_modules/yargs-parser/package.json b/projects/arabica/src/sprint2/node_modules/yargs-parser/package.json
new file mode 100644
index 0000000..f97aa9e
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs-parser/package.json
@@ -0,0 +1,87 @@
+{
+ "name": "yargs-parser",
+ "version": "20.2.9",
+ "description": "the mighty option parser used by yargs",
+ "main": "build/index.cjs",
+ "exports": {
+ ".": [
+ {
+ "import": "./build/lib/index.js",
+ "require": "./build/index.cjs"
+ },
+ "./build/index.cjs"
+ ]
+ },
+ "type": "module",
+ "module": "./build/lib/index.js",
+ "scripts": {
+ "check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
+ "fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
+ "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
+ "test": "c8 --reporter=text --reporter=html mocha test/*.cjs",
+ "test:browser": "start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'",
+ "pretest:typescript": "npm run pretest",
+ "test:typescript": "c8 mocha ./build/test/typescript/*.js",
+ "coverage": "c8 report --check-coverage",
+ "precompile": "rimraf build",
+ "compile": "tsc",
+ "postcompile": "npm run build:cjs",
+ "build:cjs": "rollup -c",
+ "prepare": "npm run compile"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/yargs/yargs-parser.git"
+ },
+ "keywords": [
+ "argument",
+ "parser",
+ "yargs",
+ "command",
+ "cli",
+ "parsing",
+ "option",
+ "args",
+ "argument"
+ ],
+ "author": "Ben Coe ",
+ "license": "ISC",
+ "devDependencies": {
+ "@types/chai": "^4.2.11",
+ "@types/mocha": "^8.0.0",
+ "@types/node": "^14.0.0",
+ "@typescript-eslint/eslint-plugin": "^3.10.1",
+ "@typescript-eslint/parser": "^3.10.1",
+ "@wessberg/rollup-plugin-ts": "^1.2.28",
+ "c8": "^7.3.0",
+ "chai": "^4.2.0",
+ "cross-env": "^7.0.2",
+ "eslint": "^7.0.0",
+ "eslint-plugin-import": "^2.20.1",
+ "eslint-plugin-node": "^11.0.0",
+ "gts": "^3.0.0",
+ "mocha": "^9.0.0",
+ "puppeteer": "^10.0.0",
+ "rimraf": "^3.0.2",
+ "rollup": "^2.22.1",
+ "rollup-plugin-cleanup": "^3.1.1",
+ "serve": "^12.0.0",
+ "standardx": "^7.0.0",
+ "start-server-and-test": "^1.11.2",
+ "ts-transform-default-export": "^1.0.2",
+ "typescript": "^4.0.0"
+ },
+ "files": [
+ "browser.js",
+ "build",
+ "!*.d.ts"
+ ],
+ "engines": {
+ "node": ">=10"
+ },
+ "standardx": {
+ "ignore": [
+ "build"
+ ]
+ }
+}
diff --git a/projects/arabica/src/sprint2/node_modules/yargs/CHANGELOG.md b/projects/arabica/src/sprint2/node_modules/yargs/CHANGELOG.md
new file mode 100644
index 0000000..ebc3b22
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs/CHANGELOG.md
@@ -0,0 +1,88 @@
+# Changelog
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+## [16.2.0](https://www.github.com/yargs/yargs/compare/v16.1.1...v16.2.0) (2020-12-05)
+
+
+### Features
+
+* command() now accepts an array of modules ([f415388](https://www.github.com/yargs/yargs/commit/f415388cc454d02786c65c50dd6c7a0cf9d8b842))
+
+
+### Bug Fixes
+
+* add package.json to module exports ([#1818](https://www.github.com/yargs/yargs/issues/1818)) ([d783a49](https://www.github.com/yargs/yargs/commit/d783a49a7f21c9bbd4eec2990268f3244c4d5662)), closes [#1817](https://www.github.com/yargs/yargs/issues/1817)
+
+### [16.1.1](https://www.github.com/yargs/yargs/compare/v16.1.0...v16.1.1) (2020-11-15)
+
+
+### Bug Fixes
+
+* expose helpers for legacy versions of Node.js ([#1801](https://www.github.com/yargs/yargs/issues/1801)) ([107deaa](https://www.github.com/yargs/yargs/commit/107deaa4f68b7bc3f2386041e1f4fe0272b29c0a))
+* **deno:** get yargs working on deno@1.5.x ([#1799](https://www.github.com/yargs/yargs/issues/1799)) ([cb01c98](https://www.github.com/yargs/yargs/commit/cb01c98c44e30f55c2dc9434caef524ae433d9a4))
+
+## [16.1.0](https://www.github.com/yargs/yargs/compare/v16.0.3...v16.1.0) (2020-10-15)
+
+
+### Features
+
+* expose hideBin helper for CJS ([#1768](https://www.github.com/yargs/yargs/issues/1768)) ([63e1173](https://www.github.com/yargs/yargs/commit/63e1173bb47dc651c151973a16ef659082a9ae66))
+
+
+### Bug Fixes
+
+* **deno:** update types for deno ^1.4.0 ([#1772](https://www.github.com/yargs/yargs/issues/1772)) ([0801752](https://www.github.com/yargs/yargs/commit/080175207d281be63edf90adfe4f0568700b0bf5))
+* **exports:** node 13.0-13.6 require a string fallback ([#1776](https://www.github.com/yargs/yargs/issues/1776)) ([b45c43a](https://www.github.com/yargs/yargs/commit/b45c43a5f64b565c3794f9792150eaeec4e00b69))
+* **modules:** module path was incorrect ([#1759](https://www.github.com/yargs/yargs/issues/1759)) ([95a4a0a](https://www.github.com/yargs/yargs/commit/95a4a0ac573cfe158e6e4bc8c8682ebd1644a198))
+* **positional:** positional strings no longer drop decimals ([#1761](https://www.github.com/yargs/yargs/issues/1761)) ([e1a300f](https://www.github.com/yargs/yargs/commit/e1a300f1293ad821c900284616337f080b207980))
+* make positionals in -- count towards validation ([#1752](https://www.github.com/yargs/yargs/issues/1752)) ([eb2b29d](https://www.github.com/yargs/yargs/commit/eb2b29d34f1a41e0fd6c4e841960e5bfc329dc3c))
+
+### [16.0.3](https://www.github.com/yargs/yargs/compare/v16.0.2...v16.0.3) (2020-09-10)
+
+
+### Bug Fixes
+
+* move yargs.cjs to yargs to fix Node 10 imports ([#1747](https://www.github.com/yargs/yargs/issues/1747)) ([5bfb85b](https://www.github.com/yargs/yargs/commit/5bfb85b33b85db8a44b5f7a700a8e4dbaf022df0))
+
+### [16.0.2](https://www.github.com/yargs/yargs/compare/v16.0.1...v16.0.2) (2020-09-09)
+
+
+### Bug Fixes
+
+* **typescript:** yargs-parser was breaking @types/yargs ([#1745](https://www.github.com/yargs/yargs/issues/1745)) ([2253284](https://www.github.com/yargs/yargs/commit/2253284b233cceabd8db677b81c5bf1755eef230))
+
+### [16.0.1](https://www.github.com/yargs/yargs/compare/v16.0.0...v16.0.1) (2020-09-09)
+
+
+### Bug Fixes
+
+* code was not passed to process.exit ([#1742](https://www.github.com/yargs/yargs/issues/1742)) ([d1a9930](https://www.github.com/yargs/yargs/commit/d1a993035a2f76c138460052cf19425f9684b637))
+
+## [16.0.0](https://www.github.com/yargs/yargs/compare/v15.4.2...v16.0.0) (2020-09-09)
+
+
+### ⚠ BREAKING CHANGES
+
+* tweaks to ESM/Deno API surface: now exports yargs function by default; getProcessArgvWithoutBin becomes hideBin; types now exported for Deno.
+* find-up replaced with escalade; export map added (limits importable files in Node >= 12); yarser-parser@19.x.x (new decamelize/camelcase implementation).
+* **usage:** single character aliases are now shown first in help output
+* rebase helper is no longer provided on yargs instance.
+* drop support for EOL Node 8 (#1686)
+
+### Features
+
+* adds strictOptions() ([#1738](https://www.github.com/yargs/yargs/issues/1738)) ([b215fba](https://www.github.com/yargs/yargs/commit/b215fba0ed6e124e5aad6cf22c8d5875661c63a3))
+* **helpers:** rebase, Parser, applyExtends now blessed helpers ([#1733](https://www.github.com/yargs/yargs/issues/1733)) ([c7debe8](https://www.github.com/yargs/yargs/commit/c7debe8eb1e5bc6ea20b5ed68026c56e5ebec9e1))
+* adds support for ESM and Deno ([#1708](https://www.github.com/yargs/yargs/issues/1708)) ([ac6d5d1](https://www.github.com/yargs/yargs/commit/ac6d5d105a75711fe703f6a39dad5181b383d6c6))
+* drop support for EOL Node 8 ([#1686](https://www.github.com/yargs/yargs/issues/1686)) ([863937f](https://www.github.com/yargs/yargs/commit/863937f23c3102f804cdea78ee3097e28c7c289f))
+* i18n for ESM and Deno ([#1735](https://www.github.com/yargs/yargs/issues/1735)) ([c71783a](https://www.github.com/yargs/yargs/commit/c71783a5a898a0c0e92ac501c939a3ec411ac0c1))
+* tweaks to API surface based on user feedback ([#1726](https://www.github.com/yargs/yargs/issues/1726)) ([4151fee](https://www.github.com/yargs/yargs/commit/4151fee4c33a97d26bc40de7e623e5b0eb87e9bb))
+* **usage:** single char aliases first in help ([#1574](https://www.github.com/yargs/yargs/issues/1574)) ([a552990](https://www.github.com/yargs/yargs/commit/a552990c120646c2d85a5c9b628e1ce92a68e797))
+
+
+### Bug Fixes
+
+* **yargs:** add missing command(module) signature ([#1707](https://www.github.com/yargs/yargs/issues/1707)) ([0f81024](https://www.github.com/yargs/yargs/commit/0f810245494ccf13a35b7786d021b30fc95ecad5)), closes [#1704](https://www.github.com/yargs/yargs/issues/1704)
+
+[Older CHANGELOG Entries](https://github.com/yargs/yargs/blob/master/docs/CHANGELOG-historical.md)
diff --git a/projects/arabica/src/sprint2/node_modules/yargs/LICENSE b/projects/arabica/src/sprint2/node_modules/yargs/LICENSE
new file mode 100644
index 0000000..b0145ca
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.com)
+
+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/projects/arabica/src/sprint2/node_modules/yargs/README.md b/projects/arabica/src/sprint2/node_modules/yargs/README.md
new file mode 100644
index 0000000..25a888e
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs/README.md
@@ -0,0 +1,202 @@
+
+
+
+ Yargs
+
+ Yargs be a node.js library fer hearties tryin' ter parse optstrings
+
+
+
+
+
+[![NPM version][npm-image]][npm-url]
+[![js-standard-style][standard-image]][standard-url]
+[![Coverage][coverage-image]][coverage-url]
+[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
+[![Slack][slack-image]][slack-url]
+
+## Description
+Yargs helps you build interactive command line tools, by parsing arguments and generating an elegant user interface.
+
+It gives you:
+
+* commands and (grouped) options (`my-program.js serve --port=5000`).
+* a dynamically generated help menu based on your arguments:
+
+```
+mocha [spec..]
+
+Run tests with Mocha
+
+Commands
+ mocha inspect [spec..] Run tests with Mocha [default]
+ mocha init create a client-side Mocha setup at
+
+Rules & Behavior
+ --allow-uncaught Allow uncaught errors to propagate [boolean]
+ --async-only, -A Require all tests to use a callback (async) or
+ return a Promise [boolean]
+```
+
+* bash-completion shortcuts for commands and options.
+* and [tons more](/docs/api.md).
+
+## Installation
+
+Stable version:
+```bash
+npm i yargs
+```
+
+Bleeding edge version with the most recent features:
+```bash
+npm i yargs@next
+```
+
+## Usage
+
+### Simple Example
+
+```javascript
+#!/usr/bin/env node
+const yargs = require('yargs/yargs')
+const { hideBin } = require('yargs/helpers')
+const argv = yargs(hideBin(process.argv)).argv
+
+if (argv.ships > 3 && argv.distance < 53.5) {
+ console.log('Plunder more riffiwobbles!')
+} else {
+ console.log('Retreat from the xupptumblers!')
+}
+```
+
+```bash
+$ ./plunder.js --ships=4 --distance=22
+Plunder more riffiwobbles!
+
+$ ./plunder.js --ships 12 --distance 98.7
+Retreat from the xupptumblers!
+```
+
+### Complex Example
+
+```javascript
+#!/usr/bin/env node
+const yargs = require('yargs/yargs')
+const { hideBin } = require('yargs/helpers')
+
+yargs(hideBin(process.argv))
+ .command('serve [port]', 'start the server', (yargs) => {
+ yargs
+ .positional('port', {
+ describe: 'port to bind on',
+ default: 5000
+ })
+ }, (argv) => {
+ if (argv.verbose) console.info(`start server on :${argv.port}`)
+ serve(argv.port)
+ })
+ .option('verbose', {
+ alias: 'v',
+ type: 'boolean',
+ description: 'Run with verbose logging'
+ })
+ .argv
+```
+
+Run the example above with `--help` to see the help for the application.
+
+## Supported Platforms
+
+### TypeScript
+
+yargs has type definitions at [@types/yargs][type-definitions].
+
+```
+npm i @types/yargs --save-dev
+```
+
+See usage examples in [docs](/docs/typescript.md).
+
+### Deno
+
+As of `v16`, `yargs` supports [Deno](https://github.com/denoland/deno):
+
+```typescript
+import yargs from 'https://deno.land/x/yargs/deno.ts'
+import { Arguments } from 'https://deno.land/x/yargs/deno-types.ts'
+
+yargs(Deno.args)
+ .command('download ', 'download a list of files', (yargs: any) => {
+ return yargs.positional('files', {
+ describe: 'a list of files to do something with'
+ })
+ }, (argv: Arguments) => {
+ console.info(argv)
+ })
+ .strictCommands()
+ .demandCommand(1)
+ .argv
+```
+
+### ESM
+
+As of `v16`,`yargs` supports ESM imports:
+
+```js
+import yargs from 'yargs'
+import { hideBin } from 'yargs/helpers'
+
+yargs(hideBin(process.argv))
+ .command('curl ', 'fetch the contents of the URL', () => {}, (argv) => {
+ console.info(argv)
+ })
+ .demandCommand(1)
+ .argv
+```
+
+### Usage in Browser
+
+See examples of using yargs in the browser in [docs](/docs/browser.md).
+
+## Community
+
+Having problems? want to contribute? join our [community slack](http://devtoolscommunity.herokuapp.com).
+
+## Documentation
+
+### Table of Contents
+
+* [Yargs' API](/docs/api.md)
+* [Examples](/docs/examples.md)
+* [Parsing Tricks](/docs/tricks.md)
+ * [Stop the Parser](/docs/tricks.md#stop)
+ * [Negating Boolean Arguments](/docs/tricks.md#negate)
+ * [Numbers](/docs/tricks.md#numbers)
+ * [Arrays](/docs/tricks.md#arrays)
+ * [Objects](/docs/tricks.md#objects)
+ * [Quotes](/docs/tricks.md#quotes)
+* [Advanced Topics](/docs/advanced.md)
+ * [Composing Your App Using Commands](/docs/advanced.md#commands)
+ * [Building Configurable CLI Apps](/docs/advanced.md#configuration)
+ * [Customizing Yargs' Parser](/docs/advanced.md#customizing)
+ * [Bundling yargs](/docs/bundling.md)
+* [Contributing](/contributing.md)
+
+## Supported Node.js Versions
+
+Libraries in this ecosystem make a best effort to track
+[Node.js' release schedule](https://nodejs.org/en/about/releases/). Here's [a
+post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
+
+[npm-url]: https://www.npmjs.com/package/yargs
+[npm-image]: https://img.shields.io/npm/v/yargs.svg
+[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
+[standard-url]: http://standardjs.com/
+[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg
+[conventional-commits-url]: https://conventionalcommits.org/
+[slack-image]: http://devtoolscommunity.herokuapp.com/badge.svg
+[slack-url]: http://devtoolscommunity.herokuapp.com
+[type-definitions]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/yargs
+[coverage-image]: https://img.shields.io/nycrc/yargs/yargs
+[coverage-url]: https://github.com/yargs/yargs/blob/master/.nycrc
diff --git a/projects/arabica/src/sprint2/node_modules/yargs/browser.mjs b/projects/arabica/src/sprint2/node_modules/yargs/browser.mjs
new file mode 100644
index 0000000..d8a9f3d
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs/browser.mjs
@@ -0,0 +1,7 @@
+// Bootstrap yargs for browser:
+import browserPlatformShim from './lib/platform-shims/browser.mjs';
+import {YargsWithShim} from './build/lib/yargs-factory.js';
+
+const Yargs = YargsWithShim(browserPlatformShim);
+
+export default Yargs;
diff --git a/projects/arabica/src/sprint2/node_modules/yargs/build/index.cjs b/projects/arabica/src/sprint2/node_modules/yargs/build/index.cjs
new file mode 100644
index 0000000..34ad9a8
--- /dev/null
+++ b/projects/arabica/src/sprint2/node_modules/yargs/build/index.cjs
@@ -0,0 +1,2920 @@
+'use strict';
+
+var assert = require('assert');
+
+class YError extends Error {
+ constructor(msg) {
+ super(msg || 'yargs error');
+ this.name = 'YError';
+ Error.captureStackTrace(this, YError);
+ }
+}
+
+let previouslyVisitedConfigs = [];
+let shim;
+function applyExtends(config, cwd, mergeExtends, _shim) {
+ shim = _shim;
+ let defaultConfig = {};
+ if (Object.prototype.hasOwnProperty.call(config, 'extends')) {
+ if (typeof config.extends !== 'string')
+ return defaultConfig;
+ const isPath = /\.json|\..*rc$/.test(config.extends);
+ let pathToDefault = null;
+ if (!isPath) {
+ try {
+ pathToDefault = require.resolve(config.extends);
+ }
+ catch (_err) {
+ return config;
+ }
+ }
+ else {
+ pathToDefault = getPathToDefaultConfig(cwd, config.extends);
+ }
+ checkForCircularExtends(pathToDefault);
+ previouslyVisitedConfigs.push(pathToDefault);
+ defaultConfig = isPath
+ ? JSON.parse(shim.readFileSync(pathToDefault, 'utf8'))
+ : require(config.extends);
+ delete config.extends;
+ defaultConfig = applyExtends(defaultConfig, shim.path.dirname(pathToDefault), mergeExtends, shim);
+ }
+ previouslyVisitedConfigs = [];
+ return mergeExtends
+ ? mergeDeep(defaultConfig, config)
+ : Object.assign({}, defaultConfig, config);
+}
+function checkForCircularExtends(cfgPath) {
+ if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
+ throw new YError(`Circular extended configurations: '${cfgPath}'.`);
+ }
+}
+function getPathToDefaultConfig(cwd, pathToExtend) {
+ return shim.path.resolve(cwd, pathToExtend);
+}
+function mergeDeep(config1, config2) {
+ const target = {};
+ function isObject(obj) {
+ return obj && typeof obj === 'object' && !Array.isArray(obj);
+ }
+ Object.assign(target, config1);
+ for (const key of Object.keys(config2)) {
+ if (isObject(config2[key]) && isObject(target[key])) {
+ target[key] = mergeDeep(config1[key], config2[key]);
+ }
+ else {
+ target[key] = config2[key];
+ }
+ }
+ return target;
+}
+
+function parseCommand(cmd) {
+ const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' ');
+ const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/);
+ const bregex = /\.*[\][<>]/g;
+ const firstCommand = splitCommand.shift();
+ if (!firstCommand)
+ throw new Error(`No command found in: ${cmd}`);
+ const parsedCommand = {
+ cmd: firstCommand.replace(bregex, ''),
+ demanded: [],
+ optional: [],
+ };
+ splitCommand.forEach((cmd, i) => {
+ let variadic = false;
+ cmd = cmd.replace(/\s/g, '');
+ if (/\.+[\]>]/.test(cmd) && i === splitCommand.length - 1)
+ variadic = true;
+ if (/^\[/.test(cmd)) {
+ parsedCommand.optional.push({
+ cmd: cmd.replace(bregex, '').split('|'),
+ variadic,
+ });
+ }
+ else {
+ parsedCommand.demanded.push({
+ cmd: cmd.replace(bregex, '').split('|'),
+ variadic,
+ });
+ }
+ });
+ return parsedCommand;
+}
+
+const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth'];
+function argsert(arg1, arg2, arg3) {
+ function parseArgs() {
+ return typeof arg1 === 'object'
+ ? [{ demanded: [], optional: [] }, arg1, arg2]
+ : [
+ parseCommand(`cmd ${arg1}`),
+ arg2,
+ arg3,
+ ];
+ }
+ try {
+ let position = 0;
+ const [parsed, callerArguments, _length] = parseArgs();
+ const args = [].slice.call(callerArguments);
+ while (args.length && args[args.length - 1] === undefined)
+ args.pop();
+ const length = _length || args.length;
+ if (length < parsed.demanded.length) {
+ throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`);
+ }
+ const totalCommands = parsed.demanded.length + parsed.optional.length;
+ if (length > totalCommands) {
+ throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`);
+ }
+ parsed.demanded.forEach(demanded => {
+ const arg = args.shift();
+ const observedType = guessType(arg);
+ const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*');
+ if (matchingTypes.length === 0)
+ argumentTypeError(observedType, demanded.cmd, position);
+ position += 1;
+ });
+ parsed.optional.forEach(optional => {
+ if (args.length === 0)
+ return;
+ const arg = args.shift();
+ const observedType = guessType(arg);
+ const matchingTypes = optional.cmd.filter(type => type === observedType || type === '*');
+ if (matchingTypes.length === 0)
+ argumentTypeError(observedType, optional.cmd, position);
+ position += 1;
+ });
+ }
+ catch (err) {
+ console.warn(err.stack);
+ }
+}
+function guessType(arg) {
+ if (Array.isArray(arg)) {
+ return 'array';
+ }
+ else if (arg === null) {
+ return 'null';
+ }
+ return typeof arg;
+}
+function argumentTypeError(observedType, allowedTypes, position) {
+ throw new YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`);
+}
+
+function isPromise(maybePromise) {
+ return (!!maybePromise &&
+ !!maybePromise.then &&
+ typeof maybePromise.then === 'function');
+}
+
+function assertNotStrictEqual(actual, expected, shim, message) {
+ shim.assert.notStrictEqual(actual, expected, message);
+}
+function assertSingleKey(actual, shim) {
+ shim.assert.strictEqual(typeof actual, 'string');
+}
+function objectKeys(object) {
+ return Object.keys(object);
+}
+
+function objFilter(original = {}, filter = () => true) {
+ const obj = {};
+ objectKeys(original).forEach(key => {
+ if (filter(key, original[key])) {
+ obj[key] = original[key];
+ }
+ });
+ return obj;
+}
+
+function globalMiddlewareFactory(globalMiddleware, context) {
+ return function (callback, applyBeforeValidation = false) {
+ argsert(' [boolean]', [callback, applyBeforeValidation], arguments.length);
+ if (Array.isArray(callback)) {
+ for (let i = 0; i < callback.length; i++) {
+ if (typeof callback[i] !== 'function') {
+ throw Error('middleware must be a function');
+ }
+ callback[i].applyBeforeValidation = applyBeforeValidation;
+ }
+ Array.prototype.push.apply(globalMiddleware, callback);
+ }
+ else if (typeof callback === 'function') {
+ callback.applyBeforeValidation = applyBeforeValidation;
+ globalMiddleware.push(callback);
+ }
+ return context;
+ };
+}
+function commandMiddlewareFactory(commandMiddleware) {
+ if (!commandMiddleware)
+ return [];
+ return commandMiddleware.map(middleware => {
+ middleware.applyBeforeValidation = false;
+ return middleware;
+ });
+}
+function applyMiddleware(argv, yargs, middlewares, beforeValidation) {
+ const beforeValidationError = new Error('middleware cannot return a promise when applyBeforeValidation is true');
+ return middlewares.reduce((acc, middleware) => {
+ if (middleware.applyBeforeValidation !== beforeValidation) {
+ return acc;
+ }
+ if (isPromise(acc)) {
+ return acc
+ .then(initialObj => Promise.all([
+ initialObj,
+ middleware(initialObj, yargs),
+ ]))
+ .then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj));
+ }
+ else {
+ const result = middleware(acc, yargs);
+ if (beforeValidation && isPromise(result))
+ throw beforeValidationError;
+ return isPromise(result)
+ ? result.then(middlewareObj => Object.assign(acc, middlewareObj))
+ : Object.assign(acc, result);
+ }
+ }, argv);
+}
+
+function getProcessArgvBinIndex() {
+ if (isBundledElectronApp())
+ return 0;
+ return 1;
+}
+function isBundledElectronApp() {
+ return isElectronApp() && !process.defaultApp;
+}
+function isElectronApp() {
+ return !!process.versions.electron;
+}
+function hideBin(argv) {
+ return argv.slice(getProcessArgvBinIndex() + 1);
+}
+function getProcessArgvBin() {
+ return process.argv[getProcessArgvBinIndex()];
+}
+
+var processArgv = /*#__PURE__*/Object.freeze({
+ __proto__: null,
+ hideBin: hideBin,
+ getProcessArgvBin: getProcessArgvBin
+});
+
+function whichModule(exported) {
+ if (typeof require === 'undefined')
+ return null;
+ for (let i = 0, files = Object.keys(require.cache), mod; i < files.length; i++) {
+ mod = require.cache[files[i]];
+ if (mod.exports === exported)
+ return mod;
+ }
+ return null;
+}
+
+const DEFAULT_MARKER = /(^\*)|(^\$0)/;
+function command(yargs, usage, validation, globalMiddleware = [], shim) {
+ const self = {};
+ let handlers = {};
+ let aliasMap = {};
+ let defaultCommand;
+ self.addHandler = function addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) {
+ let aliases = [];
+ const middlewares = commandMiddlewareFactory(commandMiddleware);
+ handler = handler || (() => { });
+ if (Array.isArray(cmd)) {
+ if (isCommandAndAliases(cmd)) {
+ [cmd, ...aliases] = cmd;
+ }
+ else {
+ for (const command of cmd) {
+ self.addHandler(command);
+ }
+ }
+ }
+ else if (isCommandHandlerDefinition(cmd)) {
+ let command = Array.isArray(cmd.command) || typeof cmd.command === 'string'
+ ? cmd.command
+ : moduleName(cmd);
+ if (cmd.aliases)
+ command = [].concat(command).concat(cmd.aliases);
+ self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated);
+ return;
+ }
+ else if (isCommandBuilderDefinition(builder)) {
+ self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated);
+ return;
+ }
+ if (typeof cmd === 'string') {
+ const parsedCommand = parseCommand(cmd);
+ aliases = aliases.map(alias => parseCommand(alias).cmd);
+ let isDefault = false;
+ const parsedAliases = [parsedCommand.cmd].concat(aliases).filter(c => {
+ if (DEFAULT_MARKER.test(c)) {
+ isDefault = true;
+ return false;
+ }
+ return true;
+ });
+ if (parsedAliases.length === 0 && isDefault)
+ parsedAliases.push('$0');
+ if (isDefault) {
+ parsedCommand.cmd = parsedAliases[0];
+ aliases = parsedAliases.slice(1);
+ cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd);
+ }
+ aliases.forEach(alias => {
+ aliasMap[alias] = parsedCommand.cmd;
+ });
+ if (description !== false) {
+ usage.command(cmd, description, isDefault, aliases, deprecated);
+ }
+ handlers[parsedCommand.cmd] = {
+ original: cmd,
+ description,
+ handler,
+ builder: builder || {},
+ middlewares,
+ deprecated,
+ demanded: parsedCommand.demanded,
+ optional: parsedCommand.optional,
+ };
+ if (isDefault)
+ defaultCommand = handlers[parsedCommand.cmd];
+ }
+ };
+ self.addDirectory = function addDirectory(dir, context, req, callerFile, opts) {
+ opts = opts || {};
+ if (typeof opts.recurse !== 'boolean')
+ opts.recurse = false;
+ if (!Array.isArray(opts.extensions))
+ opts.extensions = ['js'];
+ const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o;
+ opts.visit = function visit(obj, joined, filename) {
+ const visited = parentVisit(obj, joined, filename);
+ if (visited) {
+ if (~context.files.indexOf(joined))
+ return visited;
+ context.files.push(joined);
+ self.addHandler(visited);
+ }
+ return visited;
+ };
+ shim.requireDirectory({ require: req, filename: callerFile }, dir, opts);
+ };
+ function moduleName(obj) {
+ const mod = whichModule(obj);
+ if (!mod)
+ throw new Error(`No command name given for module: ${shim.inspect(obj)}`);
+ return commandFromFilename(mod.filename);
+ }
+ function commandFromFilename(filename) {
+ return shim.path.basename(filename, shim.path.extname(filename));
+ }
+ function extractDesc({ describe, description, desc, }) {
+ for (const test of [describe, description, desc]) {
+ if (typeof test === 'string' || test === false)
+ return test;
+ assertNotStrictEqual(test, true, shim);
+ }
+ return false;
+ }
+ self.getCommands = () => Object.keys(handlers).concat(Object.keys(aliasMap));
+ self.getCommandHandlers = () => handlers;
+ self.hasDefaultCommand = () => !!defaultCommand;
+ self.runCommand = function runCommand(command, yargs, parsed, commandIndex) {
+ let aliases = parsed.aliases;
+ const commandHandler = handlers[command] || handlers[aliasMap[command]] || defaultCommand;
+ const currentContext = yargs.getContext();
+ let numFiles = currentContext.files.length;
+ const parentCommands = currentContext.commands.slice();
+ let innerArgv = parsed.argv;
+ let positionalMap = {};
+ if (command) {
+ currentContext.commands.push(command);
+ currentContext.fullCommands.push(commandHandler.original);
+ }
+ const builder = commandHandler.builder;
+ if (isCommandBuilderCallback(builder)) {
+ const builderOutput = builder(yargs.reset(parsed.aliases));
+ const innerYargs = isYargsInstance(builderOutput) ? builderOutput : yargs;
+ if (shouldUpdateUsage(innerYargs)) {
+ innerYargs
+ .getUsageInstance()
+ .usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
+ }
+ innerArgv = innerYargs._parseArgs(null, null, true, commandIndex);
+ aliases = innerYargs.parsed.aliases;
+ }
+ else if (isCommandBuilderOptionDefinitions(builder)) {
+ const innerYargs = yargs.reset(parsed.aliases);
+ if (shouldUpdateUsage(innerYargs)) {
+ innerYargs
+ .getUsageInstance()
+ .usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description);
+ }
+ Object.keys(commandHandler.builder).forEach(key => {
+ innerYargs.option(key, builder[key]);
+ });
+ innerArgv = innerYargs._parseArgs(null, null, true, commandIndex);
+ aliases = innerYargs.parsed.aliases;
+ }
+ if (!yargs._hasOutput()) {
+ positionalMap = populatePositionals(commandHandler, innerArgv, currentContext);
+ }
+ const middlewares = globalMiddleware
+ .slice(0)
+ .concat(commandHandler.middlewares);
+ applyMiddleware(innerArgv, yargs, middlewares, true);
+ if (!yargs._hasOutput()) {
+ yargs._runValidation(innerArgv, aliases, positionalMap, yargs.parsed.error, !command);
+ }
+ if (commandHandler.handler && !yargs._hasOutput()) {
+ yargs._setHasOutput();
+ const populateDoubleDash = !!yargs.getOptions().configuration['populate--'];
+ yargs._postProcess(innerArgv, populateDoubleDash);
+ innerArgv = applyMiddleware(innerArgv, yargs, middlewares, false);
+ let handlerResult;
+ if (isPromise(innerArgv)) {
+ handlerResult = innerArgv.then(argv => commandHandler.handler(argv));
+ }
+ else {
+ handlerResult = commandHandler.handler(innerArgv);
+ }
+ const handlerFinishCommand = yargs.getHandlerFinishCommand();
+ if (isPromise(handlerResult)) {
+ yargs.getUsageInstance().cacheHelpMessage();
+ handlerResult
+ .then(value => {
+ if (handlerFinishCommand) {
+ handlerFinishCommand(value);
+ }
+ })
+ .catch(error => {
+ try {
+ yargs.getUsageInstance().fail(null, error);
+ }
+ catch (err) {
+ }
+ })
+ .then(() => {
+ yargs.getUsageInstance().clearCachedHelpMessage();
+ });
+ }
+ else {
+ if (handlerFinishCommand) {
+ handlerFinishCommand(handlerResult);
+ }
+ }
+ }
+ if (command) {
+ currentContext.commands.pop();
+ currentContext.fullCommands.pop();
+ }
+ numFiles = currentContext.files.length - numFiles;
+ if (numFiles > 0)
+ currentContext.files.splice(numFiles * -1, numFiles);
+ return innerArgv;
+ };
+ function shouldUpdateUsage(yargs) {
+ return (!yargs.getUsageInstance().getUsageDisabled() &&
+ yargs.getUsageInstance().getUsage().length === 0);
+ }
+ function usageFromParentCommandsCommandHandler(parentCommands, commandHandler) {
+ const c = DEFAULT_MARKER.test(commandHandler.original)
+ ? commandHandler.original.replace(DEFAULT_MARKER, '').trim()
+ : commandHandler.original;
+ const pc = parentCommands.filter(c => {
+ return !DEFAULT_MARKER.test(c);
+ });
+ pc.push(c);
+ return `$0 ${pc.join(' ')}`;
+ }
+ self.runDefaultBuilderOn = function (yargs) {
+ assertNotStrictEqual(defaultCommand, undefined, shim);
+ if (shouldUpdateUsage(yargs)) {
+ const commandString = DEFAULT_MARKER.test(defaultCommand.original)
+ ? defaultCommand.original
+ : defaultCommand.original.replace(/^[^[\]<>]*/, '$0 ');
+ yargs.getUsageInstance().usage(commandString, defaultCommand.description);
+ }
+ const builder = defaultCommand.builder;
+ if (isCommandBuilderCallback(builder)) {
+ builder(yargs);
+ }
+ else if (!isCommandBuilderDefinition(builder)) {
+ Object.keys(builder).forEach(key => {
+ yargs.option(key, builder[key]);
+ });
+ }
+ };
+ function populatePositionals(commandHandler, argv, context) {
+ argv._ = argv._.slice(context.commands.length);
+ const demanded = commandHandler.demanded.slice(0);
+ const optional = commandHandler.optional.slice(0);
+ const positionalMap = {};
+ validation.positionalCount(demanded.length, argv._.length);
+ while (demanded.length) {
+ const demand = demanded.shift();
+ populatePositional(demand, argv, positionalMap);
+ }
+ while (optional.length) {
+ const maybe = optional.shift();
+ populatePositional(maybe, argv, positionalMap);
+ }
+ argv._ = context.commands.concat(argv._.map(a => '' + a));
+ postProcessPositionals(argv, positionalMap, self.cmdToParseOptions(commandHandler.original));
+ return positionalMap;
+ }
+ function populatePositional(positional, argv, positionalMap) {
+ const cmd = positional.cmd[0];
+ if (positional.variadic) {
+ positionalMap[cmd] = argv._.splice(0).map(String);
+ }
+ else {
+ if (argv._.length)
+ positionalMap[cmd] = [String(argv._.shift())];
+ }
+ }
+ function postProcessPositionals(argv, positionalMap, parseOptions) {
+ const options = Object.assign({}, yargs.getOptions());
+ options.default = Object.assign(parseOptions.default, options.default);
+ for (const key of Object.keys(parseOptions.alias)) {
+ options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]);
+ }
+ options.array = options.array.concat(parseOptions.array);
+ options.config = {};
+ const unparsed = [];
+ Object.keys(positionalMap).forEach(key => {
+ positionalMap[key].map(value => {
+ if (options.configuration['unknown-options-as-args'])
+ options.key[key] = true;
+ unparsed.push(`--${key}`);
+ unparsed.push(value);
+ });
+ });
+ if (!unparsed.length)
+ return;
+ const config = Object.assign({}, options.configuration, {
+ 'populate--': true,
+ });
+ const parsed = shim.Parser.detailed(unparsed, Object.assign({}, options, {
+ configuration: config,
+ }));
+ if (parsed.error) {
+ yargs.getUsageInstance().fail(parsed.error.message, parsed.error);
+ }
+ else {
+ const positionalKeys = Object.keys(positionalMap);
+ Object.keys(positionalMap).forEach(key => {
+ positionalKeys.push(...parsed.aliases[key]);
+ });
+ Object.keys(parsed.argv).forEach(key => {
+ if (positionalKeys.indexOf(key) !== -1) {
+ if (!positionalMap[key])
+ positionalMap[key] = parsed.argv[key];
+ argv[key] = parsed.argv[key];
+ }
+ });
+ }
+ }
+ self.cmdToParseOptions = function (cmdString) {
+ const parseOptions = {
+ array: [],
+ default: {},
+ alias: {},
+ demand: {},
+ };
+ const parsed = parseCommand(cmdString);
+ parsed.demanded.forEach(d => {
+ const [cmd, ...aliases] = d.cmd;
+ if (d.variadic) {
+ parseOptions.array.push(cmd);
+ parseOptions.default[cmd] = [];
+ }
+ parseOptions.alias[cmd] = aliases;
+ parseOptions.demand[cmd] = true;
+ });
+ parsed.optional.forEach(o => {
+ const [cmd, ...aliases] = o.cmd;
+ if (o.variadic) {
+ parseOptions.array.push(cmd);
+ parseOptions.default[cmd] = [];
+ }
+ parseOptions.alias[cmd] = aliases;
+ });
+ return parseOptions;
+ };
+ self.reset = () => {
+ handlers = {};
+ aliasMap = {};
+ defaultCommand = undefined;
+ return self;
+ };
+ const frozens = [];
+ self.freeze = () => {
+ frozens.push({
+ handlers,
+ aliasMap,
+ defaultCommand,
+ });
+ };
+ self.unfreeze = () => {
+ const frozen = frozens.pop();
+ assertNotStrictEqual(frozen, undefined, shim);
+ ({ handlers, aliasMap, defaultCommand } = frozen);
+ };
+ return self;
+}
+function isCommandBuilderDefinition(builder) {
+ return (typeof builder === 'object' &&
+ !!builder.builder &&
+ typeof builder.handler === 'function');
+}
+function isCommandAndAliases(cmd) {
+ if (cmd.every(c => typeof c === 'string')) {
+ return true;
+ }
+ else {
+ return false;
+ }
+}
+function isCommandBuilderCallback(builder) {
+ return typeof builder === 'function';
+}
+function isCommandBuilderOptionDefinitions(builder) {
+ return typeof builder === 'object';
+}
+function isCommandHandlerDefinition(cmd) {
+ return typeof cmd === 'object' && !Array.isArray(cmd);
+}
+
+function setBlocking(blocking) {
+ if (typeof process === 'undefined')
+ return;
+ [process.stdout, process.stderr].forEach(_stream => {
+ const stream = _stream;
+ if (stream._handle &&
+ stream.isTTY &&
+ typeof stream._handle.setBlocking === 'function') {
+ stream._handle.setBlocking(blocking);
+ }
+ });
+}
+
+function usage(yargs, y18n, shim) {
+ const __ = y18n.__;
+ const self = {};
+ const fails = [];
+ self.failFn = function failFn(f) {
+ fails.push(f);
+ };
+ let failMessage = null;
+ let showHelpOnFail = true;
+ self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) {
+ function parseFunctionArgs() {
+ return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2];
+ }
+ const [enabled, message] = parseFunctionArgs();
+ failMessage = message;
+ showHelpOnFail = enabled;
+ return self;
+ };
+ let failureOutput = false;
+ self.fail = function fail(msg, err) {
+ const logger = yargs._getLoggerInstance();
+ if (fails.length) {
+ for (let i = fails.length - 1; i >= 0; --i) {
+ fails[i](msg, err, self);
+ }
+ }
+ else {
+ if (yargs.getExitProcess())
+ setBlocking(true);
+ if (!failureOutput) {
+ failureOutput = true;
+ if (showHelpOnFail) {
+ yargs.showHelp('error');
+ logger.error();
+ }
+ if (msg || err)
+ logger.error(msg || err);
+ if (failMessage) {
+ if (msg || err)
+ logger.error('');
+ logger.error(failMessage);
+ }
+ }
+ err = err || new YError(msg);
+ if (yargs.getExitProcess()) {
+ return yargs.exit(1);
+ }
+ else if (yargs._hasParseCallback()) {
+ return yargs.exit(1, err);
+ }
+ else {
+ throw err;
+ }
+ }
+ };
+ let usages = [];
+ let usageDisabled = false;
+ self.usage = (msg, description) => {
+ if (msg === null) {
+ usageDisabled = true;
+ usages = [];
+ return self;
+ }
+ usageDisabled = false;
+ usages.push([msg, description || '']);
+ return self;
+ };
+ self.getUsage = () => {
+ return usages;
+ };
+ self.getUsageDisabled = () => {
+ return usageDisabled;
+ };
+ self.getPositionalGroupName = () => {
+ return __('Positionals:');
+ };
+ let examples = [];
+ self.example = (cmd, description) => {
+ examples.push([cmd, description || '']);
+ };
+ let commands = [];
+ self.command = function command(cmd, description, isDefault, aliases, deprecated = false) {
+ if (isDefault) {
+ commands = commands.map(cmdArray => {
+ cmdArray[2] = false;
+ return cmdArray;
+ });
+ }
+ commands.push([cmd, description || '', isDefault, aliases, deprecated]);
+ };
+ self.getCommands = () => commands;
+ let descriptions = {};
+ self.describe = function describe(keyOrKeys, desc) {
+ if (Array.isArray(keyOrKeys)) {
+ keyOrKeys.forEach(k => {
+ self.describe(k, desc);
+ });
+ }
+ else if (typeof keyOrKeys === 'object') {
+ Object.keys(keyOrKeys).forEach(k => {
+ self.describe(k, keyOrKeys[k]);
+ });
+ }
+ else {
+ descriptions[keyOrKeys] = desc;
+ }
+ };
+ self.getDescriptions = () => descriptions;
+ let epilogs = [];
+ self.epilog = msg => {
+ epilogs.push(msg);
+ };
+ let wrapSet = false;
+ let wrap;
+ self.wrap = cols => {
+ wrapSet = true;
+ wrap = cols;
+ };
+ function getWrap() {
+ if (!wrapSet) {
+ wrap = windowWidth();
+ wrapSet = true;
+ }
+ return wrap;
+ }
+ const deferY18nLookupPrefix = '__yargsString__:';
+ self.deferY18nLookup = str => deferY18nLookupPrefix + str;
+ self.help = function help() {
+ if (cachedHelpMessage)
+ return cachedHelpMessage;
+ normalizeAliases();
+ const base$0 = yargs.customScriptName
+ ? yargs.$0
+ : shim.path.basename(yargs.$0);
+ const demandedOptions = yargs.getDemandedOptions();
+ const demandedCommands = yargs.getDemandedCommands();
+ const deprecatedOptions = yargs.getDeprecatedOptions();
+ const groups = yargs.getGroups();
+ const options = yargs.getOptions();
+ let keys = [];
+ keys = keys.concat(Object.keys(descriptions));
+ keys = keys.concat(Object.keys(demandedOptions));
+ keys = keys.concat(Object.keys(demandedCommands));
+ keys = keys.concat(Object.keys(options.default));
+ keys = keys.filter(filterHiddenOptions);
+ keys = Object.keys(keys.reduce((acc, key) => {
+ if (key !== '_')
+ acc[key] = true;
+ return acc;
+ }, {}));
+ const theWrap = getWrap();
+ const ui = shim.cliui({
+ width: theWrap,
+ wrap: !!theWrap,
+ });
+ if (!usageDisabled) {
+ if (usages.length) {
+ usages.forEach(usage => {
+ ui.div(`${usage[0].replace(/\$0/g, base$0)}`);
+ if (usage[1]) {
+ ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] });
+ }
+ });
+ ui.div();
+ }
+ else if (commands.length) {
+ let u = null;
+ if (demandedCommands._) {
+ u = `${base$0} <${__('command')}>\n`;
+ }
+ else {
+ u = `${base$0} [${__('command')}]\n`;
+ }
+ ui.div(`${u}`);
+ }
+ }
+ if (commands.length) {
+ ui.div(__('Commands:'));
+ const context = yargs.getContext();
+ const parentCommands = context.commands.length
+ ? `${context.commands.join(' ')} `
+ : '';
+ if (yargs.getParserConfiguration()['sort-commands'] === true) {
+ commands = commands.sort((a, b) => a[0].localeCompare(b[0]));
+ }
+ commands.forEach(command => {
+ const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`;
+ ui.span({
+ text: commandString,
+ padding: [0, 2, 0, 2],
+ width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4,
+ }, { text: command[1] });
+ const hints = [];
+ if (command[2])
+ hints.push(`[${__('default')}]`);
+ if (command[3] && command[3].length) {
+ hints.push(`[${__('aliases:')} ${command[3].join(', ')}]`);
+ }
+ if (command[4]) {
+ if (typeof command[4] === 'string') {
+ hints.push(`[${__('deprecated: %s', command[4])}]`);
+ }
+ else {
+ hints.push(`[${__('deprecated')}]`);
+ }
+ }
+ if (hints.length) {
+ ui.div({
+ text: hints.join(' '),
+ padding: [0, 0, 0, 2],
+ align: 'right',
+ });
+ }
+ else {
+ ui.div();
+ }
+ });
+ ui.div();
+ }
+ const aliasKeys = (Object.keys(options.alias) || []).concat(Object.keys(yargs.parsed.newAliases) || []);
+ keys = keys.filter(key => !yargs.parsed.newAliases[key] &&
+ aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1));
+ const defaultGroup = __('Options:');
+ if (!groups[defaultGroup])
+ groups[defaultGroup] = [];
+ addUngroupedKeys(keys, options.alias, groups, defaultGroup);
+ const isLongSwitch = (sw) => /^--/.test(getText(sw));
+ const displayedGroups = Object.keys(groups)
+ .filter(groupName => groups[groupName].length > 0)
+ .map(groupName => {
+ const normalizedKeys = groups[groupName]
+ .filter(filterHiddenOptions)
+ .map(key => {
+ if (~aliasKeys.indexOf(key))
+ return key;
+ for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
+ if (~(options.alias[aliasKey] || []).indexOf(key))
+ return aliasKey;
+ }
+ return key;
+ });
+ return { groupName, normalizedKeys };
+ })
+ .filter(({ normalizedKeys }) => normalizedKeys.length > 0)
+ .map(({ groupName, normalizedKeys }) => {
+ const switches = normalizedKeys.reduce((acc, key) => {
+ acc[key] = [key]
+ .concat(options.alias[key] || [])
+ .map(sw => {
+ if (groupName === self.getPositionalGroupName())
+ return sw;
+ else {
+ return ((/^[0-9]$/.test(sw)
+ ? ~options.boolean.indexOf(key)
+ ? '-'
+ : '--'
+ : sw.length > 1
+ ? '--'
+ : '-') + sw);
+ }
+ })
+ .sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2)
+ ? 0
+ : isLongSwitch(sw1)
+ ? 1
+ : -1)
+ .join(', ');
+ return acc;
+ }, {});
+ return { groupName, normalizedKeys, switches };
+ });
+ const shortSwitchesUsed = displayedGroups
+ .filter(({ groupName }) => groupName !== self.getPositionalGroupName())
+ .some(({ normalizedKeys, switches }) => !normalizedKeys.every(key => isLongSwitch(switches[key])));
+ if (shortSwitchesUsed) {
+ displayedGroups
+ .filter(({ groupName }) => groupName !== self.getPositionalGroupName())
+ .forEach(({ normalizedKeys, switches }) => {
+ normalizedKeys.forEach(key => {
+ if (isLongSwitch(switches[key])) {
+ switches[key] = addIndentation(switches[key], '-x, '.length);
+ }
+ });
+ });
+ }
+ displayedGroups.forEach(({ groupName, normalizedKeys, switches }) => {
+ ui.div(groupName);
+ normalizedKeys.forEach(key => {
+ const kswitch = switches[key];
+ let desc = descriptions[key] || '';
+ let type = null;
+ if (~desc.lastIndexOf(deferY18nLookupPrefix))
+ desc = __(desc.substring(deferY18nLookupPrefix.length));
+ if (~options.boolean.indexOf(key))
+ type = `[${__('boolean')}]`;
+ if (~options.count.indexOf(key))
+ type = `[${__('count')}]`;
+ if (~options.string.indexOf(key))
+ type = `[${__('string')}]`;
+ if (~options.normalize.indexOf(key))
+ type = `[${__('string')}]`;
+ if (~options.array.indexOf(key))
+ type = `[${__('array')}]`;
+ if (~options.number.indexOf(key))
+ type = `[${__('number')}]`;
+ const deprecatedExtra = (deprecated) => typeof deprecated === 'string'
+ ? `[${__('deprecated: %s', deprecated)}]`
+ : `[${__('deprecated')}]`;
+ const extra = [
+ key in deprecatedOptions
+ ? deprecatedExtra(deprecatedOptions[key])
+ : null,
+ type,
+ key in demandedOptions ? `[${__('required')}]` : null,
+ options.choices && options.choices[key]
+ ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]`
+ : null,
+ defaultString(options.default[key], options.defaultDescription[key]),
+ ]
+ .filter(Boolean)
+ .join(' ');
+ ui.span({
+ text: getText(kswitch),
+ padding: [0, 2, 0, 2 + getIndentation(kswitch)],
+ width: maxWidth(switches, theWrap) + 4,
+ }, desc);
+ if (extra)
+ ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' });
+ else
+ ui.div();
+ });
+ ui.div();
+ });
+ if (examples.length) {
+ ui.div(__('Examples:'));
+ examples.forEach(example => {
+ example[0] = example[0].replace(/\$0/g, base$0);
+ });
+ examples.forEach(example => {
+ if (example[1] === '') {
+ ui.div({
+ text: example[0],
+ padding: [0, 2, 0, 2],
+ });
+ }
+ else {
+ ui.div({
+ text: example[0],
+ padding: [0, 2, 0, 2],
+ width: maxWidth(examples, theWrap) + 4,
+ }, {
+ text: example[1],
+ });
+ }
+ });
+ ui.div();
+ }
+ if (epilogs.length > 0) {
+ const e = epilogs
+ .map(epilog => epilog.replace(/\$0/g, base$0))
+ .join('\n');
+ ui.div(`${e}\n`);
+ }
+ return ui.toString().replace(/\s*$/, '');
+ };
+ function maxWidth(table, theWrap, modifier) {
+ let width = 0;
+ if (!Array.isArray(table)) {
+ table = Object.values(table).map(v => [v]);
+ }
+ table.forEach(v => {
+ width = Math.max(shim.stringWidth(modifier ? `${modifier} ${getText(v[0])}` : getText(v[0])) + getIndentation(v[0]), width);
+ });
+ if (theWrap)
+ width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10));
+ return width;
+ }
+ function normalizeAliases() {
+ const demandedOptions = yargs.getDemandedOptions();
+ const options = yargs.getOptions();
+ (Object.keys(options.alias) || []).forEach(key => {
+ options.alias[key].forEach(alias => {
+ if (descriptions[alias])
+ self.describe(key, descriptions[alias]);
+ if (alias in demandedOptions)
+ yargs.demandOption(key, demandedOptions[alias]);
+ if (~options.boolean.indexOf(alias))
+ yargs.boolean(key);
+ if (~options.count.indexOf(alias))
+ yargs.count(key);
+ if (~options.string.indexOf(alias))
+ yargs.string(key);
+ if (~options.normalize.indexOf(alias))
+ yargs.normalize(key);
+ if (~options.array.indexOf(alias))
+ yargs.array(key);
+ if (~options.number.indexOf(alias))
+ yargs.number(key);
+ });
+ });
+ }
+ let cachedHelpMessage;
+ self.cacheHelpMessage = function () {
+ cachedHelpMessage = this.help();
+ };
+ self.clearCachedHelpMessage = function () {
+ cachedHelpMessage = undefined;
+ };
+ function addUngroupedKeys(keys, aliases, groups, defaultGroup) {
+ let groupedKeys = [];
+ let toCheck = null;
+ Object.keys(groups).forEach(group => {
+ groupedKeys = groupedKeys.concat(groups[group]);
+ });
+ keys.forEach(key => {
+ toCheck = [key].concat(aliases[key]);
+ if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
+ groups[defaultGroup].push(key);
+ }
+ });
+ return groupedKeys;
+ }
+ function filterHiddenOptions(key) {
+ return (yargs.getOptions().hiddenOptions.indexOf(key) < 0 ||
+ yargs.parsed.argv[yargs.getOptions().showHiddenOpt]);
+ }
+ self.showHelp = (level) => {
+ const logger = yargs._getLoggerInstance();
+ if (!level)
+ level = 'error';
+ const emit = typeof level === 'function' ? level : logger[level];
+ emit(self.help());
+ };
+ self.functionDescription = fn => {
+ const description = fn.name
+ ? shim.Parser.decamelize(fn.name, '-')
+ : __('generated-value');
+ return ['(', description, ')'].join('');
+ };
+ self.stringifiedValues = function stringifiedValues(values, separator) {
+ let string = '';
+ const sep = separator || ', ';
+ const array = [].concat(values);
+ if (!values || !array.length)
+ return string;
+ array.forEach(value => {
+ if (string.length)
+ string += sep;
+ string += JSON.stringify(value);
+ });
+ return string;
+ };
+ function defaultString(value, defaultDescription) {
+ let string = `[${__('default:')} `;
+ if (value === undefined && !defaultDescription)
+ return null;
+ if (defaultDescription) {
+ string += defaultDescription;
+ }
+ else {
+ switch (typeof value) {
+ case 'string':
+ string += `"${value}"`;
+ break;
+ case 'object':
+ string += JSON.stringify(value);
+ break;
+ default:
+ string += value;
+ }
+ }
+ return `${string}]`;
+ }
+ function windowWidth() {
+ const maxWidth = 80;
+ if (shim.process.stdColumns) {
+ return Math.min(maxWidth, shim.process.stdColumns);
+ }
+ else {
+ return maxWidth;
+ }
+ }
+ let version = null;
+ self.version = ver => {
+ version = ver;
+ };
+ self.showVersion = () => {
+ const logger = yargs._getLoggerInstance();
+ logger.log(version);
+ };
+ self.reset = function reset(localLookup) {
+ failMessage = null;
+ failureOutput = false;
+ usages = [];
+ usageDisabled = false;
+ epilogs = [];
+ examples = [];
+ commands = [];
+ descriptions = objFilter(descriptions, k => !localLookup[k]);
+ return self;
+ };
+ const frozens = [];
+ self.freeze = function freeze() {
+ frozens.push({
+ failMessage,
+ failureOutput,
+ usages,
+ usageDisabled,
+ epilogs,
+ examples,
+ commands,
+ descriptions,
+ });
+ };
+ self.unfreeze = function unfreeze() {
+ const frozen = frozens.pop();
+ assertNotStrictEqual(frozen, undefined, shim);
+ ({
+ failMessage,
+ failureOutput,
+ usages,
+ usageDisabled,
+ epilogs,
+ examples,
+ commands,
+ descriptions,
+ } = frozen);
+ };
+ return self;
+}
+function isIndentedText(text) {
+ return typeof text === 'object';
+}
+function addIndentation(text, indent) {
+ return isIndentedText(text)
+ ? { text: text.text, indentation: text.indentation + indent }
+ : { text, indentation: indent };
+}
+function getIndentation(text) {
+ return isIndentedText(text) ? text.indentation : 0;
+}
+function getText(text) {
+ return isIndentedText(text) ? text.text : text;
+}
+
+const completionShTemplate = `###-begin-{{app_name}}-completions-###
+#
+# yargs command completion script
+#
+# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
+# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
+#
+_yargs_completions()
+{
+ local cur_word args type_list
+
+ cur_word="\${COMP_WORDS[COMP_CWORD]}"
+ args=("\${COMP_WORDS[@]}")
+
+ # ask yargs to generate completions.
+ type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
+
+ COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
+
+ # if no match was found, fall back to filename completion
+ if [ \${#COMPREPLY[@]} -eq 0 ]; then
+ COMPREPLY=()
+ fi
+
+ return 0
+}
+complete -o default -F _yargs_completions {{app_name}}
+###-end-{{app_name}}-completions-###
+`;
+const completionZshTemplate = `###-begin-{{app_name}}-completions-###
+#
+# yargs command completion script
+#
+# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
+# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
+#
+_{{app_name}}_yargs_completions()
+{
+ local reply
+ local si=$IFS
+ IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
+ IFS=$si
+ _describe 'values' reply
+}
+compdef _{{app_name}}_yargs_completions {{app_name}}
+###-end-{{app_name}}-completions-###
+`;
+
+function completion(yargs, usage, command, shim) {
+ const self = {
+ completionKey: 'get-yargs-completions',
+ };
+ let aliases;
+ self.setParsed = function setParsed(parsed) {
+ aliases = parsed.aliases;
+ };
+ const zshShell = (shim.getEnv('SHELL') && shim.getEnv('SHELL').indexOf('zsh') !== -1) ||
+ (shim.getEnv('ZSH_NAME') && shim.getEnv('ZSH_NAME').indexOf('zsh') !== -1);
+ self.getCompletion = function getCompletion(args, done) {
+ const completions = [];
+ const current = args.length ? args[args.length - 1] : '';
+ const argv = yargs.parse(args, true);
+ const parentCommands = yargs.getContext().commands;
+ function runCompletionFunction(argv) {
+ assertNotStrictEqual(completionFunction, null, shim);
+ if (isSyncCompletionFunction(completionFunction)) {
+ const result = completionFunction(current, argv);
+ if (isPromise(result)) {
+ return result
+ .then(list => {
+ shim.process.nextTick(() => {
+ done(list);
+ });
+ })
+ .catch(err => {
+ shim.process.nextTick(() => {
+ throw err;
+ });
+ });
+ }
+ return done(result);
+ }
+ else {
+ return completionFunction(current, argv, completions => {
+ done(completions);
+ });
+ }
+ }
+ if (completionFunction) {
+ return isPromise(argv)
+ ? argv.then(runCompletionFunction)
+ : runCompletionFunction(argv);
+ }
+ const handlers = command.getCommandHandlers();
+ for (let i = 0, ii = args.length; i < ii; ++i) {
+ if (handlers[args[i]] && handlers[args[i]].builder) {
+ const builder = handlers[args[i]].builder;
+ if (isCommandBuilderCallback(builder)) {
+ const y = yargs.reset();
+ builder(y);
+ return y.argv;
+ }
+ }
+ }
+ if (!current.match(/^-/) &&
+ parentCommands[parentCommands.length - 1] !== current) {
+ usage.getCommands().forEach(usageCommand => {
+ const commandName = parseCommand(usageCommand[0]).cmd;
+ if (args.indexOf(commandName) === -1) {
+ if (!zshShell) {
+ completions.push(commandName);
+ }
+ else {
+ const desc = usageCommand[1] || '';
+ completions.push(commandName.replace(/:/g, '\\:') + ':' + desc);
+ }
+ }
+ });
+ }
+ if (current.match(/^-/) || (current === '' && completions.length === 0)) {
+ const descs = usage.getDescriptions();
+ const options = yargs.getOptions();
+ Object.keys(options.key).forEach(key => {
+ const negable = !!options.configuration['boolean-negation'] &&
+ options.boolean.includes(key);
+ let keyAndAliases = [key].concat(aliases[key] || []);
+ if (negable)
+ keyAndAliases = keyAndAliases.concat(keyAndAliases.map(key => `no-${key}`));
+ function completeOptionKey(key) {
+ const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1);
+ if (notInArgs) {
+ const startsByTwoDashes = (s) => /^--/.test(s);
+ const isShortOption = (s) => /^[^0-9]$/.test(s);
+ const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--';
+ if (!zshShell) {
+ completions.push(dashes + key);
+ }
+ else {
+ const desc = descs[key] || '';
+ completions.push(dashes +
+ `${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`);
+ }
+ }
+ }
+ completeOptionKey(key);
+ if (negable && !!options.default[key])
+ completeOptionKey(`no-${key}`);
+ });
+ }
+ done(completions);
+ };
+ self.generateCompletionScript = function generateCompletionScript($0, cmd) {
+ let script = zshShell
+ ? completionZshTemplate
+ : completionShTemplate;
+ const name = shim.path.basename($0);
+ if ($0.match(/\.js$/))
+ $0 = `./${$0}`;
+ script = script.replace(/{{app_name}}/g, name);
+ script = script.replace(/{{completion_command}}/g, cmd);
+ return script.replace(/{{app_path}}/g, $0);
+ };
+ let completionFunction = null;
+ self.registerFunction = fn => {
+ completionFunction = fn;
+ };
+ return self;
+}
+function isSyncCompletionFunction(completionFunction) {
+ return completionFunction.length < 3;
+}
+
+function levenshtein(a, b) {
+ if (a.length === 0)
+ return b.length;
+ if (b.length === 0)
+ return a.length;
+ const matrix = [];
+ let i;
+ for (i = 0; i <= b.length; i++) {
+ matrix[i] = [i];
+ }
+ let j;
+ for (j = 0; j <= a.length; j++) {
+ matrix[0][j] = j;
+ }
+ for (i = 1; i <= b.length; i++) {
+ for (j = 1; j <= a.length; j++) {
+ if (b.charAt(i - 1) === a.charAt(j - 1)) {
+ matrix[i][j] = matrix[i - 1][j - 1];
+ }
+ else {
+ matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, Math.min(matrix[i][j - 1] + 1, matrix[i - 1][j] + 1));
+ }
+ }
+ }
+ return matrix[b.length][a.length];
+}
+
+const specialKeys = ['$0', '--', '_'];
+function validation(yargs, usage, y18n, shim) {
+ const __ = y18n.__;
+ const __n = y18n.__n;
+ const self = {};
+ self.nonOptionCount = function nonOptionCount(argv) {
+ const demandedCommands = yargs.getDemandedCommands();
+ const positionalCount = argv._.length + (argv['--'] ? argv['--'].length : 0);
+ const _s = positionalCount - yargs.getContext().commands.length;
+ if (demandedCommands._ &&
+ (_s < demandedCommands._.min || _s > demandedCommands._.max)) {
+ if (_s < demandedCommands._.min) {
+ if (demandedCommands._.minMsg !== undefined) {
+ usage.fail(demandedCommands._.minMsg
+ ? demandedCommands._.minMsg
+ .replace(/\$0/g, _s.toString())
+ .replace(/\$1/, demandedCommands._.min.toString())
+ : null);
+ }
+ else {
+ usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s.toString(), demandedCommands._.min.toString()));
+ }
+ }
+ else if (_s > demandedCommands._.max) {
+ if (demandedCommands._.maxMsg !== undefined) {
+ usage.fail(demandedCommands._.maxMsg
+ ? demandedCommands._.maxMsg
+ .replace(/\$0/g, _s.toString())
+ .replace(/\$1/, demandedCommands._.max.toString())
+ : null);
+ }
+ else {
+ usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s.toString(), demandedCommands._.max.toString()));
+ }
+ }
+ }
+ };
+ self.positionalCount = function positionalCount(required, observed) {
+ if (observed < required) {
+ usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed + '', required + ''));
+ }
+ };
+ self.requiredArguments = function requiredArguments(argv) {
+ const demandedOptions = yargs.getDemandedOptions();
+ let missing = null;
+ for (const key of Object.keys(demandedOptions)) {
+ if (!Object.prototype.hasOwnProperty.call(argv, key) ||
+ typeof argv[key] === 'undefined') {
+ missing = missing || {};
+ missing[key] = demandedOptions[key];
+ }
+ }
+ if (missing) {
+ const customMsgs = [];
+ for (const key of Object.keys(missing)) {
+ const msg = missing[key];
+ if (msg && customMsgs.indexOf(msg) < 0) {
+ customMsgs.push(msg);
+ }
+ }
+ const customMsg = customMsgs.length ? `\n${customMsgs.join('\n')}` : '';
+ usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg));
+ }
+ };
+ self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) {
+ const commandKeys = yargs.getCommandInstance().getCommands();
+ const unknown = [];
+ const currentContext = yargs.getContext();
+ Object.keys(argv).forEach(key => {
+ if (specialKeys.indexOf(key) === -1 &&
+ !Object.prototype.hasOwnProperty.call(positionalMap, key) &&
+ !Object.prototype.hasOwnProperty.call(yargs._getParseContext(), key) &&
+ !self.isValidAndSomeAliasIsNotNew(key, aliases)) {
+ unknown.push(key);
+ }
+ });
+ if (checkPositionals &&
+ (currentContext.commands.length > 0 ||
+ commandKeys.length > 0 ||
+ isDefaultCommand)) {
+ argv._.slice(currentContext.commands.length).forEach(key => {
+ if (commandKeys.indexOf('' + key) === -1) {
+ unknown.push('' + key);
+ }
+ });
+ }
+ if (unknown.length > 0) {
+ usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.join(', ')));
+ }
+ };
+ self.unknownCommands = function unknownCommands(argv) {
+ const commandKeys = yargs.getCommandInstance().getCommands();
+ const unknown = [];
+ const currentContext = yargs.getContext();
+ if (currentContext.commands.length > 0 || commandKeys.length > 0) {
+ argv._.slice(currentContext.commands.length).forEach(key => {
+ if (commandKeys.indexOf('' + key) === -1) {
+ unknown.push('' + key);
+ }
+ });
+ }
+ if (unknown.length > 0) {
+ usage.fail(__n('Unknown command: %s', 'Unknown commands: %s', unknown.length, unknown.join(', ')));
+ return true;
+ }
+ else {
+ return false;
+ }
+ };
+ self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) {
+ if (!Object.prototype.hasOwnProperty.call(aliases, key)) {
+ return false;
+ }
+ const newAliases = yargs.parsed.newAliases;
+ for (const a of [key, ...aliases[key]]) {
+ if (!Object.prototype.hasOwnProperty.call(newAliases, a) ||
+ !newAliases[key]) {
+ return true;
+ }
+ }
+ return false;
+ };
+ self.limitedChoices = function limitedChoices(argv) {
+ const options = yargs.getOptions();
+ const invalid = {};
+ if (!Object.keys(options.choices).length)
+ return;
+ Object.keys(argv).forEach(key => {
+ if (specialKeys.indexOf(key) === -1 &&
+ Object.prototype.hasOwnProperty.call(options.choices, key)) {
+ [].concat(argv[key]).forEach(value => {
+ if (options.choices[key].indexOf(value) === -1 &&
+ value !== undefined) {
+ invalid[key] = (invalid[key] || []).concat(value);
+ }
+ });
+ }
+ });
+ const invalidKeys = Object.keys(invalid);
+ if (!invalidKeys.length)
+ return;
+ let msg = __('Invalid values:');
+ invalidKeys.forEach(key => {
+ msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`;
+ });
+ usage.fail(msg);
+ };
+ let checks = [];
+ self.check = function check(f, global) {
+ checks.push({
+ func: f,
+ global,
+ });
+ };
+ self.customChecks = function customChecks(argv, aliases) {
+ for (let i = 0, f; (f = checks[i]) !== undefined; i++) {
+ const func = f.func;
+ let result = null;
+ try {
+ result = func(argv, aliases);
+ }
+ catch (err) {
+ usage.fail(err.message ? err.message : err, err);
+ continue;
+ }
+ if (!result) {
+ usage.fail(__('Argument check failed: %s', func.toString()));
+ }
+ else if (typeof result === 'string' || result instanceof Error) {
+ usage.fail(result.toString(), result);
+ }
+ }
+ };
+ let implied = {};
+ self.implies = function implies(key, value) {
+ argsert(' [array|number|string]', [key, value], arguments.length);
+ if (typeof key === 'object') {
+ Object.keys(key).forEach(k => {
+ self.implies(k, key[k]);
+ });
+ }
+ else {
+ yargs.global(key);
+ if (!implied[key]) {
+ implied[key] = [];
+ }
+ if (Array.isArray(value)) {
+ value.forEach(i => self.implies(key, i));
+ }
+ else {
+ assertNotStrictEqual(value, undefined, shim);
+ implied[key].push(value);
+ }
+ }
+ };
+ self.getImplied = function getImplied() {
+ return implied;
+ };
+ function keyExists(argv, val) {
+ const num = Number(val);
+ val = isNaN(num) ? val : num;
+ if (typeof val === 'number') {
+ val = argv._.length >= val;
+ }
+ else if (val.match(/^--no-.+/)) {
+ val = val.match(/^--no-(.+)/)[1];
+ val = !argv[val];
+ }
+ else {
+ val = argv[val];
+ }
+ return val;
+ }
+ self.implications = function implications(argv) {
+ const implyFail = [];
+ Object.keys(implied).forEach(key => {
+ const origKey = key;
+ (implied[key] || []).forEach(value => {
+ let key = origKey;
+ const origValue = value;
+ key = keyExists(argv, key);
+ value = keyExists(argv, value);
+ if (key && !value) {
+ implyFail.push(` ${origKey} -> ${origValue}`);
+ }
+ });
+ });
+ if (implyFail.length) {
+ let msg = `${__('Implications failed:')}\n`;
+ implyFail.forEach(value => {
+ msg += value;
+ });
+ usage.fail(msg);
+ }
+ };
+ let conflicting = {};
+ self.conflicts = function conflicts(key, value) {
+ argsert(' [array|string]', [key, value], arguments.length);
+ if (typeof key === 'object') {
+ Object.keys(key).forEach(k => {
+ self.conflicts(k, key[k]);
+ });
+ }
+ else {
+ yargs.global(key);
+ if (!conflicting[key]) {
+ conflicting[key] = [];
+ }
+ if (Array.isArray(value)) {
+ value.forEach(i => self.conflicts(key, i));
+ }
+ else {
+ conflicting[key].push(value);
+ }
+ }
+ };
+ self.getConflicting = () => conflicting;
+ self.conflicting = function conflictingFn(argv) {
+ Object.keys(argv).forEach(key => {
+ if (conflicting[key]) {
+ conflicting[key].forEach(value => {
+ if (value && argv[key] !== undefined && argv[value] !== undefined) {
+ usage.fail(__('Arguments %s and %s are mutually exclusive', key, value));
+ }
+ });
+ }
+ });
+ };
+ self.recommendCommands = function recommendCommands(cmd, potentialCommands) {
+ const threshold = 3;
+ potentialCommands = potentialCommands.sort((a, b) => b.length - a.length);
+ let recommended = null;
+ let bestDistance = Infinity;
+ for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
+ const d = levenshtein(cmd, candidate);
+ if (d <= threshold && d < bestDistance) {
+ bestDistance = d;
+ recommended = candidate;
+ }
+ }
+ if (recommended)
+ usage.fail(__('Did you mean %s?', recommended));
+ };
+ self.reset = function reset(localLookup) {
+ implied = objFilter(implied, k => !localLookup[k]);
+ conflicting = objFilter(conflicting, k => !localLookup[k]);
+ checks = checks.filter(c => c.global);
+ return self;
+ };
+ const frozens = [];
+ self.freeze = function freeze() {
+ frozens.push({
+ implied,
+ checks,
+ conflicting,
+ });
+ };
+ self.unfreeze = function unfreeze() {
+ const frozen = frozens.pop();
+ assertNotStrictEqual(frozen, undefined, shim);
+ ({ implied, checks, conflicting } = frozen);
+ };
+ return self;
+}
+
+let shim$1;
+function YargsWithShim(_shim) {
+ shim$1 = _shim;
+ return Yargs;
+}
+function Yargs(processArgs = [], cwd = shim$1.process.cwd(), parentRequire) {
+ const self = {};
+ let command$1;
+ let completion$1 = null;
+ let groups = {};
+ const globalMiddleware = [];
+ let output = '';
+ const preservedGroups = {};
+ let usage$1;
+ let validation$1;
+ let handlerFinishCommand = null;
+ const y18n = shim$1.y18n;
+ self.middleware = globalMiddlewareFactory(globalMiddleware, self);
+ self.scriptName = function (scriptName) {
+ self.customScriptName = true;
+ self.$0 = scriptName;
+ return self;
+ };
+ let default$0;
+ if (/\b(node|iojs|electron)(\.exe)?$/.test(shim$1.process.argv()[0])) {
+ default$0 = shim$1.process.argv().slice(1, 2);
+ }
+ else {
+ default$0 = shim$1.process.argv().slice(0, 1);
+ }
+ self.$0 = default$0
+ .map(x => {
+ const b = rebase(cwd, x);
+ return x.match(/^(\/|([a-zA-Z]:)?\\)/) && b.length < x.length ? b : x;
+ })
+ .join(' ')
+ .trim();
+ if (shim$1.getEnv('_') && shim$1.getProcessArgvBin() === shim$1.getEnv('_')) {
+ self.$0 = shim$1
+ .getEnv('_')
+ .replace(`${shim$1.path.dirname(shim$1.process.execPath())}/`, '');
+ }
+ const context = { resets: -1, commands: [], fullCommands: [], files: [] };
+ self.getContext = () => context;
+ let hasOutput = false;
+ let exitError = null;
+ self.exit = (code, err) => {
+ hasOutput = true;
+ exitError = err;
+ if (exitProcess)
+ shim$1.process.exit(code);
+ };
+ let completionCommand = null;
+ self.completion = function (cmd, desc, fn) {
+ argsert('[string] [string|boolean|function] [function]', [cmd, desc, fn], arguments.length);
+ if (typeof desc === 'function') {
+ fn = desc;
+ desc = undefined;
+ }
+ completionCommand = cmd || completionCommand || 'completion';
+ if (!desc && desc !== false) {
+ desc = 'generate completion script';
+ }
+ self.command(completionCommand, desc);
+ if (fn)
+ completion$1.registerFunction(fn);
+ return self;
+ };
+ let options;
+ self.resetOptions = self.reset = function resetOptions(aliases = {}) {
+ context.resets++;
+ options = options || {};
+ const tmpOptions = {};
+ tmpOptions.local = options.local ? options.local : [];
+ tmpOptions.configObjects = options.configObjects
+ ? options.configObjects
+ : [];
+ const localLookup = {};
+ tmpOptions.local.forEach(l => {
+ localLookup[l] = true;
+ (aliases[l] || []).forEach(a => {
+ localLookup[a] = true;
+ });
+ });
+ Object.assign(preservedGroups, Object.keys(groups).reduce((acc, groupName) => {
+ const keys = groups[groupName].filter(key => !(key in localLookup));
+ if (keys.length > 0) {
+ acc[groupName] = keys;
+ }
+ return acc;
+ }, {}));
+ groups = {};
+ const arrayOptions = [
+ 'array',
+ 'boolean',
+ 'string',
+ 'skipValidation',
+ 'count',
+ 'normalize',
+ 'number',
+ 'hiddenOptions',
+ ];
+ const objectOptions = [
+ 'narg',
+ 'key',
+ 'alias',
+ 'default',
+ 'defaultDescription',
+ 'config',
+ 'choices',
+ 'demandedOptions',
+ 'demandedCommands',
+ 'coerce',
+ 'deprecatedOptions',
+ ];
+ arrayOptions.forEach(k => {
+ tmpOptions[k] = (options[k] || []).filter((k) => !localLookup[k]);
+ });
+ objectOptions.forEach((k) => {
+ tmpOptions[k] = objFilter(options[k], k => !localLookup[k]);
+ });
+ tmpOptions.envPrefix = options.envPrefix;
+ options = tmpOptions;
+ usage$1 = usage$1 ? usage$1.reset(localLookup) : usage(self, y18n, shim$1);
+ validation$1 = validation$1
+ ? validation$1.reset(localLookup)
+ : validation(self, usage$1, y18n, shim$1);
+ command$1 = command$1
+ ? command$1.reset()
+ : command(self, usage$1, validation$1, globalMiddleware, shim$1);
+ if (!completion$1)
+ completion$1 = completion(self, usage$1, command$1, shim$1);
+ completionCommand = null;
+ output = '';
+ exitError = null;
+ hasOutput = false;
+ self.parsed = false;
+ return self;
+ };
+ self.resetOptions();
+ const frozens = [];
+ function freeze() {
+ frozens.push({
+ options,
+ configObjects: options.configObjects.slice(0),
+ exitProcess,
+ groups,
+ strict,
+ strictCommands,
+ strictOptions,
+ completionCommand,
+ output,
+ exitError,
+ hasOutput,
+ parsed: self.parsed,
+ parseFn,
+ parseContext,
+ handlerFinishCommand,
+ });
+ usage$1.freeze();
+ validation$1.freeze();
+ command$1.freeze();
+ }
+ function unfreeze() {
+ const frozen = frozens.pop();
+ assertNotStrictEqual(frozen, undefined, shim$1);
+ let configObjects;
+ ({
+ options,
+ configObjects,
+ exitProcess,
+ groups,
+ output,
+ exitError,
+ hasOutput,
+ parsed: self.parsed,
+ strict,
+ strictCommands,
+ strictOptions,
+ completionCommand,
+ parseFn,
+ parseContext,
+ handlerFinishCommand,
+ } = frozen);
+ options.configObjects = configObjects;
+ usage$1.unfreeze();
+ validation$1.unfreeze();
+ command$1.unfreeze();
+ }
+ self.boolean = function (keys) {
+ argsert('', [keys], arguments.length);
+ populateParserHintArray('boolean', keys);
+ return self;
+ };
+ self.array = function (keys) {
+ argsert('', [keys], arguments.length);
+ populateParserHintArray('array', keys);
+ return self;
+ };
+ self.number = function (keys) {
+ argsert('', [keys], arguments.length);
+ populateParserHintArray('number', keys);
+ return self;
+ };
+ self.normalize = function (keys) {
+ argsert('', [keys], arguments.length);
+ populateParserHintArray('normalize', keys);
+ return self;
+ };
+ self.count = function (keys) {
+ argsert('', [keys], arguments.length);
+ populateParserHintArray('count', keys);
+ return self;
+ };
+ self.string = function (keys) {
+ argsert('', [keys], arguments.length);
+ populateParserHintArray('string', keys);
+ return self;
+ };
+ self.requiresArg = function (keys) {
+ argsert(' [number]', [keys], arguments.length);
+ if (typeof keys === 'string' && options.narg[keys]) {
+ return self;
+ }
+ else {
+ populateParserHintSingleValueDictionary(self.requiresArg, 'narg', keys, NaN);
+ }
+ return self;
+ };
+ self.skipValidation = function (keys) {
+ argsert('', [keys], arguments.length);
+ populateParserHintArray('skipValidation', keys);
+ return self;
+ };
+ function populateParserHintArray(type, keys) {
+ keys = [].concat(keys);
+ keys.forEach(key => {
+ key = sanitizeKey(key);
+ options[type].push(key);
+ });
+ }
+ self.nargs = function (key, value) {
+ argsert(' [number]', [key, value], arguments.length);
+ populateParserHintSingleValueDictionary(self.nargs, 'narg', key, value);
+ return self;
+ };
+ self.choices = function (key, value) {
+ argsert('