"],_default:[0,"",""]};function ut(t,e){var i;return i=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&A(t,e)?v.merge([t],i):i}function dt(t,e){for(var i=0,n=t.length;i-1)r&&r.push(s);else if(h=v.contains(s.ownerDocument,s),o=ut(u.appendChild(s),"script"),h&&dt(o),i)for(c=0;s=o[c++];)ht.test(s.type||"")&&i.push(s);return u}!function(){var t=e.createDocumentFragment().appendChild(e.createElement("div")),i=e.createElement("input");i.setAttribute("type","radio"),i.setAttribute("checked","checked"),i.setAttribute("name","t"),t.appendChild(i),d.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",d.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var gt=e.documentElement,mt=/^key/,bt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,yt=/^([^.]*)(?:\.(.+)|)/;function vt(){return!0}function wt(){return!1}function _t(){try{return e.activeElement}catch(t){}}function xt(t,e,i,n,r,s){var o,a;if("object"==typeof e){for(a in"string"!=typeof i&&(n=n||i,i=void 0),e)xt(t,a,i,n,e[a],s);return t}if(null==n&&null==r?(r=i,n=i=void 0):null==r&&("string"==typeof i?(r=n,n=void 0):(r=n,n=i,i=void 0)),!1===r)r=wt;else if(!r)return t;return 1===s&&(o=r,r=function(t){return v().off(t),o.apply(this,arguments)},r.guid=o.guid||(o.guid=v.guid++)),t.each((function(){v.event.add(this,e,r,n,i)}))}v.event={global:{},add:function(t,e,i,n,r){var s,o,a,l,h,c,u,d,f,p,g,m=Z.get(t);if(m)for(i.handler&&(i=(s=i).handler,r=s.selector),r&&v.find.matchesSelector(gt,r),i.guid||(i.guid=v.guid++),(l=m.events)||(l=m.events={}),(o=m.handle)||(o=m.handle=function(e){return void 0!==v&&v.event.triggered!==e.type?v.event.dispatch.apply(t,arguments):void 0}),h=(e=(e||"").match(N)||[""]).length;h--;)f=g=(a=yt.exec(e[h])||[])[1],p=(a[2]||"").split(".").sort(),f&&(u=v.event.special[f]||{},f=(r?u.delegateType:u.bindType)||f,u=v.event.special[f]||{},c=v.extend({type:f,origType:g,data:n,handler:i,guid:i.guid,selector:r,needsContext:r&&v.expr.match.needsContext.test(r),namespace:p.join(".")},s),(d=l[f])||((d=l[f]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(t,n,p,o)||t.addEventListener&&t.addEventListener(f,o)),u.add&&(u.add.call(t,c),c.handler.guid||(c.handler.guid=i.guid)),r?d.splice(d.delegateCount++,0,c):d.push(c),v.event.global[f]=!0)},remove:function(t,e,i,n,r){var s,o,a,l,h,c,u,d,f,p,g,m=Z.hasData(t)&&Z.get(t);if(m&&(l=m.events)){for(h=(e=(e||"").match(N)||[""]).length;h--;)if(f=g=(a=yt.exec(e[h])||[])[1],p=(a[2]||"").split(".").sort(),f){for(u=v.event.special[f]||{},d=l[f=(n?u.delegateType:u.bindType)||f]||[],a=a[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=d.length;s--;)c=d[s],!r&&g!==c.origType||i&&i.guid!==c.guid||a&&!a.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(d.splice(s,1),c.selector&&d.delegateCount--,u.remove&&u.remove.call(t,c));o&&!d.length&&(u.teardown&&!1!==u.teardown.call(t,p,m.handle)||v.removeEvent(t,f,m.handle),delete l[f])}else for(f in l)v.event.remove(t,f+e[h],i,n,!0);v.isEmptyObject(l)&&Z.remove(t,"handle events")}},dispatch:function(t){var e,i,n,r,s,o,a=v.event.fix(t),l=new Array(arguments.length),h=(Z.get(this,"events")||{})[a.type]||[],c=v.event.special[a.type]||{};for(l[0]=a,e=1;e=1))for(;h!==this;h=h.parentNode||this)if(1===h.nodeType&&("click"!==t.type||!0!==h.disabled)){for(s=[],o={},i=0;i-1:v.find(r,this,null,[h]).length),o[r]&&s.push(n);s.length&&a.push({elem:h,handlers:s})}return h=this,l\x20\t\r\n\f]*)[^>]*)\/>/gi,St=/";
+const handler = new DomHandler((error, dom) => {
+ if (error) {
+ // Handle error
+ } else {
+ // Parsing completed, do something
+ console.log(dom);
+ }
+});
+const parser = new Parser(handler);
+parser.write(rawHtml);
+parser.end();
+```
+
+Output:
+
+```javascript
+[
+ {
+ data: "Xyz ",
+ type: "text",
+ },
+ {
+ type: "script",
+ name: "script",
+ attribs: {
+ language: "javascript",
+ },
+ children: [
+ {
+ data: "var foo = '';<",
+ type: "text",
+ },
+ ],
+ },
+ {
+ data: "`.
+
+### Preserving SVG tags
+
+SVG tags are automatically recognized, and when they are minified, both case-sensitivity and closing-slashes are preserved, regardless of the minification settings used for the rest of the file.
+
+### Working with invalid markup
+
+HTMLMinifier **can't work with invalid or partial chunks of markup**. This is because it parses markup into a tree structure, then modifies it (removing anything that was specified for removal, ignoring anything that was specified to be ignored, etc.), then it creates a markup out of that tree and returns it.
+
+Input markup (e.g. `
foo`)
+
+↓
+
+Internal representation of markup in a form of tree (e.g. `{ tag: "p", attr: "id", children: ["foo"] }`)
+
+↓
+
+Transformation of internal representation (e.g. removal of `id` attribute)
+
+↓
+
+Output of resulting markup (e.g. `
foo
`)
+
+HTMLMinifier can't know that original markup was only half of the tree; it does its best to try to parse it as a full tree and it loses information about tree being malformed or partial in the beginning. As a result, it can't create a partial/malformed tree at the time of the output.
+
+## Installation Instructions
+
+From NPM for use as a command line app:
+
+```shell
+npm install html-minifier-terser -g
+```
+
+From NPM for programmatic use:
+
+```shell
+npm install html-minifier-terser
+```
+
+From Git:
+
+```shell
+git clone git://github.com/terser/html-minifier-terser.git
+cd html-minifier-terser
+npm link .
+```
+
+## Usage
+
+Note that almost all options are disabled by default. For command line usage please see `html-minifier-terser --help` for a list of available options. Experiment and find what works best for you and your project.
+
+- **Sample command line:** `html-minifier-terser --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-tag-whitespace --use-short-doctype --minify-css true --minify-js true`
+
+### Node.js
+
+```js
+const { minify } = require('html-minifier-terser');
+
+const result = await minify('
'
+```
+
+## Running benchmarks
+
+Benchmarks for minified HTML:
+
+```shell
+node benchmark.js
+```
+
+## Running local server
+
+```shell
+npm run serve
+```
diff --git a/igv_component/node_modules/html-minifier-terser/cli.js b/igv_component/node_modules/html-minifier-terser/cli.js
new file mode 100644
index 0000000000000000000000000000000000000000..054d81fd590fabd5cedf35916e9162f1ef4635c6
--- /dev/null
+++ b/igv_component/node_modules/html-minifier-terser/cli.js
@@ -0,0 +1,315 @@
+#!/usr/bin/env node
+/**
+ * html-minifier-terser CLI tool
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2016 Zoltan Frombach
+ *
+ * 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.
+ *
+ */
+
+'use strict';
+
+var camelCase = require('camel-case').camelCase;
+var fs = require('fs');
+var info = require('./package.json');
+var minify = require('./' + info.main).minify;
+var paramCase = require('param-case').paramCase;
+var path = require('path');
+var { Command } = require('commander');
+
+const program = new Command();
+program.name(info.name);
+program.version(info.version);
+
+function fatal(message) {
+ console.error(message);
+ process.exit(1);
+}
+
+/**
+ * JSON does not support regexes, so, e.g., JSON.parse() will not create
+ * a RegExp from the JSON value `[ "/matchString/" ]`, which is
+ * technically just an array containing a string that begins and end with
+ * a forward slash. To get a RegExp from a JSON string, it must be
+ * constructed explicitly in JavaScript.
+ *
+ * The likelihood of actually wanting to match text that is enclosed in
+ * forward slashes is probably quite rare, so if forward slashes were
+ * included in an argument that requires a regex, the user most likely
+ * thought they were part of the syntax for specifying a regex.
+ *
+ * In the unlikely case that forward slashes are indeed desired in the
+ * search string, the user would need to enclose the expression in a
+ * second set of slashes:
+ *
+ * --customAttrSrround "[\"//matchString//\"]"
+ */
+function parseRegExp(value) {
+ if (value) {
+ return new RegExp(value.replace(/^\/(.*)\/$/, '$1'));
+ }
+}
+
+function parseJSON(value) {
+ if (value) {
+ try {
+ return JSON.parse(value);
+ }
+ catch (e) {
+ if (/^{/.test(value)) {
+ fatal('Could not parse JSON value \'' + value + '\'');
+ }
+ return value;
+ }
+ }
+}
+
+function parseJSONArray(value) {
+ if (value) {
+ value = parseJSON(value);
+ return Array.isArray(value) ? value : [value];
+ }
+}
+
+function parseJSONRegExpArray(value) {
+ value = parseJSONArray(value);
+ return value && value.map(parseRegExp);
+}
+
+function parseString(value) {
+ return value;
+}
+
+var mainOptions = {
+ caseSensitive: 'Treat attributes in case sensitive manner (useful for SVG; e.g. viewBox)',
+ collapseBooleanAttributes: 'Omit attribute values from boolean attributes',
+ collapseInlineTagWhitespace: 'Collapse white space around inline tag',
+ collapseWhitespace: 'Collapse white space that contributes to text nodes in a document tree.',
+ conservativeCollapse: 'Always collapse to 1 space (never remove it entirely)',
+ continueOnParseError: 'Handle parse errors instead of aborting',
+ customAttrAssign: ['Arrays of regex\'es that allow to support custom attribute assign expressions (e.g. \'\')', parseJSONRegExpArray],
+ customAttrCollapse: ['Regex that specifies custom attribute to strip newlines from (e.g. /ng-class/)', parseRegExp],
+ customAttrSurround: ['Arrays of regex\'es that allow to support custom attribute surround expressions (e.g. )', parseJSONRegExpArray],
+ customEventAttributes: ['Arrays of regex\'es that allow to support custom event attributes for minifyJS (e.g. ng-click)', parseJSONRegExpArray],
+ decodeEntities: 'Use direct Unicode characters whenever possible',
+ html5: 'Parse input according to HTML5 specifications',
+ ignoreCustomComments: ['Array of regex\'es that allow to ignore certain comments, when matched', parseJSONRegExpArray],
+ ignoreCustomFragments: ['Array of regex\'es that allow to ignore certain fragments, when matched (e.g. , {{ ... }})', parseJSONRegExpArray],
+ includeAutoGeneratedTags: 'Insert tags generated by HTML parser',
+ keepClosingSlash: 'Keep the trailing slash on singleton elements',
+ maxLineLength: ['Max line length', parseInt],
+ minifyCSS: ['Minify CSS in style elements and style attributes (uses clean-css)', parseJSON],
+ minifyJS: ['Minify Javascript in script elements and on* attributes (uses terser)', parseJSON],
+ minifyURLs: ['Minify URLs in various attributes (uses relateurl)', parseJSON],
+ noNewlinesBeforeTagClose: 'Never add a newline before a tag that closes an element',
+ preserveLineBreaks: 'Always collapse to 1 line break (never remove it entirely) when whitespace between tags include a line break.',
+ preventAttributesEscaping: 'Prevents the escaping of the values of attributes.',
+ processConditionalComments: 'Process contents of conditional comments through minifier',
+ processScripts: ['Array of strings corresponding to types of script elements to process through minifier (e.g. "text/ng-template", "text/x-handlebars-template", etc.)', parseJSONArray],
+ quoteCharacter: ['Type of quote to use for attribute values (\' or ")', parseString],
+ removeAttributeQuotes: 'Remove quotes around attributes when possible.',
+ removeComments: 'Strip HTML comments',
+ removeEmptyAttributes: 'Remove all attributes with whitespace-only values',
+ removeEmptyElements: 'Remove all elements with empty contents',
+ removeOptionalTags: 'Remove unrequired tags',
+ removeRedundantAttributes: 'Remove attributes when value matches default.',
+ removeScriptTypeAttributes: 'Removes the following attributes from script tags: text/javascript, text/ecmascript, text/jscript, application/javascript, application/x-javascript, application/ecmascript. Other type attribute values are left intact',
+ removeStyleLinkTypeAttributes: 'Remove type="text/css" from style and link tags. Other type attribute values are left intact.',
+ removeTagWhitespace: 'Remove space between attributes whenever possible',
+ sortAttributes: 'Sort attributes by frequency',
+ sortClassName: 'Sort style classes by frequency',
+ trimCustomFragments: 'Trim white space around ignoreCustomFragments.',
+ useShortDoctype: 'Replaces the doctype with the short (HTML5) doctype'
+};
+var mainOptionKeys = Object.keys(mainOptions);
+mainOptionKeys.forEach(function(key) {
+ var option = mainOptions[key];
+ if (Array.isArray(option)) {
+ key = key === 'minifyURLs' ? '--minify-urls' : '--' + paramCase(key);
+ key += option[1] === parseJSON ? ' [value]' : ' ';
+ program.option(key, option[0], option[1]);
+ }
+ else if (~['html5', 'includeAutoGeneratedTags'].indexOf(key)) {
+ program.option('--no-' + paramCase(key), option);
+ }
+ else {
+ program.option('--' + paramCase(key), option);
+ }
+});
+program.option('-o --output ', 'Specify output file (if not specified STDOUT will be used for output)');
+
+function readFile(file) {
+ try {
+ return fs.readFileSync(file, { encoding: 'utf8' });
+ }
+ catch (e) {
+ fatal('Cannot read ' + file + '\n' + e.message);
+ }
+}
+
+var config = {};
+program.option('-c --config-file ', 'Use config file', function(configPath) {
+ var data = readFile(configPath);
+ try {
+ config = JSON.parse(data);
+ }
+ catch (je) {
+ try {
+ config = require(path.resolve(configPath));
+ }
+ catch (ne) {
+ fatal('Cannot read the specified config file.\nAs JSON: ' + je.message + '\nAs module: ' + ne.message);
+ }
+ }
+ mainOptionKeys.forEach(function(key) {
+ if (key in config) {
+ var option = mainOptions[key];
+ if (Array.isArray(option)) {
+ var value = config[key];
+ config[key] = option[1](typeof value === 'string' ? value : JSON.stringify(value));
+ }
+ }
+ });
+});
+program.option('--input-dir ', 'Specify an input directory');
+program.option('--output-dir ', 'Specify an output directory');
+program.option('--file-ext ', 'Specify an extension to be read, ex: html');
+var content;
+program.arguments('[files...]').action(function(files) {
+ content = files.map(readFile).join('');
+}).parse(process.argv);
+
+const programOptions = program.opts();
+
+function createOptions() {
+ var options = {};
+ mainOptionKeys.forEach(function(key) {
+ var param = programOptions[key === 'minifyURLs' ? 'minifyUrls' : camelCase(key)];
+ if (typeof param !== 'undefined') {
+ options[key] = param;
+ }
+ else if (key in config) {
+ options[key] = config[key];
+ }
+ });
+ return options;
+}
+
+function mkdir(outputDir, callback) {
+ fs.mkdir(outputDir, function(err) {
+ if (err) {
+ switch (err.code) {
+ case 'ENOENT':
+ return mkdir(path.join(outputDir, '..'), function() {
+ mkdir(outputDir, callback);
+ });
+ case 'EEXIST':
+ break;
+ default:
+ fatal('Cannot create directory ' + outputDir + '\n' + err.message);
+ }
+ }
+ callback();
+ });
+}
+
+function processFile(inputFile, outputFile) {
+ fs.readFile(inputFile, { encoding: 'utf8' }, async function(err, data) {
+ if (err) {
+ fatal('Cannot read ' + inputFile + '\n' + err.message);
+ }
+ var minified;
+ try {
+ minified = await minify(data, createOptions());
+ }
+ catch (e) {
+ fatal('Minification error on ' + inputFile + '\n' + e.message);
+ }
+ fs.writeFile(outputFile, minified, { encoding: 'utf8' }, function(err) {
+ if (err) {
+ fatal('Cannot write ' + outputFile + '\n' + err.message);
+ }
+ });
+ });
+}
+
+function processDirectory(inputDir, outputDir, fileExt) {
+ fs.readdir(inputDir, function(err, files) {
+ if (err) {
+ fatal('Cannot read directory ' + inputDir + '\n' + err.message);
+ }
+ files.forEach(function(file) {
+ var inputFile = path.join(inputDir, file);
+ var outputFile = path.join(outputDir, file);
+ fs.stat(inputFile, function(err, stat) {
+ if (err) {
+ fatal('Cannot read ' + inputFile + '\n' + err.message);
+ }
+ else if (stat.isDirectory()) {
+ processDirectory(inputFile, outputFile, fileExt);
+ }
+ else if (!fileExt || path.extname(file) === '.' + fileExt) {
+ mkdir(outputDir, function() {
+ processFile(inputFile, outputFile);
+ });
+ }
+ });
+ });
+ });
+}
+
+async function writeMinify() {
+ var minified;
+ try {
+ minified = await minify(content, createOptions());
+ }
+ catch (e) {
+ fatal('Minification error:\n' + e.message);
+ }
+ (programOptions.output ? fs.createWriteStream(programOptions.output).on('error', function(e) {
+ fatal('Cannot write ' + programOptions.output + '\n' + e.message);
+ }) : process.stdout).write(minified);
+}
+
+var inputDir = programOptions.inputDir;
+var outputDir = programOptions.outputDir;
+var fileExt = programOptions.fileExt;
+if (inputDir || outputDir) {
+ if (!inputDir) {
+ fatal('The option output-dir needs to be used with the option input-dir. If you are working with a single file, use -o.');
+ }
+ else if (!outputDir) {
+ fatal('You need to specify where to write the output files with the option --output-dir');
+ }
+ processDirectory(inputDir, outputDir, fileExt);
+}
+// Minifying one or more files specified on the CMD line
+else if (content) {
+ writeMinify();
+}
+// Minifying input coming from STDIN
+else {
+ content = '';
+ process.stdin.setEncoding('utf8');
+ process.stdin.on('data', function(data) {
+ content += data;
+ }).on('end', writeMinify);
+}
diff --git a/igv_component/node_modules/html-minifier-terser/node_modules/commander/LICENSE b/igv_component/node_modules/html-minifier-terser/node_modules/commander/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..10f997ab104594695189c3fca8fa6c65ae9ccdd6
--- /dev/null
+++ b/igv_component/node_modules/html-minifier-terser/node_modules/commander/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2011 TJ Holowaychuk
+
+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/igv_component/node_modules/html-minifier-terser/node_modules/commander/Readme.md b/igv_component/node_modules/html-minifier-terser/node_modules/commander/Readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..9a2ab9500874c02ad3e16d0a61ef05122db30fd5
--- /dev/null
+++ b/igv_component/node_modules/html-minifier-terser/node_modules/commander/Readme.md
@@ -0,0 +1,1015 @@
+# Commander.js
+
+[![Build Status](https://github.com/tj/commander.js/workflows/build/badge.svg)](https://github.com/tj/commander.js/actions?query=workflow%3A%22build%22)
+[![NPM Version](http://img.shields.io/npm/v/commander.svg?style=flat)](https://www.npmjs.org/package/commander)
+[![NPM Downloads](https://img.shields.io/npm/dm/commander.svg?style=flat)](https://npmcharts.com/compare/commander?minimal=true)
+[![Install Size](https://packagephobia.now.sh/badge?p=commander)](https://packagephobia.now.sh/result?p=commander)
+
+The complete solution for [node.js](http://nodejs.org) command-line interfaces.
+
+Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
+
+- [Commander.js](#commanderjs)
+ - [Installation](#installation)
+ - [Declaring _program_ variable](#declaring-program-variable)
+ - [Options](#options)
+ - [Common option types, boolean and value](#common-option-types-boolean-and-value)
+ - [Default option value](#default-option-value)
+ - [Other option types, negatable boolean and boolean|value](#other-option-types-negatable-boolean-and-booleanvalue)
+ - [Required option](#required-option)
+ - [Variadic option](#variadic-option)
+ - [Version option](#version-option)
+ - [More configuration](#more-configuration)
+ - [Custom option processing](#custom-option-processing)
+ - [Commands](#commands)
+ - [Command-arguments](#command-arguments)
+ - [More configuration](#more-configuration-1)
+ - [Custom argument processing](#custom-argument-processing)
+ - [Action handler](#action-handler)
+ - [Stand-alone executable (sub)commands](#stand-alone-executable-subcommands)
+ - [Life cycle hooks](#life-cycle-hooks)
+ - [Automated help](#automated-help)
+ - [Custom help](#custom-help)
+ - [Display help after errors](#display-help-after-errors)
+ - [Display help from code](#display-help-from-code)
+ - [.usage and .name](#usage-and-name)
+ - [.helpOption(flags, description)](#helpoptionflags-description)
+ - [.addHelpCommand()](#addhelpcommand)
+ - [More configuration](#more-configuration-2)
+ - [Custom event listeners](#custom-event-listeners)
+ - [Bits and pieces](#bits-and-pieces)
+ - [.parse() and .parseAsync()](#parse-and-parseasync)
+ - [Parsing Configuration](#parsing-configuration)
+ - [Legacy options as properties](#legacy-options-as-properties)
+ - [TypeScript](#typescript)
+ - [createCommand()](#createcommand)
+ - [Node options such as `--harmony`](#node-options-such-as---harmony)
+ - [Debugging stand-alone executable subcommands](#debugging-stand-alone-executable-subcommands)
+ - [Override exit and output handling](#override-exit-and-output-handling)
+ - [Additional documentation](#additional-documentation)
+ - [Examples](#examples)
+ - [Support](#support)
+ - [Commander for enterprise](#commander-for-enterprise)
+
+For information about terms used in this document see: [terminology](./docs/terminology.md)
+
+## Installation
+
+```bash
+npm install commander
+```
+
+## Declaring _program_ variable
+
+Commander exports a global object which is convenient for quick programs.
+This is used in the examples in this README for brevity.
+
+```js
+const { program } = require('commander');
+program.version('0.0.1');
+```
+
+For larger programs which may use commander in multiple ways, including unit testing, it is better to create a local Command object to use.
+
+```js
+const { Command } = require('commander');
+const program = new Command();
+program.version('0.0.1');
+```
+
+For named imports in ECMAScript modules, import from `commander/esm.mjs`.
+
+```js
+// index.mjs
+import { Command } from 'commander/esm.mjs';
+const program = new Command();
+```
+
+And in TypeScript:
+
+```ts
+// index.ts
+import { Command } from 'commander';
+const program = new Command();
+```
+
+## Options
+
+Options are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma or space or vertical bar ('|').
+
+The parsed options can be accessed by calling `.opts()` on a `Command` object, and are passed to the action handler.
+(You can also use `.getOptionValue()` and `.setOptionValue()` to work with a single option value,
+and `.getOptionValueSource()` and `.setOptionValueWithSource()` when it matters where the option value came from.)
+
+Multi-word options such as "--template-engine" are camel-cased, becoming `program.opts().templateEngine` etc.
+
+Multiple short flags may optionally be combined in a single argument following the dash: boolean flags, followed by a single option taking a value (possibly followed by the value).
+For example `-a -b -p 80` may be written as `-ab -p80` or even `-abp80`.
+
+You can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted.
+
+By default options on the command line are not positional, and can be specified before or after other arguments.
+
+### Common option types, boolean and value
+
+The two most used option types are a boolean option, and an option which takes its value
+from the following argument (declared with angle brackets like `--expect `). Both are `undefined` unless specified on command line.
+
+Example file: [options-common.js](./examples/options-common.js)
+
+```js
+program
+ .option('-d, --debug', 'output extra debugging')
+ .option('-s, --small', 'small pizza size')
+ .option('-p, --pizza-type ', 'flavour of pizza');
+
+program.parse(process.argv);
+
+const options = program.opts();
+if (options.debug) console.log(options);
+console.log('pizza details:');
+if (options.small) console.log('- small pizza size');
+if (options.pizzaType) console.log(`- ${options.pizzaType}`);
+```
+
+```bash
+$ pizza-options -p
+error: option '-p, --pizza-type ' argument missing
+$ pizza-options -d -s -p vegetarian
+{ debug: true, small: true, pizzaType: 'vegetarian' }
+pizza details:
+- small pizza size
+- vegetarian
+$ pizza-options --pizza-type=cheese
+pizza details:
+- cheese
+```
+
+`program.parse(arguments)` processes the arguments, leaving any args not consumed by the program options in the `program.args` array. The parameter is optional and defaults to `process.argv`.
+
+### Default option value
+
+You can specify a default value for an option which takes a value.
+
+Example file: [options-defaults.js](./examples/options-defaults.js)
+
+```js
+program
+ .option('-c, --cheese ', 'add the specified type of cheese', 'blue');
+
+program.parse();
+
+console.log(`cheese: ${program.opts().cheese}`);
+```
+
+```bash
+$ pizza-options
+cheese: blue
+$ pizza-options --cheese stilton
+cheese: stilton
+```
+
+### Other option types, negatable boolean and boolean|value
+
+You can define a boolean option long name with a leading `no-` to set the option value to false when used.
+Defined alone this also makes the option true by default.
+
+If you define `--foo` first, adding `--no-foo` does not change the default value from what it would
+otherwise be. You can specify a default boolean value for a boolean option and it can be overridden on command line.
+
+Example file: [options-negatable.js](./examples/options-negatable.js)
+
+```js
+program
+ .option('--no-sauce', 'Remove sauce')
+ .option('--cheese ', 'cheese flavour', 'mozzarella')
+ .option('--no-cheese', 'plain with no cheese')
+ .parse();
+
+const options = program.opts();
+const sauceStr = options.sauce ? 'sauce' : 'no sauce';
+const cheeseStr = (options.cheese === false) ? 'no cheese' : `${options.cheese} cheese`;
+console.log(`You ordered a pizza with ${sauceStr} and ${cheeseStr}`);
+```
+
+```bash
+$ pizza-options
+You ordered a pizza with sauce and mozzarella cheese
+$ pizza-options --sauce
+error: unknown option '--sauce'
+$ pizza-options --cheese=blue
+You ordered a pizza with sauce and blue cheese
+$ pizza-options --no-sauce --no-cheese
+You ordered a pizza with no sauce and no cheese
+```
+
+You can specify an option which may be used as a boolean option but may optionally take an option-argument
+(declared with square brackets like `--optional [value]`).
+
+Example file: [options-boolean-or-value.js](./examples/options-boolean-or-value.js)
+
+```js
+program
+ .option('-c, --cheese [type]', 'Add cheese with optional type');
+
+program.parse(process.argv);
+
+const options = program.opts();
+if (options.cheese === undefined) console.log('no cheese');
+else if (options.cheese === true) console.log('add cheese');
+else console.log(`add cheese type ${options.cheese}`);
+```
+
+```bash
+$ pizza-options
+no cheese
+$ pizza-options --cheese
+add cheese
+$ pizza-options --cheese mozzarella
+add cheese type mozzarella
+```
+
+For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).
+
+### Required option
+
+You may specify a required (mandatory) option using `.requiredOption`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option` in format, taking flags and description, and optional default value or custom processing.
+
+Example file: [options-required.js](./examples/options-required.js)
+
+```js
+program
+ .requiredOption('-c, --cheese ', 'pizza must have cheese');
+
+program.parse();
+```
+
+```bash
+$ pizza
+error: required option '-c, --cheese ' not specified
+```
+
+### Variadic option
+
+You may make an option variadic by appending `...` to the value placeholder when declaring the option. On the command line you
+can then specify multiple option-arguments, and the parsed option value will be an array. The extra arguments
+are read until the first argument starting with a dash. The special argument `--` stops option processing entirely. If a value
+is specified in the same argument as the option then no further values are read.
+
+Example file: [options-variadic.js](./examples/options-variadic.js)
+
+```js
+program
+ .option('-n, --number ', 'specify numbers')
+ .option('-l, --letter [letters...]', 'specify letters');
+
+program.parse();
+
+console.log('Options: ', program.opts());
+console.log('Remaining arguments: ', program.args);
+```
+
+```bash
+$ collect -n 1 2 3 --letter a b c
+Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }
+Remaining arguments: []
+$ collect --letter=A -n80 operand
+Options: { number: [ '80' ], letter: [ 'A' ] }
+Remaining arguments: [ 'operand' ]
+$ collect --letter -n 1 -n 2 3 -- operand
+Options: { number: [ '1', '2', '3' ], letter: true }
+Remaining arguments: [ 'operand' ]
+```
+
+For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).
+
+### Version option
+
+The optional `version` method adds handling for displaying the command version. The default option flags are `-V` and `--version`, and when present the command prints the version number and exits.
+
+```js
+program.version('0.0.1');
+```
+
+```bash
+$ ./examples/pizza -V
+0.0.1
+```
+
+You may change the flags and description by passing additional parameters to the `version` method, using
+the same syntax for flags as the `option` method.
+
+```js
+program.version('0.0.1', '-v, --vers', 'output the current version');
+```
+
+### More configuration
+
+You can add most options using the `.option()` method, but there are some additional features available
+by constructing an `Option` explicitly for less common cases.
+
+Example files: [options-extra.js](./examples/options-extra.js), [options-env.js](./examples/options-env.js)
+
+```js
+program
+ .addOption(new Option('-s, --secret').hideHelp())
+ .addOption(new Option('-t, --timeout ', 'timeout in seconds').default(60, 'one minute'))
+ .addOption(new Option('-d, --drink ', 'drink size').choices(['small', 'medium', 'large']))
+ .addOption(new Option('-p, --port ', 'port number').env('PORT'));
+```
+
+```bash
+$ extra --help
+Usage: help [options]
+
+Options:
+ -t, --timeout timeout in seconds (default: one minute)
+ -d, --drink drink cup size (choices: "small", "medium", "large")
+ -p, --port port number (env: PORT)
+ -h, --help display help for command
+
+$ extra --drink huge
+error: option '-d, --drink ' argument 'huge' is invalid. Allowed choices are small, medium, large.
+
+$ PORT=80 extra
+Options: { timeout: 60, port: '80' }
+```
+
+### Custom option processing
+
+You may specify a function to do custom processing of option-arguments. The callback function receives two parameters,
+the user specified option-argument and the previous value for the option. It returns the new value for the option.
+
+This allows you to coerce the option-argument to the desired type, or accumulate values, or do entirely custom processing.
+
+You can optionally specify the default/starting value for the option after the function parameter.
+
+Example file: [options-custom-processing.js](./examples/options-custom-processing.js)
+
+```js
+function myParseInt(value, dummyPrevious) {
+ // parseInt takes a string and a radix
+ const parsedValue = parseInt(value, 10);
+ if (isNaN(parsedValue)) {
+ throw new commander.InvalidArgumentError('Not a number.');
+ }
+ return parsedValue;
+}
+
+function increaseVerbosity(dummyValue, previous) {
+ return previous + 1;
+}
+
+function collect(value, previous) {
+ return previous.concat([value]);
+}
+
+function commaSeparatedList(value, dummyPrevious) {
+ return value.split(',');
+}
+
+program
+ .option('-f, --float ', 'float argument', parseFloat)
+ .option('-i, --integer ', 'integer argument', myParseInt)
+ .option('-v, --verbose', 'verbosity that can be increased', increaseVerbosity, 0)
+ .option('-c, --collect ', 'repeatable value', collect, [])
+ .option('-l, --list ', 'comma separated list', commaSeparatedList)
+;
+
+program.parse();
+
+const options = program.opts();
+if (options.float !== undefined) console.log(`float: ${options.float}`);
+if (options.integer !== undefined) console.log(`integer: ${options.integer}`);
+if (options.verbose > 0) console.log(`verbosity: ${options.verbose}`);
+if (options.collect.length > 0) console.log(options.collect);
+if (options.list !== undefined) console.log(options.list);
+```
+
+```bash
+$ custom -f 1e2
+float: 100
+$ custom --integer 2
+integer: 2
+$ custom -v -v -v
+verbose: 3
+$ custom -c a -c b -c c
+[ 'a', 'b', 'c' ]
+$ custom --list x,y,z
+[ 'x', 'y', 'z' ]
+```
+
+## Commands
+
+You can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)).
+
+In the first parameter to `.command()` you specify the command name. You may append the command-arguments after the command name, or specify them separately using `.argument()`. The arguments may be `` or `[optional]`, and the last argument may also be `variadic...`.
+
+You can use `.addCommand()` to add an already configured subcommand to the program.
+
+For example:
+
+```js
+// Command implemented using action handler (description is supplied separately to `.command`)
+// Returns new command for configuring.
+program
+ .command('clone